What is Graph Context?
Graph Context is an MCP server that retrieves precise code context using AST call graphs and BM25 ranking, designed for AI coding assistants. It runs pure Python with no GPU or external services, delivering token savings of 87%+ for single-agent and multi-agent workflows.
How to use Graph Context?
Install with pip install graph-context (or graph-context[full] for Chinese tokenization and file watching). Run as an MCP server with the command graph-context, optionally setting environment variables like PROJECT_ROOT, MCP_MAX_TOKENS, and MCP_TOP_K. Integrate with Claude Desktop, Cursor, or Cline via a JSON configuration pointing to the command. Programmatic usage is also available via the VibeCodingEngine class.
Key features of Graph Context
- AST call graph for precise cross‑file dependency resolution
- BM25 ranking with self‑evolving rules engine
- Dynamic tool loading — only 2 tools at startup (~270 tokens)
- MVCC snapshots for read‑write isolation in multi‑agent setups
- Zero external dependencies: pure CPU, no GPU, no network calls
- Built‑in Chinese‑English synonym mapping for cross‑language queries
Use cases of Graph Context
- Single‑agent coding sessions: stable ~2,000 tokens per turn, no forgetting
- Multi‑agent collaboration: shared index with independent snapshot reads
- Reducing LLM API costs by cutting token consumption 76–90%
- On‑demand code retrieval for large projects without dumping the whole codebase
コメント