codegraph
Indexes a codebase into a live symbol graph and serves it via MCP to AI coding tools for context-aware code queries.
README
gitatlas
The code graph that lives in your git history — built once, correct at every commit, shared by every human, agent, and bot on the team.
gitatlas indexes your repository into a symbol graph (functions, classes, methods, calls, inheritance, type usage, imports), keeps that graph in lock-step with your commits via git hooks, and serves it to any MCP-capable AI tool — Claude Code, Cursor, Codex, Antigravity, Windsurf, Copilot — through a standard Model Context Protocol server.
┌─────────────┐ tree-sitter ┌──────────────────┐ MCP (stdio) ┌──────────────┐
│ your repo │ ───────────────► │ .gitatlas/ │ ────────────────► │ Claude Code │
│ │ │ graph.db │ │ Cursor │
│ git commit │ ── post-commit ─►│ (SQLite, local) │ │ Codex, ... │
└─────────────┘ incremental └──────────────────┘ └──────────────┘
Why git-native instead of file watchers?
Most code-intelligence tools watch your editor session: OS file watchers, debounce timers, reconciliation on connect. That works on your laptop — and nowhere else. gitatlas keys everything to git instead: the graph is a pure function of a commit, updated by hooks, keyed by content hash. That buys you what watchers can't:
- CI and cloud agents. File watchers are useless in CI and to cloud coding agents. A commit-pinned graph can be built once in CI, cached by SHA, and pulled by every teammate and bot.
- Correct across branch switches and rebases — content-hash keying means a checkout is just a cache lookup, not a re-index.
- History (roadmap): because the graph is a function of a commit, "what did the callers of X look like two releases ago?" is an answerable question. Watcher-based tools have no past.
And the practical basics:
- Zero infrastructure. One SQLite file in
.gitatlas/next to.git/. No daemon, no docker, no service. - Fast. Full index of a multi-service repo in ~150ms; no-op incremental update ~50ms.
- Languages: TypeScript, JavaScript, JSX/TSX, Java, Python — via tree-sitter WASM grammars, so installation never needs a C++ toolchain.
- Respects .gitignore. Discovery uses
git ls-files; build output never pollutes the graph.
Token-frugal by design
AI agents answer repo questions by grepping and reading whole files. On a real repo (Java Spring microservices + a Chrome extension), answering 8 typical developer questions cost:
| Metric | With gitatlas | grep + read files |
|---|---|---|
| Context tokens the agent must read | 3,241 | 57,882 |
| Tool invocations | 8 | 23 |
| Dead-end searches | 0 | 1 |
That is a 17.9× context reduction — which converts directly to cost, latency, and freed-up model attention. How:
- Real tasks embed identifiers — "handle the case where
checkIsFsereturns false".find_contextdetects them as anchors and returns the definition plus a ±4-line window around every reference site, instead of whole enclosing functions (~945 → ~354 tokens on a representative query, with better coverage). - Paraphrases anchor too: developers paraphrase identifiers by splitting them into words, so symbols match by subtoken coverage — "the FSE check" finds
checkIsFse, "the perplexity configured check" findsisConfigured. No embeddings, no model downloads. - List results group by file and collapse repeated prefixes; long lists cap with
+N more; generic task words ("handle", "cases", "false") are stopworded. repo_maporients an agent in an unfamiliar repo — most central symbols (PageRank), signatures only — for a few hundred tokens.
Installation
npm install -g gitatlas
Or from source:
git clone https://github.com/bajpayeeritik/gitatlas.git
cd gitatlas && npm install && npm run build && npm link
Requires Node.js ≥ 20.
Quick start
cd your-repo
gitatlas index # build the graph → .gitatlas/graph.db
gitatlas install-hook # auto-update on every commit / merge / branch switch
gitatlas stats # see what got indexed
echo ".gitatlas/" >> .gitignore
Connect your AI tool
Claude Code — .mcp.json in the repo root:
{
"mcpServers": {
"gitatlas": {
"command": "gitatlas",
"args": ["serve", "--root", "."]
}
}
}
Cursor — same JSON shape in .cursor/mcp.json.
Codex CLI — ~/.codex/config.toml:
[mcp_servers.gitatlas]
command = "gitatlas"
args = ["serve", "--root", "."]
Any other stdio MCP client works with the same command + args.
MCP tools
| Tool | What it answers |
|---|---|
repo_map |
One-shot orientation: the most central symbols in the repo, grouped by file, signatures only |
find_context |
Most relevant code for a task — identifiers (and paraphrases of them) are anchored with definition + usage windows; the rest ranked by lexical match × PageRank under a token budget |
usages |
Definition of a symbol plus a ±4-line window around every reference site — the cheapest complete answer to "change how X is used everywhere" |
who_calls / what_it_calls |
Reverse / forward dependencies of a symbol |
impact_of_change |
Blast radius of editing a file (direct + 1-hop transitive dependents) |
file_outline |
All symbols in a file with line ranges — structure without reading it |
get_symbol / search_symbols |
Exact and fuzzy lookup |
graph_stats / reindex |
Freshness, size, forced refresh |
CLI
Every tool is also a CLI command — usable with no AI client at all:
gitatlas symbol AnalysisService # where is this defined?
gitatlas callers UserCodingData # who uses it?
gitatlas callees AnalysisController # what does it depend on?
gitatlas usages isConfigured # def + code window at every usage site
gitatlas outline src/service/Foo.java # file structure without reading it
gitatlas impact src/service/Foo.java # what breaks if I change this?
gitatlas repo-map --budget 1200 # whole-repo orientation map
gitatlas context "how does retry work" # ranked snippets under a token budget
All commands take --root <path> (defaults to the current directory).
How it works
- Parse — tree-sitter (WASM) extracts definitions, references (calls,
extends,implements, type usage — Spring-style DI included), and imports. - Store — SQLite (WAL), keyed by content hash; removing a file cascades; an extractor-version stamp auto-invalidates stale parses.
- Link — references resolve to definitions across the repo, producing the edge table.
- Update — git hooks (
post-commit,post-merge,post-checkout) re-parse only changed files. Existing hooks are appended to, never clobbered. - Serve — structural queries straight from SQLite; ranking fuses lexical match with PageRank centrality.
Comparison, honestly
If you want 30-language editor-session indexing with a bundled binary and file watchers, CodeGraph is excellent and more mature. gitatlas is for the git-shaped half of the problem: a commit-pinned graph that CI, cloud agents, and whole teams can share, with token cost as a first-class metric. Small repo, small tool, deliberately boring internals.
Limitations (honest ones)
- Name-based linking. References resolve by identifier name, not full type resolution — same-named symbols each receive edges. SCIP-precision resolution is the top roadmap item.
- Dynamic dispatch, reflection, and metaprogramming are invisible, as in every static index.
who_callson an interface returns implementors and users together (edge kinds are stored but not yet filterable).
Roadmap
- [ ] PR blast-radius GitHub Action (impact analysis as a PR comment)
- [ ] Graph-by-SHA caching in CI: build once, distribute to the team
- [ ] SCIP/LSP-based precise symbol resolution
- [ ] Graph time-travel: query the graph at any commit; semantic changelogs
- [ ] Embedding fusion for true-synonym queries (paraphrases already work via subtokens)
- [ ] More languages (Go, Rust, C#, Ruby)
Contributing
Issues and PRs welcome. src/indexer/ (tree-sitter extraction), src/graph/ (SQLite store, ranking, formatting), src/mcp/ (server), src/cli.ts. npm run build then node dist/cli.js index --root <some-repo> is the whole dev loop.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。