@ttsc/graph is an MCP server that gives AI agents…
@ttsc/graph is an MCP server that gives AI agents a code graph instead of source files.
It indexes a TypeScript codebase into a graph of declarations and their relationships, and answers an agent's code questions from that index through a single tool. Every node and edge is resolved by the TypeScript compiler itself, so the graph is exact for TypeScript and TSX, never text-guessed.
Coding agents normally answer a code question by grepping the repository and reading file after file into context, and that reading is most of the token bill. The graph removes the need for it, and its own answers stay small in turn: they carry names, signatures, relationships, and source spans, never file bodies.
Since neither side of that exchange grows with the repository, the cost falls by about the same proportion in every situation, on every codebase, for an agent that trusts the graph result enough to stop there. codex/gpt-5.6-sol does: it answers the onboarding question in one to three graph calls, opens no file at all, and spends 4% of what it spends without the server. That even distribution is what separates this from codegraph and serena , whose cost swings with the repository, and it shows directly in the chart below:
npm install -D @ttsc/graph
{ "mcpServers" : { "ttsc-graph" : { "command" : " npx " , "args" : [ " -y " , " @ttsc/graph " ] } } }
Start the client from the project root. The server builds one resident graph and answers every MCP call from memory.
@ttsc/graph reads the graph from the program ttsc type-checked, so the project needs ttsc and typescript installed alongside it. ttsc runs on the native TypeScript 7 compiler from the typescript package; it does not run on the legacy TypeScript v6.x compiler. There is no separate index step and no static-parser fallback: the graph is a byproduct of the type-check the compiler already runs, or it is not built at all.
Each repository is measured with one headless agent run per arm ( baseline with no MCP, @ttsc/graph , codegraph , codebase-memory , serena ) on two prompt families, across two agent CLIs ( codex and Claude Code). The corpus pins eight real TypeScript repositories.
Every arm that mounts a tool — this one and each comparator alike — is told the same single line, that code graph tools are provided, and nothing more; the baseline, which has no tool to be told about, is told to answer from this checkout rather than from what the model already remembers of a famous repository. A model that never opens its tool list cannot be judged on its tools, and a benchmark that names one tool and not another is measuring the naming.
Every repository is asked the same onboarding question, a plain code tour. Across the corpus, @ttsc/graph holds a flat, low median token cost while the alternatives swing with repository size.
codegraph 's own per-repository questions, verbatim, one architecture question per project.
An index answers nothing until it is built, and a developer waits for it before the agent can ask anything at all. This is the other half of the trade: a tool that cuts the token bill and then spends twelve minutes indexing has moved the cost, not removed it.
The faded head of each bar is the cold index build, the solid tail is the LLM answering, and every bar is labelled index / LLM in the order you wait for them. The baseline has no index to build.
At three million lines the index question stops being academic. On VS Code, @ttsc/graph builds in 29 seconds because the graph is a byproduct of the type-check the compiler runs anyway, while codegraph spends twelve minutes and serena four and a half.
The interactive charts, every model, and the method are on the benchmark page: https://ttsc.dev/docs/benchmark/graph
/**
inspect_typescript_graph returns a compiler-built TypeScript graph contracttour: architecture, runtime flow, orientation, or a code tour. One call isentrypoints: find where execution starts when entry points are unknown.lookup: locate a named symbol.trace: follow calls or data flow forward or backward from a symbol, or —to — the path between two symbols when both ends are known, which isdetails: signatures, members, and relations of named symbols — includingoverview: project layers and folder structure.escape: the answer is outside the graph (source body text, non-TypeScriptquestion: the code question, in the user's own words.draft: { reason, type } — why the smallest request that could answer it,type.review: fix a broad, stale, or duplicate draft. If the graph alreadyrequest: the final choice. A tour takes one more step of reasoning — itsreinterpretations: a list of symbol names, never a sentence, naming the[] when the question names noaudit says so on every result: each name, span,next: answer means stop and answer from it, inspectoutside means escape.
/
export interface ITtscGraphApplication {
/*tour: architecture, the runtime flow from the public API to the code thattrace: what a symbol calls, what calls it, or the path from A to Bdetails: signatures, members, and what implements an interfacelookup: where a named symbol is declaredentrypoints: where execution starts, when the entry is unknownoverview: the project's layers and folder structure本条由桃子采集流水线(启发式模式)自动整理,原文见文末信源。