CodeGraph

CodeGraph

Enables AI agents to search code by meaning, explore codebase structure, store and query knowledge with temporal facts, and read source code through a set of MCP tools.

Category
访问服务器

README

CodeGraph

A code knowledge graph and search system for AI agents. Indexes your codebase into a graph database, embeds symbols and documentation, and exposes search through a Model Context Protocol (MCP) server.

What it does

  • Search code by meaning — vector embeddings + cross-encoder reranking find the function, class, or interface you describe, even when you don't know the name. Internal benchmark: MRR 0.969, Success@1 94%, Success@5 100%, ~447ms latency on a project of ~2.3K nodes.
  • Understand structure — tree-sitter parsers extract Functions, Classes, Interfaces, Variables, and Types across 5 first-class languages (TypeScript, Python, Go, Rust, Markdown), with tree-sitter coverage for additional languages via the generic plugin.
  • Track decisions over time — bitemporal knowledge graph stores facts with valid_at / invalid_at timestamps, supporting point-in-time queries ("what was true on March 1st?").
  • Plug into AI agents — exposes 4 MCP tool groups (search, knowledge, codebase, query) for use in Claude Desktop, Cursor, Claude Code, or any MCP client.

Quickstart

git clone https://github.com/Phoenixrr2113/codebase-graph.git
cd codebase-graph
pnpm install
pnpm build

# Option A — embedded database (no Docker required)
brew install redis  # macOS — FalkorDBLite needs redis-server
echo "CODEGRAPH_DRIVER=falkordblite" > .env
echo "CODEGRAPH_DB_PATH=.codegraph/falkordb" >> .env

# Option B — FalkorDB via Docker
# pnpm docker:db
# echo "CODEGRAPH_DRIVER=falkordb" > .env

# Index a project
pnpm --filter @codegraph/cli start configure --projects /path/to/your/project
pnpm --filter @codegraph/cli start reindex

# Run the MCP server (stdio transport)
pnpm --filter @codegraph/mcp-server start

Use with an MCP client

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "codegraph": {
      "command": "node",
      "args": ["/absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js"],
      "env": {
        "VOYAGE_API_KEY": "your-key",
        "JINA_API_KEY": "your-key"
      }
    }
  }
}

Claude Code

claude mcp add codegraph node /absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js

MCP tools

Four persona-based tool groups by default. Set CODEGRAPH_RAW_TOOLS=1 to expose the underlying handlers individually.

Tool What it does
search Find code/symbols by name or meaning; get context for a file or symbol
knowledge Store and recall entities, relationships, and facts (with bitemporal queries)
codebase Configure projects, reindex, check status/stats, read source code
query Execute read-only Cypher against the graph (power users)

See CLAUDE.md for the complete tool reference (parameters, examples, workflows).

Architecture

  • Graph storage: FalkorDB (Docker) or FalkorDBLite (embedded), with HNSW vector indexes per node type.
  • Embeddings: pluggable — Voyage AI (voyage-code-3, 1024-dim), OpenRouter, or local nomic-embed via @huggingface/transformers (768-dim, runs on CPU).
  • Reranker: cross-encoder via Jina (jina-reranker-v2-base-multilingual) or Voyage.
  • Indexer: tree-sitter for AST parsing, SHA-256 file-hash incremental change detection.
  • MCP server: 4 persona tools by default; raw mode exposes the underlying handlers.

Configuration

Environment variables (set in .env at the repo root):

# Embedding provider (auto-detected from API keys)
CODEGRAPH_EMBEDDING_PROVIDER=voyage    # voyage | local | openrouter
VOYAGE_API_KEY=...

# Reranker provider (auto-detected from API keys)
CODEGRAPH_RERANK_PROVIDER=jina         # jina | voyage
JINA_API_KEY=...

# LLM (for knowledge extraction + chain-of-thought search)
LLM_PROVIDER=cerebras
CEREBRAS_API_KEY=...

# Graph driver
CODEGRAPH_DRIVER=falkordblite          # falkordblite | falkordb
CODEGRAPH_DB_PATH=.codegraph/falkordb  # for falkordblite

Packages

Package Description
@codegraph/core Indexer, search pipelines, service layer, git sync
@codegraph/graph Graph DB driver abstraction, knowledge operations, Cypher templates
@codegraph/plugin-nlp Embeddings, reranker, entity resolution, conversation/document ingestion
@codegraph/mcp-server MCP server with 4 persona tools
@codegraph/api Express REST API for the dashboard
@codegraph/cli CLI wrapper around the core service
@codegraph/plugin-typescript TS/JS/JSX tree-sitter plugin
@codegraph/plugin-python Python tree-sitter plugin
@codegraph/plugin-go Go tree-sitter plugin
@codegraph/plugin-rust Rust tree-sitter plugin
@codegraph/plugin-markdown Markdown parser
@codegraph/plugin-generic Tree-sitter fallback for additional languages
@codegraph/plugin-common Shared extraction utilities (complexity, AST helpers)
@codegraph/plugin-languages Plugin registry coordination
@codegraph/logger Structured logging + tracing decorator
@codegraph/types Shared TypeScript type definitions

Plus apps/web (Next.js dashboard with Graph Explorer + Operations tabs at localhost:3000).

Development

pnpm install        # Install dependencies
pnpm build          # Build all packages
pnpm dev            # Start dev mode
pnpm test           # Run all tests
pnpm docker:db      # Start FalkorDB via Docker

Status

Active development. Public on 2026-04-25. No releases yet — install from source.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选