ttsc/packages/graph at master · samchon/ttsc


`@ttsc/graph` gives your coding agent a **graph of your TypeScript codebase** over MCP: what calls what, what depends on what, where each piece lives.
It is drawn by the real TypeScript compiler, so it is exact, and every claim is anchored to a file and line you can open.
The agent answers structural questions from the graph instead of crawling file by file, which cuts its tokens by roughly 10x on open-ended "how does this work?" questions.
For why I built it, how it works in depth, and how it compares to `codegraph`, `codebase-memory-mcp`, and `serena`, read the launch post: https://ttsc.dev/blog/i-made-ts-compiler-graph-mcp
Setup
[](https://github.com/samchon/ttsc/tree/master/packages/graph#setup)
npm install -D ttsc @ttsc/graph typescript@rc
`@ttsc/graph` reads the graph from the program `ttsc` type-checked, so install the two together.
`ttsc` runs on the TypeScript-Go (TypeScript v7) runtime, which is still a release candidate, so the install pins `typescript@rc`. It does not run on stable TypeScript v6.x yet.
Add the server to your agent's MCP config, once. For Claude Code, that is a `.mcp.json` in your project root:
{ "mcpServers": { "ttsc-graph": { "command": "npx", "args": ["-y", "@ttsc/graph"] } } }
Start your agent from your project root so the server finds your `tsconfig.json`. The agent queries the graph on its own; you never call it by hand.
The example says Claude Code, but any MCP-capable agent works (Codex, Cursor, and others).
How it works
[](https://github.com/samchon/ttsc/tree/master/packages/graph#how-it-works) The whole MCP surface is one tool, `inspect_typescript_graph`. You ask in plain language, and a short required chain of thought inside the tool (`question`, `draft`, `review`) plans the smallest query and picks one operation.

- **An index, not source bodies.** It returns names, edges, signatures, and spans, never code, so the response stays flat as the repository grows.
- **Built on the real compiler.** It reads the program `ttsc` type-checked, so `tsconfig` aliases, pnpm monorepos, symlinks, and re-exports resolve exactly, where a text parser can only guess.
- **It does not force itself.** It states when the graph is the right source and offers a first-class `escape` for everything else.
- **Errors and lint too.**`tsc` compile errors and `@ttsc/lint` and plugin (typia, nestia) findings ride the same graph, so "what is broken here?" answers from one index.
The operations (`tour`, `entrypoints`, `lookup`, `trace`, `details`, `overview`, `escape`) and the full request and result contract are in the Design guide: https://ttsc.dev/docs/graph/design
Benchmark
[](https://github.com/samchon/ttsc/tree/master/packages/graph#benchmark)

Across eight real repositories, `@ttsc/graph` holds a flat, low median token cost while the alternatives swing with repository size.
The full benchmark has the interactive charts, every model, and the method: https://ttsc.dev/docs/benchmark/graph
Browse it in 3D
[](https://github.com/samchon/ttsc/tree/master/packages/graph#browse-it-in-3d) Run this in your own project to open the graph in your browser, served from a local port:
npx @ttsc/graph view
This is TypeORM in 3D, colored by kind (live viewer):

Learn more
[](https://github.com/samchon/ttsc/tree/master/packages/graph#learn-more)
- Launch post: why I built it, and how it compares to `codegraph`, `codebase-memory-mcp`, and `serena`.
- Design: the one tool, its request and result branches, and the node and edge kinds.
- Comparison: the head-to-head with other graph and language-server MCP tools.
- Benchmark: the interactive charts, every model, and the method.
Sponsors
[](https://github.com/samchon/ttsc/tree/master/packages/graph#sponsors) 
Thanks for your support.
Your donation encourages `ttsc` development.