Enables AI agents to query a repository's symbol graph to perform impact analysis, call tracing, and structural audits across Python, TypeScript, and Go.
다른 이름 zaebee/codegraph-brain, codegraph-brain
- 스타
- 2
- Tools
- 11
- 다운로드, 30일
- 2,281
- 최신 버전
- 0.39.2
- 마지막 커밋
- 2026년 11월 8일
- 라이선스
- MIT
CGIS Code Graph MCP란?
CGIS Code Graph은(는) MCP server입니다. Enables AI agents to query a repository's symbol graph to perform impact analysis, call tracing, and structural audits across Python, TypeScript, and Go. 11개 도구를 제공합니다. 예: cgis_ingest, cgis_overview, cgis_find_symbol.
프로젝트 README에서 생성된 요약
CGIS Code Graph MCP server 정보
CGIS Code Graph Intelligence System provides a way for AI agents to navigate codebases using a structured symbol graph instead of relying on text searches or file reading. It parses repositories using tree-sitter to map calls, imports, and containment between symbols, storing this data in a local SQLite database. This approach allows agents to perform precise impact analysis and call tracing across Python, TypeScript, and Go projects.
The system runs locally without requiring accounts or telemetry, ensuring the graph remains on your disk. Developers can integrate it with MCP clients like Claude Desktop or Cursor using uvx to fetch the server from PyPI. It offers specialized tools for structural audits, such as checking reachability for authorization or measuring architectural drift. By resolving calls to fully qualified names, it prevents the hallucinations common in standard text-based retrieval methods.
활용 사례
- 1Perform impact analysisDetermine which upstream components will break if a specific function or method is modified.
- 2Trace execution flowFollow the transitive chain of calls to see exactly what a specific method invokes.
- 3Audit security coverageVerify that every request handler successfully reaches its intended authorization guard.
- 4Measure code quality metricsAnalyze the codebase for god classes, coupling, and package cohesion.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
CGIS Code Graph MCP 설치 방법
형식 확인: 2026년 11월 10일Claude Code에 CGIS Code Graph MCP 설치
$ claude mcp add codegraph-brain -- uvx codegraph-brainCursor에 CGIS Code Graph MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"codegraph-brain": {
"command": "uvx",
"args": [
"codegraph-brain"
]
}
}
}VS Code에 CGIS Code Graph MCP 설치
.vscode/mcp.json
{
"servers": {
"codegraph-brain": {
"type": "stdio",
"command": "uvx",
"args": [
"codegraph-brain"
]
}
}
}Claude Desktop에 CGIS Code Graph MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"codegraph-brain": {
"command": "uvx",
"args": [
"codegraph-brain"
]
}
}
}Codex에 CGIS Code Graph MCP 설치
~/.codex/config.toml
[mcp_servers.codegraph-brain] command = "uvx" args = ["codegraph-brain"]
Gemini CLI에 CGIS Code Graph MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"codegraph-brain": {
"command": "uvx",
"args": [
"codegraph-brain"
]
}
}
}CGIS Code Graph MCP 도구 11
README에서 감지됨cgis_ingestcgis_overviewcgis_find_symbolcgis_analyze_impactcgis_trace_flowcgis_get_structurecgis_contextcgis_metricscgis_audit_reachabilitycgis_driftcgis_validate
| cgis_ingest | — | |
| cgis_overview | — | |
| cgis_find_symbol | — | |
| cgis_analyze_impact | — | |
| cgis_trace_flow | — | |
| cgis_get_structure | — | |
| cgis_context | — | |
| cgis_metrics | — | |
| cgis_audit_reachability | — | |
| cgis_drift | — | |
| cgis_validate | — |
구성
GUARDIAN_PROVIDERGUARDIAN_SKEPTIC
| 이름 | 설명 | 유형 |
|---|---|---|
| GUARDIAN_PROVIDER | — | |
| GUARDIAN_SKEPTIC | — |
자동 검사
2026년 11월 12일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음통과
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨통과
- 모델에 대한 숨겨진 지침 없음통과
- 패키지와 의존성에 심각한 보안 권고 없음통과
README
GitHub에서 보기🧠 CGIS: Code Graph Intelligence System
A code graph your AI agent can query instead of guess
Ask "what breaks if I change this?" and get the call chain, not a guess.
CGIS parses a repository with tree-sitter into a graph of fully qualified symbols and the calls, imports and containment between them, stores it in SQLite, and serves it to AI agents over MCP. An agent that would otherwise grep and read whole files asks the graph instead.
- Languages: Python · TypeScript / TSX · Go (structure and metrics only; its impact answers are a lead to confirm by reading — exp4, measured on one library, golang/crypto, mostly its ssh package; not measured on applications) · JSON and YAML (data key declarations only, when data keys are enabled with
--data-keys: no symbols, calls or impact) - Runs: locally — no account, no telemetry; the graph never leaves your disk (the one opt-in exception)
$ cgis ingest src --output graph.db
$ cgis impact cgis.query.engine.QueryEngine.get_flow_graph --db graph.db --depth 2
🔍 Analyzing transitive upstream callers of: cgis.query.engine.QueryEngine.get_flow_graph
METHOD cgis.query.engine.QueryEngine.get_flow_graph (cgis/query/engine.py:215)
├── FUNCTION cgis.query.context.context_service._collect_callees (cgis/query/context/context_service.py:44)
│ └── FUNCTION cgis.query.context.context_service.build_context (cgis/query/context/context_service.py:96)
└── METHOD cgis.guardian.collector.ContextCollector._graph_sections (cgis/guardian/collector.py:174)
├── METHOD cgis.guardian.collector.ContextCollector.collect_graph_context (cgis/guardian/collector.py:213)
└── METHOD cgis.guardian.collector.ContextCollector.collect_for_chunk (cgis/guardian/collector.py:303)
Real output — CGIS run on its own source.
🚀 Quickstart
In Claude Code (fastest)
/plugin marketplace add zaebee/codegraph-brain
/plugin install cgis@codegraph-brain
That ships the MCP server, a skill that teaches the agent when to query the graph instead of reading files, and /cgis:ingest to build the graph on first use. The server is pulled from PyPI on demand via uvx, so there is nothing to clone or build.
Any other MCP client (Cursor, Claude Desktop, …)
{
"mcpServers": {
"cgis": { "command": "uvx", "args": ["--from", "codegraph-brain", "cgis-mcp"] }
}
}
From the terminal
# No install needed — uvx fetches it from PyPI
uvx --from codegraph-brain cgis ingest ./my-project --output graph.db
uvx --from codegraph-brain cgis impact "my_module.core_function" --db graph.db --depth 5 # who calls this
uvx --from codegraph-brain cgis trace "my_module.MyClass.run" --db graph.db --depth 3 # what this calls
# add --format mermaid (or json) to either for a diagram or machine-readable output
Or install it for good: pip install codegraph-brain (Python 3.12+), then use cgis directly. The full command list is in CLI_USAGE.md.
📈 Proof at Real Scale
CGIS runs on a working twelve-repository estate — four languages, 8,146 commits, shipping daily. On its FastAPI backend it classifies 82.7% of 87,845 edges definitively and prints the remaining 17.3% rather than inventing targets for them — including the part that is CGIS's own gap.
That share rose from 11.4% in #459, which stopped counting calls to missing symbols as resolved. About 4 points of what is left is a known resolver gap, not something undiscoverable: ingesting app/ strips the app. prefix its imports carry, and the import path does not yet reconcile the two — the same backend ingested at its package root reports 13.2%. The number is what the tool admits it cannot place today, and it is allowed to move the unflattering way.
Read the case study → — every figure measured and reproducible, including what CGIS doesn't cover.
🤔 Why a graph, and how this differs
Text retrieval hands an agent chunks that look related. It cannot say which of three functions named save a call reaches, or what sits five callers up. CGIS resolves every call site to a fully qualified name when the source allows it — and when it does not, the edge stays marked unresolved and is counted, never filled with a plausible guess.
| If you use… | CGIS adds |
|---|---|
| grep / file reads in the agent | Transitive callers and callees in one call, without spending context on whole files |
| LSP-backed symbol tools (e.g. Serena) | A persisted whole-repo graph for multi-hop impact, coupling, PageRank and drift |
| A repo map (e.g. aider) | Resolved edges you can traverse and audit, with the resolved/unresolved ratio reported |
🤖 MCP Tools
The main tools:
| Tool | Answers |
|---|---|
cgis_ingest |
Build or incrementally refresh the graph |
cgis_overview |
Where to start: sizes and the largest packages, when you have no FQN yet |
cgis_find_symbol |
Partial name → candidate FQNs |
cgis_analyze_impact |
What breaks upstream if this changes? |
cgis_trace_flow |
What does this call, transitively? |
cgis_get_structure |
Class / module hierarchy |
cgis_context |
A compact GraphRAG context package for one symbol |
cgis_metrics |
Coupling, god classes, PageRank, package cohesion |
cgis_audit_reachability |
Authz / IDOR coverage — does every handler reach its guard? |
cgis_drift |
How far each domain has moved from its declared pattern |
cgis_validate |
Graph integrity: resolved vs unresolved edges |
All 16 tools, with parameters: MCP_REFERENCE.md.
🏗️ How It Works
- Extract — tree-sitter parsers turn each file into nodes and raw call edges.
- Resolve — the
ResolverEnginemaps raw calls to fully qualified names, or leaves them explicitly unresolved. - Store — SQLite holds the graph; queries are breadth-first traversals over it.
graph LR
A[Source Code] --> B[Extractors]
B --> C[Resolver Engine]
C --> D[(SQLite Graph DB)]
D --> E[MCP Server]
D --> F[Prompt Compiler]
E --> G[AI Agents]
F --> G
The details — and a pipeline graph CGIS regenerates from its own source on every change — are in HOW_IT_WORKS.md, and the full map of every document with its generated cross-references to the code is in docs/INDEX.md.
🛡️ Guardian: Graph-Aware Code Review
Guardian is CGIS's built-in LLM reviewer — it reviews pull requests using the graph as context, not just the diff text. It runs in CI and posts inline comments anchored to the exact line.
- Two-stage, recall-first: a finder surfaces every plausible defect (optimised for recall), then a separate skeptic pass filters false positives — closer to how human reviewers work, and far more reliable than a single precision-gated prompt.
- Local or cloud, no lock-in: point it at Ollama (
qwen2.5-coder,llama3.1,granite-code, …) for free local inference, or at Mistral / Gemini / Claude / OpenCode Go (DeepSeek) in the cloud. You can even mix them — a strong cloud finder with a free local cross-model skeptic. - Graph-aware context: the reviewer sees impact graphs, architectural drift, and project ontology — so it catches structural and convention defects a flat-diff reviewer can't.
- Deterministic anchoring: every inline comment is positioned by a verbatim quote from the diff, not the model's (often wrong) line guess.
- Dogfooded & measured: Guardian reviews CGIS's own pull requests, and a benchmark harness scores it against curated ground truth — so prompt changes are validated, not guessed.
# Build the graph, then review a PR with a local model (no API key).
# --inline posts over HTTPS with GH_TOKEN (or GITHUB_TOKEN); no gh CLI needed.
# The reusable workflow exports GH_TOKEN for you.
cgis ingest ./src --output graph.db
GUARDIAN_PROVIDER=ollama GUARDIAN_MODEL=qwen2.5-coder:14b \
uv run python scripts/guardian_review.py --pr 123 --db graph.db --inline
# Or OpenCode Go / DeepSeek: deepseek-v4.1-flash unless GUARDIAN_MODEL names another.
# GUARDIAN_OPENCODE_EFFORT is low unless set (the catalog lists low|high|max; other values
# pass through to the gateway). GUARDIAN_OPENCODE_BASE_URL pins a different gateway.
# No ANTHROPIC_API_KEY is needed for this provider.
GUARDIAN_PROVIDER=opencode-go GUARDIAN_MODEL=deepseek-v4.1-flash OPENCODE_API_KEY=... \
uv run python scripts/guardian_review.py --pr 123 --db graph.db --inline
# Or a Claude skeptic over a Mistral finder: Claude Haiku 5.5 unless GUARDIAN_SKEPTIC_MODEL names
# another, at GUARDIAN_ANTHROPIC_EFFORT=low unless set (low|medium|high|xhigh|max). Claude models
# reject a sampling temperature, so GUARDIAN_TEMPERATURE must be unset.
GUARDIAN_SKEPTIC=anthropic ANTHROPIC_API_KEY=... MISTRAL_API_KEY=... \
uv run python scripts/guardian_review.py --pr 123 --db graph.db --inline
In GitHub Actions, opencode-go needs no static key: the reusable workflow exchanges a short-lived GitHub OIDC token for inference access immediately before the review. Enable OIDC for GitHub Actions in the Opencode console, set the calling repository's OPENCODE_CLIENT_ID variable, and grant the review job id-token: write. OPENCODE_API_KEY is then minted at run time and never stored as a secret. Sign-in happens when GUARDIAN_PROVIDER is opencode-go, opencode, or unset (unset means the minted key makes opencode the auto-detected provider); an explicit other provider skips it.
No GPU on hand? Benchmark it on a notebook GPU → — free end to end, since the fixtures score without an LLM judge. Or point Guardian at a remote Ollama → — over an frp stcp tunnel, no public port, and a guard that refuses a review of a silently truncated prompt.
🔒 Privacy
CGIS collects nothing: no telemetry, no analytics, no account. Your code and the graph built from it stay on your machine. The one exception is opt-in: Guardian, if you run it with a cloud model, sends the reviewed diff to the provider you chose. See PRIVACY.md.
🛠️ Development
Requires Python 3.12+ and uv.
git clone https://github.com/zaebee/codegraph-brain && cd codegraph-brain
uv sync
make pytest
See CONTRIBUTING.md for the standards: strict MyPy, linting, ontology compliance.
💼 Architecture Audit
CGIS is free and you can run it yourself. If you would rather have the analysis than the tool, I run a fixed-price audit of your codebase's structure — authorisation coverage, blast radius, coupling, architectural drift — delivered in five working days, $2,400 fixed, with an explicit list of what the analysis cannot see. Read what's included →
CGIS Code Graph MCP 질문
CGIS Code Graph MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add codegraph-brain -- uvx codegraph-brain를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
CGIS Code Graph MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
CGIS Code Graph MCP는 어떤 도구를 제공하나요?
11개 도구를 제공합니다. 예: cgis_ingest, cgis_overview, cgis_find_symbol, cgis_analyze_impact, cgis_trace_flow.
What languages does CGIS support?
It supports Python, TypeScript/TSX, and Go (for structure and metrics), as well as JSON and YAML for data key declarations.
Is my code sent to a server?
No, the tool runs locally with no telemetry or accounts, and the graph stays on your disk, except when using cloud models for the Guardian reviewer.
How can I use this with Claude Code?
You can add it using the plugin marketplace command: /plugin marketplace add zaebee/codegraph-brain and then /plugin install cgis@codegraph-brain.