Token导航 LogoToken导航TokenDH.com
codemap (Grahambrooks) logo
开发工具未说明官方级别未说明来源级核验

codemap (Grahambrooks)

MCP Server

语义代码智能MCP服务器,通过构建代码库的知识图谱来增强AI辅助的代码探索。

工具数

16

提示词数

0

GitHub Stars

8

资源数

0
代码分析RustClaude知识图谱Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

grahambrooks

提供方

grahambrooks

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

符号图

![CI](https://github.com/grahambrooks/symgraph/actions/workflows/ci.yml) ![Release](https://github.com/grahambrooks/symgraph/actions/workflows/release.yml) ![License: MIT](https://opensource.org/licenses/MIT) ![Rust](https://www.rust-lang.org) ![MCP](https://modelcontextprotocol.io)

语义代码智能MCP服务器-构建代码库的知识图,以增强人工智能辅助的代码探索。

symgraph是一个rust实现https://github.com/colbymchenry/codegraph.为什么?正在对汇编进行探索 MCP服务器的二进制部署。

特性

  • 多语言支持:Rust、TypeScript、JavaScript、Python、Go、Java、C、C++
  • 符号提取:函数、类、方法、结构、接口、特征、枚举、常量
  • 关系跟踪:调用、包含、导入、导出、扩展、实现
  • 影响分析:通过代码库跟踪更改的影响
  • 高级代码智能:

- 查找函数之间的调用路径 - 检测未使用/死代码 - 探索类层次结构 - 查找所有接口实现 - 按线范围分析变更影响

  • 增量索引:仅使用内容哈希重新索引更改的文件
  • 双重运输:stdio(默认)和HTTP服务器模式

安装

macOS和Linux

curl -fsSL https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.sh | bash

要将符号图配置为Claude Code和Claude Desktop的MCP服务器,请执行以下操作:

curl -fsSL https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.sh | bash -s -- --mcp

安装特定版本:

SYMGRAPH_VERSION=2026.3.30 curl -fsSL https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.sh | bash

Windows(PowerShell)

irm https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.ps1 -OutFile install.ps1; .\install.ps1

要将符号图配置为Claude Code和Claude Desktop的MCP服务器,请执行以下操作:

irm https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.ps1 -OutFile install.ps1; .\install.ps1 -Mcp

安装特定版本:

$env:SYMGRAPH_VERSION="2026.3.30"; irm https://raw.githubusercontent.com/grahambrooks/symgraph/main/install.ps1 -OutFile install.ps1; .\install.ps1

这两个脚本都安装到 ~/.symgraph/bin/ 默认情况下。覆盖 SYMGRAPH_INSTALL_DIR.

克劳德桌面(MCPB捆绑包)

下载并安装适用于您平台的MCPB捆绑包:

  1. 下载 .mcpb 从以下位置为您的平台创建文件 发布
  2. 打开克劳德桌面
  3. 拖放 .mcpb 文件到克劳德桌面,或使用 文件>安装MCP服务器
  4. 在系统提示时配置项目根目录

来源

git clone https://github.com/grahambrooks/symgraph
cd symgraph
make install

用法

为代码库建立索引

# Index current directory
symgraph index

# Index specific directory
symgraph index ~/projects/myapp

启动MCP服务器

# Start with stdio transport (for Claude Desktop)
symgraph serve

# Start with HTTP transport
symgraph serve --port 8080

CLI命令

symgraph index [path]           # Index a codebase
symgraph serve                  # Start MCP server (stdio)
symgraph serve --port 
    # Start MCP server (HTTP)
symgraph status [path]          # Show index statistics
symgraph search          # Search for symbols
symgraph context          # Build context for a task

MCP工具

核心工具

工具说明
symgraph-context为特定任务构建专注的代码上下文
symgraph-search按名称快速搜索符号
symgraph-callers查找某个符号的所有调用者
symgraph-callees查找某个符号的所有被叫用户
symgraph-impact分析变化的影响半径
symgraph-node获取详细的符号信息
symgraph-definition获取带有上下文的符号的完整源代码
symgraph-file列出特定文件中定义的所有符号
symgraph-references查找对某个符号的所有引用
symgraph-reindex触发已更改文件的增量重新索引
symgraph-status获取索引统计信息

高级工具

工具说明
symgraph-hierarchy获取类/模块层次结构(父/子关系)
symgraph-path查找两个符号之间的呼叫路径
symgraph-unused查找没有传入引用的未使用/死代码
symgraph-implementations查找接口/特性的所有实现
symgraph-diff-impact分析更改特定代码区域的影响

示例用例

查找需要清理的死代码:

Use symgraph-unused to find all unused functions and classes

了解函数调用链:

Use symgraph-path with from="main" and to="database_query" to see how data flows

评估变更影响:

Use symgraph-diff-impact with file_path="src/auth.rs" start_line=45 end_line=60
to see what would be affected by changes in that region

探索OOP层次结构:

Use symgraph-hierarchy with symbol="BaseHandler" to see all parent/child relationships

查找所有trait实现:

Use symgraph-implementations with symbol="Iterator" to find all structs implementing Iterator

项目设置

分两步将符号图添加到项目中:为代码建立索引,然后配置AI工具。

第一步:为你的项目建立索引

cd /path/to/your/project
symgraph index

这创建了一个 .symgraph/ 包含SQLite知识图的目录。添加 .symgraph/ 到你的 .gitignore.

重新运行 symgraph index 在重大代码更改后,或使用 symgraph-reindex MCP工具,用于从您的AI工具中增量更新。

第二步:配置你的AI工具

克劳德代码

将符号图注册为您项目的MCP服务器:

cd /path/to/your/project
claude mcp add symgraph -- symgraph serve

或添加 .mcp.json 到您的项目根目录:

{
  "mcpServers": {
    "symgraph": {
      "type": "stdio",
      "command": "symgraph",
      "args": ["serve"]
    }
  }
}

可选:添加 /explore-code 技能 对于引导式代码探索:

mkdir -p .claude/skills
cp -r /path/to/symgraph/.claude/skills/explore-code .claude/skills/

然后在Claude Code中使用它:

/explore-code how does the authentication middleware work?
/explore-code what would break if I changed the User struct?

克劳德桌面版

通过MCPB束(最简单):

  1. 下载 .mcpb 从以下位置为您的平台创建文件 发布
  2. 拖放到Claude Desktop上,或使用 文件>安装MCP服务器
  3. 在系统提示时设置项目根目录

通过手动配置 --添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "symgraph": {
      "command": "symgraph",
      "args": ["serve"],
      "env": {
        "SYMGRAPH_ROOT": "/path/to/your/project"
      }
    }
  }
}

GitHub Copilot

每个存储库 --添加 .copilot/mcp.json 对于您的项目:

{
  "mcpServers": {
    "symgraph": {
      "command": "symgraph",
      "args": ["serve"]
    }
  }
}

VS代码用户设置 --添加到 settings.json:

{
  "github.copilot.chat.mcp.servers": {
    "symgraph": {
      "command": "symgraph",
      "args": ["serve"],
      "env": {
        "SYMGRAPH_ROOT": "${workspaceFolder}"
      }
    }
  }
}

看 了解更多详情。

OpenAI Codex

codex mcp add symgraph --command "symgraph" --args "serve"

或添加到 ~/.codex/config.toml:

[mcp_servers.symgraph]
command = "symgraph"
args = ["serve"]

OpenAI Codex MCP文档 了解更多详情。

HTTP模式(任何MCP客户端)

对于共享或远程设置,请将sympgraph作为HTTP服务器运行:

symgraph serve --port 8080

然后将您的MCP客户端指向 http://localhost:8080/mcp.

环境变量

变量描述默认值
SYMGRAPH_ROOT项目根目录当前目录

建筑

symgraph/
├── src/
│   ├── main.rs          # CLI entry point
│   ├── lib.rs           # Core indexing logic
│   ├── types.rs         # Type definitions (Node, Edge, etc.)
│   ├── db/              # SQLite database operations
│   ├── extraction/      # Tree-sitter code extraction
│   ├── graph/           # Graph traversal algorithms
│   ├── context/         # Context building for AI tasks
│   └── mcp/             # MCP protocol handlers
└── .symgraph/
    └── index.db         # SQLite database (per-project)

核心概念

  • 节点:代码符号(函数、类、方法等)
  • 边缘:节点之间的关系(调用、包含、导入等)
  • 知识图谱:代码库的完整节点和边集

发展

先决条件

  • 锈蚀1.70+
  • SQLite(通过rusqlite捆绑)

建筑

make build           # Release build
make test            # Run tests
make check           # Format, lint, and test
make install         # Build and install to /usr/local/bin

项目结构

模块说明
types核心类型定义(NodeKind、EdgeKind、语言等)
dbSQLite数据库模式和操作
extraction基于树的代码解析和符号提取
graph图形算法(呼叫者、被呼叫者、影响分析)
context用于AI任务辅助的上下文构建器
mcpMCP协议服务器实现

许可证

麻省理工学院

目录标签

目录标签

代码分析RustClaude知识图谱本地部署AI辅助编程多语言支持增量索引

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

16

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP