p.enthalabs

ttsc/packages/graph at master · samchon/ttsc

![Image 1: banner of @ttsc/graph](https://camo.githubusercontent.com/97f86e5dd0a5fad68b8d112fef2aa7d5477a4d59d45c15837b2d5aa4773400bc/68747470733a2f2f747473632e6465762f6f672d67726170682e706e67)

![Image 2: GitHub license](https://github.com/samchon/ttsc/blob/master/LICENSE)![Image 3: NPM Version](https://www.npmjs.com/package/@ttsc/graph)![Image 4: NPM Downloads](https://www.npmjs.com/package/@ttsc/graph)![Image 5: Build Status](https://github.com/samchon/ttsc/actions?query=workflow%3Atest)![Image 6: Guide Documents](https://ttsc.dev/docs/graph)![Image 7: Discord Badge](https://discord.gg/E94XhzrUCZ)

`@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.

![Image 8: The forced chain of thought inside one tool call](https://camo.githubusercontent.com/c253f389444e479b1ffc5dfda7190c30cd220f3447e2c929187dee015b8f8eca/68747470733a2f2f747473632e6465762f626c6f672f696d616765732f636f742d706970656c696e652e737667)

- **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)

![Image 9: Common prompt median token use on Codex GPT-5.4 Mini](https://camo.githubusercontent.com/6c65c6d16a680cca44902e99202a5d99338c83ede419f1a229fb636ec058b358/68747470733a2f2f747473632e6465762f62656e63686d61726b2f67726170682d636f6d6d6f6e2d636f6465782d6770742d352e342d6d696e692e737667)

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):

![Image 10: The TypeORM code graph rendered in 3D](https://ttsc.dev/docs/graph/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) ![Image 11: Sponsors](https://github.com/sponsors/samchon)

Thanks for your support.

Your donation encourages `ttsc` development.