代理咨询MCP
](https://www.npmjs.com/package/ai-consultation-mcp) 
MCP(模型上下文协议)服务器,使AI代理能够获得 第二意见 从其他人工智能模型中,丰富他们在工作中的视角。
目的当人工智能代理处理复杂任务时,单一视角可能会导致盲点或次优解决方案。这个MCP服务器允许像Claude Code这样的代理咨询DeepSeek和OpenAI模型,以获得替代观点、验证或不同的问题解决策略。
特性
- 中央守护进程架构:基于SQLite的中央守护进程,在所有连接的客户端之间实现WebSocket实时同步
- 多工具自动安装:自动检测和配置用于Claude代码、游标、Windsurf、Cline、Continue、Zed、Roo代码、OpenCode和VSCode副本的MCP
- 多提供商支持:
- 开放人工智能:gpt-5.2,gpt-5.2-pro - 深度求索:deepseek聊天,deepseek推理器
- 专业咨询模式:调试、代码分析、架构审查、计划验证、概念解释
- 对话管理:继续与上下文进行多回合对话(最多5条消息,以防止无限循环)
- 实时Web用户界面:配置提供程序、API密钥,并通过WebSocket通过实时更新查看对话历史记录
- 加密存储:API密钥在静止时使用AES-256-GCM加密
- RAG+内存:上传文档(txt、md、pdf、docx),添加记忆笔记,并在咨询期间使用它们
快速入门(2个步骤)
# 1. Auto-install to all detected AI tools
npx ai-consultation-mcp --install
# 2. Configure your API key in the Web UI that opens automatically
# Done! Restart your AI tools and start using安装
选项1:npm(推荐)
安装和使用MCP服务器的最简单方法:
# Auto-install to all detected AI tools
npx ai-consultation-mcp --install
# Or install globally
npm install -g ai-consultation-mcp
ai-consultation-mcp --install选项2:来自GitHub
克隆存储库并从源代码构建:
# Clone the repository
git clone https://github.com/menesekinci/ai-consultation-mcp.git
cd ai-consultation-mcp
# Install dependencies
npm install
# Build
npm run build
# Run the installer
npm start -- --install自动安装功能
这 --install 旗帜将:
- 扫描已安装的AI工具(Claude Code、Cursor、Windsurf、OpenCode、VSCode Copilot、Cline、Continue、Zed、Roo Code)
- 将MCP配置添加到每个检测到的工具中
- 打开Web UI以配置API密钥
- 显示需要重新启动哪些工具
支持的AI工具
| 工具 | 配置位置 |
|---|---|
| 克劳德代码 | ~/.claude/mcp.json |
| 光标 | ~/.cursor/mcp.json |
| 风帆冲浪 | ~/.codeium/windsurf/mcp_config.json |
| OpenCode | ~/.config/opencode/opencode.json |
| VSCode副驾驶 | ~/Library/Application Support/Code/User/mcp.json |
| Cline | VSCode全局存储 |
| 继续 | ~/.continue/config.json |
| Zed | ~/.config/zed/settings.json |
| Roo代码 | VSCode全局存储 |
手动安装(克劳德代码)
增添 ~/.claude/mcp.json:
{
"mcpServers": {
"agent-consultation": {
"command": "npx",
"args": ["-y", "ai-consultation-mcp"]
}
}
}建筑
中央守护进程+WebSocket
MCP服务器使用 中央守护程序架构 为了获得强大的多客户端支持:
┌─────────────────────────────────────────────────────────────────┐
│ CENTRAL DAEMON │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ SQLite DB │ │ WebSocket │ │ HTTP API │ │
│ │ (WAL mode) │ │ Server │ │ /api/* │ │
│ │ │ │ │ │ │ │
│ │ - config │ │ - sync │ │ - config CRUD │ │
│ │ - convos │ │ - broadcast │ │ - provider CRUD │ │
│ │ - history │ │ - rooms │ │ - chat history │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
└───────────────────────────┬─────────────────────────────────────┘
│
┌───────────────┼───────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ MCP Proxy │ │ MCP Proxy │ │ Web UI │
│ (Claude Code) │ │ (Cursor) │ │ (Browser) │
│ │ │ │ │ │
│ stdio ↔ WS │ │ stdio ↔ WS │ │ WS Client │
└───────────────┘ └───────────────┘ └───────────────┘优点:
- ✅ SQLite+WAL模式下无比赛条件
- ✅ 所有连接的客户端之间的实时同步
- ✅ 自动守护进程生命周期管理
- ✅ 持续对话历史
默认运行时:守护进程/代理架构是默认和推荐的模式。 --legacy 为了兼容性而保留,但已弃用。配置
设置API密钥
npx ai-consultation-mcp --config这将打开一个web UI,您可以在其中:
- 为所有支持的提供程序添加/更新API密钥
- 测试API密钥有效性
- 设置默认和回退模型
- 实时查看对话历史记录
- 管理RAG文档和内存笔记
支持的提供商
模型特点
| 模型 | 提供者 | 上下文 | 最大输出 | 功能 |
|---|---|---|---|---|
| gpt-5.2 | OpenAI | 400K | 400K | 推理,旗舰级品质 |
| gpt-5.2-pro | OpenAI | 400K | 400K | 更多计算,更高质量 |
| deepseek聊天 | deepseek | 128K | 8K | 快速,非常实惠 |
| deepseek推理器 | deepseek | 64K | 64K | 思维链 |
用法
配置后,您的AI助手可以使用以下工具:
咨询代理
从另一个AI模型那里获得第二种意见。
Parameters:
- question (required): The question or problem to get advice on
- mode (optional): Consultation mode - debug, analyzeCode, reviewArchitecture, validatePlan, explainConcept, general
- context (optional): Additional context like code snippets or error messages
- docIds (optional): Restrict RAG to these document IDs
- docTitles (optional): Restrict RAG to matching document titles继续对话
继续现有的咨询对话。
Parameters:
- conversationId (required): The conversation ID from a previous consultation
- message (required): Your follow-up message
- docIds (optional): Restrict RAG to these document IDs
- docTitles (optional): Restrict RAG to matching document titlesend_conversation
结束积极的咨询对话。
Parameters:
- conversationId (required): The conversation ID to endrag_search
使用可选过滤器搜索RAG文档。
Parameters:
- query (required): Search query
- docIds (optional): Restrict to document IDs
- docTitles (optional): Restrict to document titles
- folder (optional): Restrict to folder
- topK (optional): Number of results (default 4)
- minScore (optional): Minimum similarity score (default 0.35)rag_list_docs
列出可用的RAG文件。
Parameters:
- folder (optional): Restrict to folderrag_list_folders
列出可用的RAG文件夹。
rag_list_memories
列出结构化记忆笔记。
rag_get.doc_chunks
获取文档的所有块。
Parameters:
- documentId (required)rag_add_memory
添加记忆笔记(嵌入并可由RAG搜索)。
Parameters:
- category (required): architecture | backend | db | auth | config | flow | other
- title (required): Short memory title
- content (required): Memory contentrag_upload_files
使用文件路径将本地文件上传到RAG索引。
Parameters:
- paths (required): Array of file paths to upload
- ifExists (optional): skip | allow | replace (default: skip)
- folder (optional): Folder name示例
{
"tool": "rag_upload_files",
"paths": ["Architecture/trendyol-go-api-context7.md", "docs/migros.md"],
"ifExists": "skip",
"folder": "food/migros"
}rag_update_doc_folder
更新文档文件夹。
Parameters:
- documentId (required)
- folder (required)rag_bulk_update_folders
批量更新文档文件夹。
Parameters:
- mappings (required): [{ documentId, folder }]示例
在Claude Code中,您可以这样使用它:
“你能就这个架构决策咨询DeepSeek吗?我不确定使用monorepo是否是这种微服务设置的正确选择。”
然后克劳德会打电话给 consult_agent 使用工具回答您的问题并提供答案。
咨询方式
| 模式 | 描述 |
|---|---|
debug | 专注于发现错误、分析错误并提出修复建议 |
analyzeCode | 代码审查侧重于质量、模式和改进 |
reviewArchitecture | 评估架构决策并提出替代方案 |
validatePlan | 审查实施计划的完整性和风险 |
explainConcept | 清楚地解释技术概念 |
general | 通用咨询 |
RAG/内存
MCP服务器包括一个用于上下文咨询的本地RAG(检索增强生成)管道。 文件夹(命名空间)可用于限定文档的范围。一个常见的流程是:
rag_list_foldersrag_list_docs随着folderrag_search随着folder和/或特定docIds
启动本地嵌入服务器
python3 -m venv .venv
source .venv/bin/activate
pip install -r scripts/embedding_server_requirements.txt
python scripts/embedding_server.py服务器正在监听 http://127.0.0.1:7999/embed 默认情况下。您可以用以下命令覆盖 RAG_EMBED_URL.
添加记忆笔记
{
"tool": "rag_add_memory",
"category": "auth",
"title": "Login flow",
"content": "POST /auth/login -> validate -> issue JWT -> response Authorization header"
}Web UI RAG功能
- 上传多个文档(txt、md、pdf、docx)
- 选择文档以确定搜索范围
- 带有顶级K/minScore控件的RAG测试
- 实时文档管理
发展
# Clone the repo
git clone https://github.com/menesekinci/ai-consultation-mcp.git
cd ai-consultation-mcp
# Install dependencies
npm install
# Run in development mode
npm run dev
# Run daemon in development mode
npm run dev:daemon
# Build for production
npm run build
# Run tests
npm test安全
- API密钥加密:所有API密钥在静止时使用AES-256-GCM加密
- 仅限本地:Web UI只能在本地主机上访问
- 无日志:从未记录API密钥
- SQLite WAL模式:符合ACID标准的数据库操作可防止数据损坏
许可证
麻省理工学院
