ts-review-graph
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
ts-review-graph
このプロジェクトは 2026-09-17 にクローズしました。 新規の機能追加・不具合修正・リリースは行いません。 理由: 同一条件の head-to-head ベンチマーク(BENCHMARK.md)で、元となった code-review-graph に対する共変更 recall の優位が確認できなかったため。残る差は pnpm workspace の import 解決だけで、これは code-review-graph の issue #343 を上流で直す方が維持コストが低いと判断した。 代替は code-review-graph を推奨する。npm パッケージは deprecate 済み(0.5.5 が最終版)。
Build a TypeScript dependency graph in SQLite and tell Claude Code (via MCP) the minimal file set to read before any code review, implementation, or debugging session.
日本語: TypeScript プロジェクトの依存グラフを SQLite に構築し、コードレビュー・実装・デバッグ前に「読むべき最小ファイルセット」を Claude Code (MCP) に伝えるツール。
Why?
TypeScript の依存関係には、source の文字列や AST だけではなく、Compiler API と互換性のある module / symbol resolution を通さないと見えないものがあります。例えば non-relative import、型の宣言元、implements / extends の関係です。
ts-review-graph は ts-morph 経由で TypeScript Compiler API の module / symbol resolution を使い、その結果を SQLite graph に保存します。事前構築した graph から変更の blast radius を引くことで、関連度の高いファイルを先に読めます。
co-change ベンチマーク(0.5.5 core・2026-09-16 再測定)
同じ固定 snapshot の3リポジトリ・501 commit で、code-review-graph 2.3.8 本体と比較しました。reverse depth 2 の平均 recall は ts-review-graph 41.55% / code-review-graph 43.60% でした。
手法 | Recall 平均 | Precision 平均 | 平均予測数 |
ts-review-graph depth 2 / review | 41.55% | 14.49% | 24.73 |
code-review-graph depth 2 | 43.60% | 16.54% | 22.24 |
ts-review-graph implement(FORWARD を追加) | 55.56% | 10.43% | 40.30 |
code-review-graph の未解決 workspace import は全体 397行 でした。同じ source 223ファイルから ts-review-graph がプロジェクト内へ解決した import は 947エッジです(相対 import 等も含むため、1対1の修復件数ではありません)。型エッジ ablation の全体 recall 差は review +0.00pt、implement +0.00pt でした。
比較の限界: code-review-graph 本体を実行した比較ですが、crg の depth はノード間の
CALLS/REFERENCES/TESTED_BY等を跨ぐため、深さの対応は名目上です。tsconfig の include 外も走査するので、カバレッジの違いも含みます。
製品 baseline は main bc136afdfc47b7f4fcc4e8bcfcbe36ea75ba522f。snapshot・precision 除外・depth 3・改善/悪化件数・再現手順は BENCHMARK.md に記載しています。
Related MCP server: codegraph-mcp
Requirements
Node.js 20+
Claude Code plugin を使う場合は bash と sqlite3 CLI
Installation
Single tsconfig
npx @elchika-inc/ts-review-graph@latest install --tsconfig tsconfig.jsonConfig is saved to .ts-review-graph/config.json, MCP server is registered in .mcp.json (Claude Code) and .codex/config.toml (Codex), and usage instructions are appended to CLAUDE.md. Restart Claude Code and the MCP server connects automatically.
生成される .mcp.json は、MCP server を install に使用した CLI と同じ version に固定します。これにより、セッション起動時に古い graph reader や未確認の将来の latest release が選ばれることを防ぎます。トレードオフとして修正版は自動受信されないため、ts-review-graph の更新時は更新後の CLI version で、初回と同じ --tsconfig / --db option を指定して install を再実行してください。
Monorepo (multiple tsconfigs)
npx @elchika-inc/ts-review-graph@latest install \
--tsconfig apps/api/tsconfig.json \
--tsconfig apps/web/tsconfig.app.json \
--tsconfig apps/worker/tsconfig.jsonMultiple tsconfigs are merged into a single unified graph (tested with 1,191+ nodes across layers).
Claude Code plugin(任意)
既存の CLI install はグラフ構築と MCP server 登録を行います。Claude Code plugin はそれに加えて commands・hooks・skills を導入し、Read のたびにブラスト半径をアドバイザリ表示する hook を有効にします。
claude plugin marketplace add elchika-inc/ts-review-graph
claude plugin install ts-review-graphplugin 自体はグラフを構築しません。plugin 導入前または導入後に、対象 project で CLI の install を別途実行してください。既に config.json がある場合は build でも再構築できますが、plugin は既定の .ts-review-graph/graph.db だけを参照するため、custom --db は使わないでください。
plugin を更新するには claude plugin update ts-review-graph を実行し、Claude Code を再起動します。CLI も更新する場合は、更新後の CLI version で初回と同じ option を指定して install を再実行してください。
Codex
install は Claude Code 用の .mcp.json に加えて、Codex の project 単位設定 .codex/config.toml にも同じ MCP server を登録します。書き込まれる内容は次の形で、version は install に使用した CLI と同じものに固定されます。
[mcp_servers.ts-review-graph]
command = "npx"
args = [
"-y",
"@elchika-inc/ts-review-graph-mcp-server@<install に使用した CLI と同じ version>",
]既に [mcp_servers.ts-review-graph] がある場合はエントリを重複させません。args がある場合、更新できるかは args に @elchika-inc/ts-review-graph-mcp-server の指定があるかで決まります。指定があれば command の値(docker 等)に関わらず、その version 指定だけを差し替えます(version が付いていなければ付与します)。args が無い場合は、command が npx か未指定のときにかぎり既定の args を書き足します。--log-level debug のように独自に足した引数はそのまま残り、command を独自の値へ変えている場合もそれを保持します(command が無いときだけ "npx" を補います)。env は書かず、既存の TS_REVIEW_GRAPH_DB(.mcp.json から写したパスなど)があれば除去します — env の他のキーはそのまま残ります(env が複数行のインラインテーブルの場合は、1行へ畳むとファイルが壊れるため触りません)。他の [mcp_servers.*] エントリや他のセクションには触れません。
次のいずれかに当てはまるエントリは、どう起動したいのかを推測できないためそのエントリだけ更新せず警告します(env も含めて一切変更しません)。install 自体は続行し、.mcp.json などは通常どおり更新されるので、version の更新が必要なら .codex/config.toml を手動で編集してください。
argsに@elchika-inc/ts-review-graph-mcp-serverの指定が無いargsが無くcommandがnpx以外(command = "docker"など)commandまたはargsをドット記法(command.foo = ...)やサブテーブル([mcp_servers.ts-review-graph.command]、その配下も含む)で書いているmcp_serversやmcp_servers.ts-review-graphをインラインテーブル・ドット記法(ts-review-graph = { ... }など)で定義している
スキップされた場合、[mcp_servers.ts-review-graph] というテーブル見出しがファイルに無いときは、エントリの新規追加も行いません(末尾に見出しを足すと TOML 仕様違反になる、あるいはどこへ足すべきか決められないため)。上の条件のうち、見出しが無い形で起きるのは次の3つです。
mcp_servers = { ... }のようにmcp_servers自体をインラインテーブルで定義している場合。installはインラインテーブルの中身までは解釈しないので、ts-review-graphエントリが既にあるかどうかも判定できません(エントリが無ければ Codex から使えず、既にあっても version は自動更新されません)。→mcp_serversをテーブル見出し記法([mcp_servers])へ書き直してください。[mcp_servers]の下にts-review-graph = { ... }と書く、またはmcp_servers.ts-review-graph.command = "npx"のようにドット記法で書いている場合。→ その定義を[mcp_servers.ts-review-graph]見出しと、その直下の通常のキーへ書き直してください。[mcp_servers.ts-review-graph]本体を書かずに[mcp_servers.ts-review-graph.command]/[mcp_servers.ts-review-graph.args](およびその配下)の子テーブルだけを書いている場合。→command/argsを[mcp_servers.ts-review-graph]直下の通常のキーへ書き直してください。
いずれも、書き直してから install を再実行するか、[mcp_servers.ts-review-graph] を手動で設定してください。
既存の .codex/config.toml をそもそも正しく読めない場合(値や文字列が閉じていない、括弧の対応が取れていない、テーブル見出しを解釈できない、[mcp_servers.ts-review-graph] セクションやその子テーブル([mcp_servers.ts-review-graph.env] など)、あるいはその配下のキーが重複定義されている、[[mcp_servers.ts-review-graph]] で定義されている等)、install は .ts-review-graph/config.json・.mcp.json・.codex/config.toml・CLAUDE.md をいずれも書かずに中止します(グラフ構築も行われません)。ただし中止より前に実行される .gitignore の除外設定と .ts-review-graph/ignore の雛形作成は、中止時にも残ることがあります(どちらも冪等です)。表示されたエラーメッセージに従って該当箇所を修正(閉じていない文字列・括弧なら閉じる、重複定義は1つへ統合、[[...]] は通常のテーブル見出しへ)してから install を再実行してください。
既知の制限:
project 単位の設定が読まれるのは trust 済みの project だけです。 trust されていない project では Codex が
.codex/config.tomlのmcp_serversを読み込まないため、~/.codex/config.tomlへ同じ[mcp_servers.ts-review-graph]を手動で登録してください。trust 状態は~/.codex/config.toml側にtrust_level = "trusted"として記録されます。Codex から使えるのは
.codex/config.toml経由で登録される MCP tools です。 Claude Code plugin が導入する commands・hooks・skills はclaude plugin installで Claude Code 側に入るもので、対象 project のディレクトリには置かれないため Codex からは読み込まれません(Codex 自身の hooks / skills 機構とは別物です)。plugin が提供するRead時のブラスト半径アドバイザリ表示も Codex では働きません。installが使用方法を追記するのはCLAUDE.mdなので、Codex のエージェントに恒常的に守らせたい場合は同じ内容をAGENTS.mdへコピーしてください。Codex 用の書き込みだけを省く option はありません。
installは常に.codex/config.tomlを作成・更新します(Codex を使わない project にも作られます)。uninstallは.codex/config.tomlを自動削除しません(手動削除の案内のみ出します)。custom
--dbを指定した場合でも Codex 用エントリにはenvを書かないため、Codex 側は既定の.ts-review-graph/graph.dbを参照します。エントリが更新対象の場合、.codex/config.tomlへ手動でTS_REVIEW_GRAPH_DBを足しても次のinstallで除去されるため、custom DB を Codex から使う場合は~/.codex/config.toml側のエントリか、Codex 起動時の環境変数で指定してください。
Usage
In Claude Code (automatic)
Claude calls get_minimal_context automatically before reading source files:
get_minimal_context(["src/routes/monitors.ts"], "implement")Example output (implement mode, apps/web + apps/api):
Changed: src/routes/monitors.ts
── Files affected (REVERSE depth=3) ──
1. src/routes/services.ts [IMPORTS_FROM]
── Files to change together (FORWARD depth=1) ──
1. src/env.ts [direct import]
2. src/lib/schemas.ts [direct import]
3. src/lib/format.ts [direct import]
4. packages/db/src/index.ts [direct import]
SKIP: 1170 other files — not in blast radiusCLI commands
Command | Description |
| Setup + initial build + register MCP + append |
| Rebuild the graph |
| Incremental update for a single file |
| Show graph statistics |
| Remove MCP registration |
MCP tools
Tool | Key args | Description |
|
| Minimal file set (REVERSE/FORWARD BFS) |
|
| Files affected by a change, with depth |
|
| Nodes that reference a type |
|
| Corresponding test files |
|
| General-purpose graph traversal |
|
| File-level circular imports |
|
| Rebuild the graph |
| — | Graph statistics |
Graph health checks
The six graph-query tools (get_minimal_context, get_impact, get_type_usages,
get_test_coverage, query_graph, and find_cycles) validate the graph before answering:
Condition | Behavior |
| Refuses — rebuild required |
| Refuses — rebuild required |
Known files whose disk mtime is newer than their last full or incremental graph update, or which are missing from disk | Answers, prefixed with |
ts-review-graph status reports the same verdict on a health: line.
MCP graph_status remains quarantine-exempt — it never refuses — and prints the same verdict on its own health: line (OK / MISMATCH (reason) — detail / STALE (n/m files changed), or 判定できません: … when the check itself fails), so the one tool you use to inspect a broken graph does not report "normal" while the other six refuse.
Graph paths are stored relative to the project root, so a graph.db moved or copied
with its working tree remains usable at the new root. Because graph.db is ignored,
a normal clone or newly created worktree does not contain it and requires install or build.
BFS depth by mode
Mode | REVERSE | FORWARD | Use case |
| depth=2 | — | Pre-review impact analysis (downstream) |
| depth=3 | depth=1 (direct imports only) | Pre-implementation change surface (bidirectional) |
| depth=5 | — | Wide exploration for bug investigation |
Configuration
.ts-review-graph/config.json (auto-generated by install, commit to repo):
{
"tsconfigs": [
"apps/api/tsconfig.json",
"apps/web/tsconfig.app.json",
"apps/monitor-worker/tsconfig.json"
]
}graph.db はビルド成果物です。既定 DB の graph.db・graph.db-wal・graph.db-shm は自動的に .gitignore へ追加されます。--db でリポジトリ内の別パスを指定した場合は、その DB・WAL・SHM を利用者が .gitignore へ追加してください。config.json はチームで共有してください。
Run CLI and MCP commands from the project root. --db changes only the database location;
it does not change which directory is treated as the project root.
How it works
Build phase
Load each
tsconfig.jsonWalk the AST using the TypeScript Compiler API
Extract import/export/type relationships
Store nodes and edges in SQLite (
graph.db)
Query phase
Specify changed files (
["src/routes/monitors.ts"])Run BFS in the selected mode:
REVERSE: who imports this file (downstream impact)
FORWARD: what this file imports (upstream co-change candidates)
Return only files within the blast radius
Tech stack
Language: TypeScript 5.4+
Database: SQLite 3 (better-sqlite3)
Graph traversal: SQL recursive CTE (
WITH RECURSIVE)MCP: Model Context Protocol SDK v1.0.0
CLI: Commander.js 12.0.0
License
MIT
Packages
Package | Description |
| CLI tool |
| MCP server |
| Graph build & query engine |
Links
BENCHMARK.md — benchmark data
CHANGELOG.md — release notes
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Ask who calls a route, what a change breaks or who reads a field, across a system's repos.
Coding agents in multi-service codebases routinely rebuild existing helpers, trust stale type definitions, and modify API contracts without knowing who consumes them. Carrick solves this by indexing your entire TypeScript ecosystem across service and repository boundaries. By integrating deeply with the TypeScript compiler, Carrick traces every route, type, and cross-service call while recording function behaviour so agents search by intent rather than name. Delivered via MCP for AI agents and LSP for IDEs, Carrick ensures models see existing endpoints and utilities before generating new code. The scanner is source-available and runs from your CLI or CI pipeline.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables querying and analyzing code relationships by building a lightweight graph of TypeScript and Python symbols. Supports symbol lookup, reference tracking, impact analysis from diffs, and code snippet retrieval through natural language.MIT
- AlicenseAqualityDmaintenanceAn MCP server that indexes TypeScript/JavaScript codebases into precise call and import graphs using the TypeScript compiler API, allowing Claude or any MCP client to query definitions, callers, callees, and perform impact analysis.7MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying a TypeScript codebase's graph for call flows, type relationships, and symbol locations without reading file bodies.-
- AlicenseAqualityBmaintenanceProvides coding agents with a compact map of a TypeScript/TSX codebase, enabling direct answers about symbol locations, imports, dependencies, and references while reducing token usage.514 npm2MIT