AIエージェントがローカルの依存関係グラフをクエリし、コードの変更がルート、呼び出し、テーブル、設定にどのように影響するかを特定できるようにします。
別名 cyberchronos00/code-graph, cg-code-graph
- スター
- 4
- ツール
- —
- ダウンロード数(30日間)
- 354
- 最新バージョン
- 0.23.14
- 最終コミット
- 2026年11月12日
- ライセンス
- MIT
code-graph MCPとは
code-graphはMCPサーバーです。 AIエージェントがローカルの依存関係グラフをクエリし、コードの変更がルート、呼び出し、テーブル、設定にどのように影響するかを特定できるようにします。.
プロジェクトのREADMEから生成された概要
code-graph MCP server について
code-graphは、開発者やAIエージェントがコードの影響を分析するために設計された、ローカルで決定論的な依存関係グラフを提供します。リポジトリをインデックス化することで、ルート、関数呼び出し、データベーステーブル、および設定キーの間の関係をマッピングします。このツールを使用すると、特定の変更がシステムのさまざまな部分にどのように影響するかを正確に把握でき、グラフ内で見つかったすべての接続に対してファイル名と行番号の根拠を提示します。
ユーザーは、コマンドラインインターフェースを介して、またはMCP serverを通じてAIエージェントを接続することでシステムを操作できます。このサーバーは、Cursor、Claude、VS Codeなどのクライアントに登録可能です。Python、TypeScript、PHP、Dart、Kotlin、Java、Swift、Rustを含む幅広い言語をサポートしています。コードの解釈をLLMに依存する多くのツールとは異なり、このサーバーは正確な解析またはヒューリスティック解析を使用するため、依存関係データが正確で再現可能なものになります。
できること
- 1セキュリティ脆弱性の監査インバウンドおよびアウトバウンドの攻撃対象領域をリストアップし、ハードコードされた認証情報や保護されていないハンドラーなどの問題を特定します。
- 2ルートセキュリティの検証書き込み操作を実行するものの、認証ガードが欠落しているルートを特定します。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
code-graph MCPのインストール方法
フォーマット検証日 2026年11月10日Claude Codeにcode-graph MCPをインストール
$ claude mcp add code-graph -- uvx cg-code-graphCursorにcode-graph MCPをインストール
~/.cursor/mcp.json
{
"mcpServers": {
"code-graph": {
"command": "uvx",
"args": [
"cg-code-graph"
]
}
}
}VS Codeにcode-graph MCPをインストール
.vscode/mcp.json
{
"servers": {
"code-graph": {
"type": "stdio",
"command": "uvx",
"args": [
"cg-code-graph"
]
}
}
}Claude Desktopにcode-graph MCPをインストール
claude_desktop_config.json
{
"mcpServers": {
"code-graph": {
"command": "uvx",
"args": [
"cg-code-graph"
]
}
}
}Codexにcode-graph MCPをインストール
~/.codex/config.toml
[mcp_servers.code-graph] command = "uvx" args = ["cg-code-graph"]
Gemini CLIにcode-graph MCPをインストール
~/.gemini/settings.json
{
"mcpServers": {
"code-graph": {
"command": "uvx",
"args": [
"cg-code-graph"
]
}
}
}自動チェック
実行日 2026年11月12日詳細レポート →自動チェックに合格しました。これはセキュリティ監査ではありません。コードを読み、サーバーに必要最小限のアクセス権を与えてください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能合格
- オープンソースライセンス (OSI)合格
- 過去1年以内にコミットまたはリリースあり合格
- パッケージ名が有名なパッケージに酷似していない合格
- リモートエンドポイントがHTTPSを使用未チェック
- 破壊的なツールがラベル付けされている未チェック
- モデルへの隠れた指示がない合格
- パッケージと依存関係に重大なアドバイザリがない合格
README
GitHubで見るcode-graph
See everything a change affects before you make it: a local, deterministic dependency graph of routes, calls, tables and config, with file:line evidence for every hop.
For you and your AI agent (CLI + MCP). No LLM in the graph.
Docs · Quick start · CLI · MCP · Changelog
Quick start
pipx install cg-code-graph # or: uv tool install cg-code-graph
cg index . --db out/graph.db # prints starter queries for your repo
cg install --host cursor # or claude, codex, vscode, …: registers the MCP server and a "use cg first" agent rule
cg reaches table:orders --db out/graph.db # any table, connection or config key
Try it on a bundled sample, link a frontend to a backend, or connect an agent over MCP: Quick start guide. Other install options (install.sh, Windows, exact-mode toolchains): Install.
cg reaches table:store_books on the bundled Django sample:
dependents: 18 nodes (code: 6, entry points: 9, other: 3)
== RUNTIME (reached from http_route / ... / queue_job / listener): 5 functions/methods
catalog.api.create_book depth=1 conf=resolved http_route(1)
path: function:catalog.api.create_book
-WRITES_TABLE[resolved @ catalog/api.py:27]-> table:store_books
catalog.signals.review_saved depth=3 conf=resolved listener(1)
path: function:catalog.signals.review_saved
-DISPATCHES[exact @ catalog/signals.py:12]-> job:catalog.tasks.recompute_rating
-HANDLED_BY[exact @ catalog/tasks.py:13]-> function:catalog.tasks.recompute_rating
-READS_TABLE[resolved @ catalog/tasks.py:14]-> table:store_books
Supported languages
| Language | Frameworks and facts | Calls | Docs |
|---|---|---|---|
| Django (+ DRF, django-ninja), FastAPI / Starlette, Flask, Celery | exact (stdlib ast) |
Python | |
| Nuxt / Vue, NestJS, Next.js, Astro, Express, Fastify, Koa, Hono, Elysia, React Router / Remix | exact (TypeScript compiler API) | TS frameworks | |
| Laravel (routes, route attributes, middleware, queues, broadcasting, outbound HTTP) | exact (nikic/php-parser; needs PHP 8.2+) | PHP | |
| Flutter | exact (Dart analyzer; needs the Dart SDK) | Platforms | |
| Android, Kotlin Multiplatform, Spring | heuristic; exact with scip-java (opt-in) | Kotlin | |
| Spring (routes, guards, beans, tables, clients) | heuristic; exact with scip-java (opt-in) | Java | |
| iOS / SwiftPM | heuristic; exact with the Swift index store (opt-in) | Swift | |
crates / modules, entry points, FFI, #[cfg] / #if gates |
heuristic; exact with rust-analyzer / scip-clang | Rust, C and C++ |
Go and others: import a SCIP index with cg index --scip FILE. Run cg doctor to see exact / heuristic per language on your machine.
What you get
reaches,impact,path: every caller, route, job and page that reaches a table, config key or method.cg affected --base main: the tests and entry points a change reaches (--quietfeeds your test runner).- Across repos:
cg linkmatches client HTTP calls (frontends and Laravel / Guzzle backends) to server routes, and checks request keys (Laravel FormRequest, Elysia schemas, Nuxt / TypeScript bodies). - Route guards:
cg routes --writes --unguardedlists routes that write with no auth guard. Laravel checks inside the action count as inline guards unless--strict. - Security views:
cg surfacelists the inbound / outbound attack surface and findings (hardcoded credentials, plaintext protocols, unverified webhooks, unguarded handlers, listeners on all interfaces, disabled TLS / SSH verification, plaintext gRPC, exposed IPC, outbound URLs built from request input) as text, JSON or SARIF, with--fail-onfor CI. - MCP server (
cg-mcp) so agents query the graph instead of grepping. One server can serve many graphs (graphsplus an optionalgraphargument); a single--dbstays one graph. See MCP. - Visual view (
cg serve) and plan checks (cg plan check) for planned changes.
Docs
Install · Quick start · CLI · MCP · Configuration · Architecture · Limitations
Changelog · Contributing · Security · MIT License
More recordings: docs/media.
code-graph MCPのよくある質問
code-graph MCPをClaude Codeに追加するには
ターミナルでclaude mcp add code-graph -- uvx cg-code-graphを実行します。すべてのプロジェクトで利用するには--scope userを追加します。
code-graph MCPをCursorに追加するには
~/.cursor/mcp.jsonを開き、上記のインストールセクションに示すCursor設定を使ってmcpServersの下にサーバーを追加します。
グラフの構築にLLMを使用しますか?
いいえ、依存関係グラフはローカルで決定論的に構築されるため、LLMは使用しません。
セキュリティ監査に役立ちますか?
はい、インバウンドおよびアウトバウンドの攻撃対象領域をリストアップし、ハードコードされた認証情報や保護されていないハンドラーなどの検出事項を特定できます。

