Skip to Content
πŸ“– Guide DocumentsCompiler Knowledge GraphOverview

Compiler Knowledge Graph

Your coding agent answers from the compiler instead of reading files.

A file-by-file source crawl collapsing into a compiler-built graph index

Ask an agent how something works and it opens a file, follows an import, opens the next, and repeats. That crawl is most of the token bill, and the relationships it infers are guesses from whatever text it happened to read.

One MCP tool, inspect_typescript_graph, answers instead. Its replies carry names, signatures, relationships, and source spans, never file bodies, so neither the question nor the answer grows with the repository.

  • How is this project laid out? Entry points, layers, and the symbols the most code leans on: overview.
  • Give me a code tour. Central flow, nearby paths, tests, and answer anchors: tour.
  • Where should I start? Ranked code handles for a natural question: entrypoints or lookup.
  • What does this reach, and what reaches it? Forward to callees, reverse to callers, and an impact projection onto the public API and tests: trace.
  • What is this, exactly? The declaration shape, its range, its dependencies, and its dependents: details.
  • Which code implements this specification? The declarations whose documentation cites a document section, an API operation, or a data model: lookup, with the target as the query.

Every node and edge is the compiler’s own answer, which is what a text search cannot give you.

  • pnpm workspaces. A workspace:* dependency is followed into the sibling package’s real source, so a cross-package call lands on the true declaration rather than the barrel it passed through.
  • Path aliases. A @app/* import from tsconfig resolves to the real file.
  • Barrel re-exports. An index.ts that only re-exports is unwrapped to the file that declares the symbol.
  • Your code, not the world. Anything in node_modules or a .d.ts is an outside boundary rather than a place to walk into, and generated sources your .gitignore covers are de-ranked.
  • Documentation links. A {@link Symbol} the checker resolves is an edge like any other, and a tag the type system does not recognize is carried as written, so lookup answers which declarations cite docs/pricing.md#sale.

Benchmark

Loading graph benchmark results...

The median token cost on one shared onboarding question, against no MCP and the three comparators. Lower is better.

The line stays flat because neither side of the exchange grows with the repository: the agent stops fanning out across files, and the graph answers in names and edges rather than bodies. The comparators swing with repository size because their cost still follows how much source has to be read.

Indexing is the other half of the trade. The graph is a byproduct of the type-check the compiler already runs, so the three-million-line VS Code fixture is ready in 29 seconds, where a separate index spends minutes before it can answer anything.

Setup

npm install -D ttsc @ttsc/graph typescript
{ "mcpServers": { "ttsc-graph": { "command": "npx", "args": ["-y", "@ttsc/graph"] } } }

Start the agent from your project root so the server finds your tsconfig.json, or name the project with --cwd and --tsconfig. The native binary is resolved from the project being graphed, which is why ttsc is installed alongside.

The server never writes into your CLAUDE.md, AGENTS.md, or any other agent config, so installing it changes nothing in your repository.

Comparison

How it differs from codegraph, codebase-memory-mcp, and serena: the resolution backend, the language scope, the index each one builds, and what that costs in tokens and in time.

3D Viewer

The same checker-resolved graph, rendered as a navigable ontology. Pick a benchmark repository or load your own project.

[Code graph]

Browse a code graph in 3D

Pick a benchmark example, or load a graph from your own project. Drag to orbit, scroll to zoom, click a node to focus it; the explorer spotlights files and finds symbols by name.

Loading…
value-call (runtime use)type-refdoc-ref (documentation link)heritage (extends / implements / overrides)exports (module surface)node size = connection count Β· color = declaration kind
Last updated on