Claude Code 配置
让 Claude Code 连接 Context Chain,在写代码时查询设计决策。
配置
在你项目的 .mcp.json 中添加:
json
{
"mcpServers": {
"context-chain": {
"command": "/bin/bash",
"args": ["/path/to/context-chain/mcp-start.sh"]
}
}
}把 /path/to/context-chain 替换成你的 Context Chain 安装路径。
TIP
.mcp.json 里的路径是机器相关的,建议加入 .gitignore。
验证连接
在项目目录启动 Claude Code:
bash
claude执行 /mcp 检查服务状态,应该能看到 context-chain 显示为已连接。
如果显示 failed:
bash
claude --debug或直接测试 MCP server:
bash
cd /path/to/context-chain
npm run mcp 2>&1使用
连接后 Claude Code 自动拥有 9 个 MCP 工具。不需要显式调用——Claude Code 会在判断需要上下文时自动查询图谱。
也可以直接提问:
- "auth 中间件的设计决策是什么?"
- "这个函数为什么这样写?"
- "
processPayment的调用者有哪些?" - "这个服务有跟限流相关的决策吗?"
自定义端口
如果 Memgraph 跑在非默认端口(如 dogfooding 设置):
json
{
"mcpServers": {
"context-chain": {
"command": "/bin/bash",
"args": ["/path/to/context-chain/mcp-start.sh"],
"env": {
"CKG_MEMGRAPH_PORT": "7688"
}
}
}
}Cursor
同样的 MCP 配置也适用于 Cursor,在 Cursor 的 MCP 设置中添加即可。