一个基于模型上下文协议(MCP)的服务器,允许Claude Code与额外的AI代理进行代码和问题分析咨询。此服务器提供了访问Darren(OpenAI)、Sonny(Anthropic)、Sergey(OpenAI带网络搜索)和Gemma(Google Gemini带仓库分析)作为专家顾问的功能,从而实现多模型视角下的编码问题分析。
克隆仓库:
git clone https://github.com/yourusername/consulting-agents-mcp.git
cd consulting-agents-mcp
创建并激活虚拟环境:
python -m venv mcp_venv
source mcp_venv/bin/activate # 在Windows上使用:mcp_venv\Scripts\activate
安装依赖项:
pip install -r requirements.txt
设置API密钥:
在项目根目录下创建一个.env文件:
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
GOOGLE_API_KEY=your_google_api_key_here
启动服务器:
chmod +x start_mcp_server.sh
./start_mcp_server.sh
注册MCP服务器 到Claude Code:
claude mcp add ConsultingAgents /absolute/path/to/consulting-agents-mcp/start_mcp_server.sh
启动Claude Code 并启用MCP集成:
claude --mcp-debug
在Claude Code中使用工具:
现在你可以使用consult_with_darren、consult_with_sonny、consult_with_sergey 和 consult_with_gemma 函数。
MCP服务器提供四个咨询工具:
consult_with_darren使用具有高推理能力的OpenAI o3-mini模型来分析代码并提供建议。
参数:
consultation_context:问题描述(必需)source_code:可选代码以供分析consult_with_sonny使用具有增强思考能力的Claude 3.7 Sonnet模型提供深入的代码分析。
参数:
consultation_context:问题描述(必需)source_code:可选代码以供分析注意:由于Claude Code现在具有原生扩展思考模式,这个代理有些冗余,但仍然可能有用,可以获取来自另一个Claude模型的不同意见或方法。
consult_with_sergey使用具有网络搜索能力的GPT-4o模型来查找相关信息和文档。
参数:
consultation_context:你需要什么信息或文档的描述(必需)search_query:可选的具体搜索查询source_code:可选的代码以供上下文注意:由于Claude Code现在具有原生网络搜索能力,这个代理有些冗余,但仍然可能有用,可以比较GPT-4o和Claude之间的搜索结果,或者获取不同的观点。
consult_with_gemma使用具有1M令牌上下文窗口的Google Gemini 2.5 Pro模型来分析整个仓库,并提供全面的开发计划。
参数:
consultation_context:要实施的任务或特性的描述(必需)repo_url:要分析的GitHub仓库URL(必需) - 重要:始终指定完整的正确GitHub URL(例如,“https://github.com/username/repo”)feature_description:要实现的功能的详细描述(必需)注意:这个代理特别有用,因为Claude Code本身没有能力在一个上下文中分析整个仓库。
重要URL规范:使用Gemma时,始终提供确切的GitHub仓库URL。Claude Code可能会从你的本地目录路径错误地推断出仓库URL,这可能导致仓库访问错误。URL应采用https://github.com/username/repository的形式,并且具有正确的大小写敏感性。
MCP_TRANSPORT:传输协议(默认:“stdio”,替代:“http”,“sse”)HOST:使用HTTP/SSE传输时的服务器主机(默认:“127.0.0.1”)PORT:使用HTTP/SSE传输时的服务器端口(默认:5000)当使用HTTP传输运行时,服务器提供以下端点:
GET /health
返回服务器状态和可用代理。
POST /consult
Darren或Sonny请求体:
{
"agent": "Darren",
"consultation_context": "我在代码中有一个bug,其中...",
"source_code": "def example():\n return 'hello'"
}
Sergey请求体:
{
"agent": "Sergey",
"consultation_context": "如何在Express中实现JWT认证?",
"search_query": "express.js JWT auth implementation"
}
Gemma请求体:
{
"agent": "Gemma",
"consultation_context": "为API添加用户认证",
"repo_url": "https://github.com/username/repo",
"feature_description": "实现基本的用户名/密码API访问认证"
}
重要:在repo_url字段中始终提供确切和完整的GitHub仓库URL。不要依赖Claude Code从你的本地目录路径推断这一点。
claude mcp add命令中的绝对路径.env文件中正确设置更新到consulting-agents-mcp的新版本时,请遵循以下步骤:
./start_mcp_server.sh
claude mcp remove ConsultingAgents
claude mcp add ConsultingAgents /absolute/path/to/consulting-agents-mcp/start_mcp_server.sh
此过程确保Claude Code使用的是更新版本的MCP服务器及其任何新的模型或功能。
启动带有调试输出的服务器:
DEBUG=true ./start_mcp_server.sh
测试HTTP端点(当使用HTTP传输时):
# 测试Darren
curl -X POST http://localhost:5000/consult \
-H "Content-Type: application/json" \
-d '{"agent":"Darren","consultation_context":"测试消息"}'
# 测试Sonny
curl -X POST http://localhost:5000/consult \
-H "Content-Type: application/json" \
-d '{"agent":"Sonny","consultation_context":"测试消息"}'
# 测试Sergey
curl -X POST http://localhost:5000/consult \
-H "Content-Type: application/json" \
-d '{"agent":"Sergey","consultation_context":"测试消息","search_query":"示例"}'
# 测试Gemma
curl -X POST http://localhost:5000/consult \
-H "Content-Type: application/json" \
-d '{"agent":"Gemma","consultation_context":"添加用户认证","repo_url":"https://github.com/username/repo","feature_description":"实现基本的用户名/密码API访问认证"}'
mcp_consul_server.py:主要的MCP服务器实现start_mcp_server.sh:启动服务器的脚本,带有适当的环境requirements.txt:Python依赖项MIT
欢迎贡献!请随时提交Pull Request。