SourceSage:为 LLM 设计的代码知识图存储

SourceSage:为 LLM 设计的代码知识图存储

一个将代码库缓存为图结构的 MCP 服务器,支持动态更新与快速检索。

快速入门

安装

克隆仓库并安装包:

git clone https://github.com/yourusername/sourcesage.git
cd sourcesage
pip install -e .

启动服务器

运行以下命令启动 MCP 服务器:

sourcesage
# 或直接运行
python -m sourcesage.mcp_server

配置 Claude for Desktop

  1. 打开设置文件 claude_desktop_config.json
  2. 添加配置(已安装):
{
  "mcpServers": {
    "sourcesage": {
      "command": "sourcesage",
      "args": []
    }
  }
}
  1. 重启应用。

示例工具用法

  • 注册实体:
register_entity(name="User", entity_type="class", summary="用户类")
  • 查询实体:
query_entities(entity_type="class")