CodeGraph
CodeGraph — Open-source code intelligence MCP server. Builds a semantic graph of your codebase (functions, classes, imports, call chains) and exposes it through 31 tools. Callers, callees, impact analysis, complexity metrics, unused code detection, AI context assembly, persistent memory, cross-project search. 15 languages via tree-sitter. Single Rust binary, local-first.
README
CodeGraph
Cross-language code intelligence for AI agents and developers.
CodeGraph builds a semantic graph of your codebase — functions, classes, imports, call chains — and exposes it through 31 tools, a VS Code extension, and a persistent memory layer. AI agents get structured code understanding instead of grepping through files.
Quick Start
MCP Server (Claude Code, Cursor, any MCP client)
npm install -g @memoryx/codegraph-mcp
Add to ~/.claude.json (or your MCP client config):
{
"mcpServers": {
"codegraph": {
"command": "codegraph-mcp",
"args": []
}
}
}
The server indexes the current working directory automatically — no --workspace flag needed. It also accepts MCP roots from the client for workspace discovery.
Multi-project indexing — index multiple codebases into a single graph:
{
"mcpServers": {
"codegraph": {
"command": "codegraph-mcp",
"args": [
"--workspace", "/path/to/frontend",
"--workspace", "/path/to/backend",
"--workspace", "/path/to/shared-lib"
]
}
}
}
VS Code Extension
code --install-extension codegraph-0.9.0.vsix
The extension registers 30 tools as VS Code Language Model Tools. To steer Copilot toward using them:
// .vscode/settings.json
{
"github.copilot.chat.codeGeneration.instructions": [
"When analyzing code structure, callers, callees, dependencies, or complexity, prefer codegraph_* tools over file search. CodeGraph has a pre-built semantic graph that returns structured results instantly."
]
}
Tools (31)
Code Analysis (9)
| Tool | What it does |
|---|---|
get_ai_context |
Primary context tool. Intent-aware (explain/modify/debug/test) with token budgeting. Returns source, related symbols (full or signature-only), file imports, sibling functions, debug hints, architecture. |
get_edit_context |
Everything needed before editing: source + callers + tests + memories + git history |
get_curated_context |
Cross-codebase context for a natural language query ("how does auth work?") |
get_dependency_graph |
File/module import relationships with depth control |
get_call_graph |
Function call chains (callers and callees) |
analyze_impact |
Blast radius prediction — what breaks if you modify, delete, or rename |
analyze_complexity |
Cyclomatic complexity with breakdown (branches, loops, nesting, exceptions, early returns) |
find_unused_code |
Dead code detection with confidence scoring |
analyze_coupling |
Module coupling metrics and instability scores |
Code Navigation (12)
| Tool | What it does |
|---|---|
symbol_search |
Find symbols by name (hybrid BM25 + semantic search) |
get_callers / get_callees |
Who calls this? What does it call? (with transitive depth) |
get_detailed_symbol |
Full symbol info: source, callers, callees, complexity |
get_symbol_info |
Quick metadata: signature, visibility, kind |
find_by_imports |
Find files importing a module (moduleName param) |
find_by_signature |
Search by param count, return type, modifiers |
find_entry_points |
Main functions, HTTP handlers, tests |
find_related_tests |
Tests that exercise a given function |
traverse_graph |
Custom graph traversal with edge/node type filters |
cross_project_search |
Search across all indexed projects |
Memory (10)
Persistent AI context across sessions — debugging insights, architectural decisions, known issues.
| Tool | What it does |
|---|---|
memory_store / memory_get / memory_search |
Store, retrieve, search memories (BM25 + semantic) |
memory_context |
Get memories relevant to a file/function |
memory_list / memory_invalidate / memory_stats |
Browse, retire, monitor |
mine_git_history / mine_git_history_for_file |
Auto-create memories from commits |
search_git_history |
Semantic search over commit history |
All tool names are prefixed with codegraph_ (e.g. codegraph_get_ai_context).
Languages
15 languages parsed via tree-sitter — all with functions, imports, call graph, complexity metrics, dependency graphs, symbol search, impact analysis, and unused code detection:
TypeScript/JS, Python, Rust, Go, C, C++, Java, Kotlin, C#, PHP, Ruby, Swift, Tcl, Verilog
Architecture
MCP Client (Claude, Cursor, ...) VS Code Extension
| |
MCP (stdio) LSP Protocol
| |
└───────────┐ ┌───────────┘
▼ ▼
┌─────────────────────────────┐
│ Shared Domain Layer (16 modules) │
├─────────────────────────────┤
│ 14 tree-sitter parsers │
│ Semantic graph engine │
│ AI query engine (BM25) │
│ Memory layer (RocksDB) │
│ Fastembed (384d ONNX) │
│ HNSW vector index │
└─────────────────────────────┘
A single Rust binary serves both MCP and LSP. Both protocols call the same domain layer — identical logic, identical results.
- Indexing: Sub-10s for 100k LOC. Incremental re-indexing on file changes.
- Queries: Sub-100ms for navigation. Cross-file import and call resolution at index time.
- Embeddings: fastembed BGE-Small-EN-v1.5 (384d). Auto-downloads on first run.
Indexing Configuration
Auto-indexing is off by default. Use the command palette (CodeGraph: Index Directory) for on-demand indexing, or configure paths:
// .vscode/settings.json
{
"codegraph.indexOnStartup": true,
"codegraph.indexPaths": [
"/path/to/project-a",
"/path/to/project-b"
],
"codegraph.excludePatterns": ["**/logs/**", "**/*.bin"],
"codegraph.maxFileSizeKB": 1024
}
indexPaths accepts any absolute paths — they don't have to be inside your workspace. All paths are indexed into a single unified graph. In multi-root workspaces, put indexPaths in one settings.json only (arrays are not merged across folders).
Always-skipped directories: node_modules, target, .git, dist, build, out, __pycache__, vendor, DerivedData, tmp, coverage, logs.
Building from Source
git clone https://github.com/codegraph-ai/codegraph-vscode
cd codegraph-vscode
npm install
cargo build --release -p codegraph-lsp # Rust server
npm run esbuild # TypeScript extension
npx @vscode/vsce package # VSIX
Requires Node.js 18+, Rust stable, VS Code 1.90+.
License
Apache-2.0
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。