对于频繁使用 Claude Code 进行代码库探索的开发者,CodeGraph 能显著降低 token 消耗和等待时间,实测效果惊人,值得立即尝试。
CodeGraph 是一个开源的 MCP 服务器,通过预索引代码库为本地知识图谱,让 AI 代理直接查询图谱而非扫描文件,从而大幅减少工具调用。在六个真实项目测试中,平均减少 92% 工具调用,探索速度提升 71%,在 TypeScript 和 Java 代码库上分别减少 94% 和 96% 的调用。它基于 Tree-sitter 解析语法树,使用 SQLite 存储符号和调用关系,支持 19 种以上语言,完全本地运行,无需 API 密钥。只需一条 npx 命令即可设置,文件监视器可保持图谱实时更新。
You can cut Claude Code's tool calls by 94% with o…
You can cut Claude Code's tool calls by 94% with one command.
When Claude Code explores a repo, it spawns agents to scan files.
Each scan burns tokens on every tool call. CodeGraph is an open-source MCP server that fixes this.
It pre-indexes your codebase into a local knowledge graph upfront. Instead of scanning, the agent queries the graph directly.
One call returns entry points, related symbols, and code snippets. Tested across six real-world projects, the results showed: > 92% fewer tool calls average > 71% faster exploration overall > 94% drop on a TypeScript repo > 96% drop on a Java codebase Tree-sitter parses source into syntax trees.
SQLite stores symbols, callers, and edges with full-text search. A file watcher keeps everything fresh as you code.
It supports 19+ languages and runs fully on your machine. Setup is one npx command. No API keys are required.
- IT之家05-14 07:12原文