关于 🔍 GPT Researcher MCP Server
GPT Researcher MCP Server 为 LLM 应用提供基于 MCP 的深度研究能力,会自主检索并验证多个来源,返回经过筛选的结果。适合需要可靠资料而非原始搜索结果的研究场景。
主要功能
- 01深度网络研究并筛选可信来源
- 02快速搜索并返回摘要片段
- 03生成研究报告
- 04获取研究来源与完整上下文
- 05提供研究查询提示词
适用场景
- 01为投资或行业分析收集最新资料
- 02让 LLM 在有限上下文内使用高质量信息
- 03生成基于多源检索的研究报告
MCP 相关
该项目是 MCP 服务,向 MCP 客户端暴露 deep_research、quick_search 等工具,以及 research_resource 资源和 research_query 提示词。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
为什么选择 GPT Researcher MCP?
虽然大模型应用可以通过 MCP 访问网页搜索工具,但 GPT Researcher MCP 能提供深度研究结果。 标准搜索工具返回原始结果,需要手动筛选,通常包含不相关来源,还会浪费上下文窗口空间。
GPT Researcher 会自主探索并验证大量来源,只关注相关、可信且最新的信息。虽然速度比标准搜索稍慢(等待约 30 秒),但它能带来:
- ✨ 更高质量的信息
- 📊 优化上下文用量
- 🔎 全面的结果
- 🧠 为大模型提供更好的推理能力
💻 Claude Desktop 演示
https://github.com/user-attachments/assets/ef97eea5-a409-42b9-8f6d-b82ab16c52a8
🚀 使用 Claude Desktop 快速开始
想立即在 Claude Desktop 中使用? 以下是最快的步骤:
-
安装依赖项:
git clone https://github.com/assafelovic/gptr-mcp.git pip install -r requirements.txt -
在
~/Library/Application Support/Claude/claude_desktop_config.json中设置 Claude Desktop 配置:{ "mcpServers": { "gptr-mcp": { "command": "python", "args": ["/absolute/path/to/gpt-researcher/gptr-mcp/server.py"], "env": { "OPENAI_API_KEY": "your-openai-key-here", "TAVILY_API_KEY": "your-tavily-key-here" } } } } -
重启 Claude Desktop,开始研究! 🎉
如需详细设置说明,请参阅下方的完整 Claude Desktop 集成部分。
资源
research_resource:通过研究获取与指定任务相关的网络资源。
主要工具
deep_research:针对某个主题进行深入的网络研究,找出最可靠、最相关的信息quick_search:执行快速网页搜索,优先考虑速度而非质量,并返回带摘要的搜索结果。支持任何 GPTR 支持的网页检索器,例如 Tavily、Bing、Google 等。点击此处了解详情write_report:根据研究结果生成报告get_research_sources:获取研究中使用的来源get_research_context:获取研究的完整上下文
提示词
research_query:创建研究查询提示词
前置条件
运行 MCP 服务之前,请确保已具备:
- 已安装 Python 3.11 或更高版本
- 重要提示:GPT Researcher >=0.12.16 需要 Python 3.11+
- 计划使用的服务的 API 密钥:
你也可以通过 GPTR 支持的检索器连接其他网页搜索引擎或 MCP。请参阅此处的文档
⚙️ 安装
- 克隆 GPT Researcher 仓库:
git clone https://github.com/assafelovic/gpt-researcher.git
cd gpt-researcher
- 安装 gptr-mcp 依赖项:
cd gptr-mcp
pip install -r requirements.txt
- 设置环境变量:
- 复制
.env.example文件,并创建一个名为.env的新文件:
cp .env.example .env- 编辑
.env文件,添加 API 密钥并配置其他设置:
OPENAI_API_KEY=your_openai_api_key TAVILY_API_KEY=your_tavily_api_key - 复制
你还可以添加其他用于 GPT Researcher 配置的环境变量。
🚀 运行 MCP 服务
你可以通过多种方式运行 MCP 服务:
方法 1:直接使用 Python
python server.py
方法 2:使用 MCP CLI(如果已安装)
mcp run server.py
方法 3:使用 Docker(生产环境推荐)
快速开始
使用 Docker 运行的最简单方法:
# Build and run with docker-compose
docker-compose up -d
# Or manually:
docker build -t gptr-mcp .
docker run -d \
--name gptr-mcp \
-p 8000:8000 \
--env-file .env \
gptr-mcp
用于 n8n 集成
如果需要连接到现有的 n8n 网络:
# First, start the container
docker-compose up -d
# Then connect to your n8n network
docker network connect n8n-mcp-net gptr-mcp
# Or create a shared network first
docker network create n8n-mcp-net
docker network connect n8n-mcp-net gptr-mcp
注意:Docker 镜像使用 Python 3.11,以满足 gpt-researcher >=0.12.16 的要求。如果构建时遇到错误,请确保使用本仓库中的最新 Dockerfile。
服务器运行后,你会看到服务器已准备好接受连接的提示。你可以通过以下方式验证运行是否正常:
- SSE 端点:访问 Server-Sent Events 端点 http://localhost:8000/sse,获取会话 ID
- MCP 通信:使用会话 ID 向 http://localhost:8000/messages/?session_id=YOUR_SESSION_ID 发送 MCP 消息
- 测试:运行测试脚本
python test_mcp_server.py
Docker/n8n 集成注意事项:
- 服务器绑定到
0.0.0.0:8000,以便与 Docker 容器配合使用 - 使用 SSE 传输进行基于 Web 的 MCP 通信
- 会话管理需要先从
/sse端点获取会话 ID - 每个客户端连接都需要唯一的会话 ID,才能正常通信
🚦 传输模式与最佳实践
GPT Researcher MCP 服务支持多种传输协议,并会根据你的环境自动选择最合适的协议:
传输类型
| 传输方式 | 用例 | 适用场景 |
|---|---|---|
| STDIO | Claude Desktop、本地 MCP 客户端 | 本地开发的默认方式 |
| SSE | Docker、Web 客户端、n8n 集成 | 在 Docker 中自动启用 |
| Streamable HTTP | 现代 Web 部署 | 高级 Web 部署 |
自动检测
服务器会自动检测你的环境:
# Local development (default)
python server.py
# ➜ Uses STDIO transport (Claude Desktop compatible)
# Docker environment
docker run gptr-mcp
# ➜ Auto-detects Docker, uses SSE transport
# Manual override
export MCP_TRANSPORT=sse
python server.py
# ➜ Forces SSE transport
环境变量
| 变量 | 描述 | 默认值 | 示例 |
|---|---|---|---|
MCP_TRANSPORT | 强制使用指定的传输方式 | stdio | sse、streamable-http |
DOCKER_CONTAINER | 强制启用 Docker 模式 | 自动检测 | true |
配置示例
用于 Claude Desktop(本地)
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"gpt-researcher": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"..."
}
}
}
}
用于 Docker/Web 部署
# Set transport explicitly for web deployment
export MCP_TRANSPORT=sse
python server.py
# Or use Docker (auto-detects)
docker-compose up -d
用于 n8n MCP 集成
# Use the container name as hostname
docker run --name gptr-mcp -p 8000:8000 gptr-mcp
# In n8n, connect to: http://gptr-mcp:8000/sse
传输端点
使用 SSE 或 HTTP 传输时:
- 健康检查:
GET /health - SSE 端点:
GET /sse(获取会话 ID) - MCP 消息:
POST /messages/?session_id=YOUR_SESSION_ID
最佳实践
- 本地开发:Claude Desktop 使用默认的 STDIO
- 生产环境:使用 Docker,并自动检测 SSE
- 测试:使用健康检查端点验证连接
- n8n 集成:始终通过 Docker 使用容器网络
- Web 部署:现代客户端可考虑使用 Streamable HTTP
与 Claude 集成
你可以通过以下方式将 MCP 服务与 Claude 集成:
Claude Desktop 集成 - 在 Mac 上与 Claude 桌面应用配合使用
详细说明请参阅上面的链接。
💻 Claude Desktop 集成
要将本地运行的 MCP 服务与 Mac 版 Claude 集成,你需要:
- 确保已安装并运行 MCP 服务
- 配置 Claude Desktop:
- 找到或创建配置文件
~/Library/Application Support/Claude/claude_desktop_config.json - 在配置中添加本地 GPT Researcher MCP 服务,并包含环境变量
- 重启 Claude 以应用配置
- 找到或创建配置文件
⚠️ 重要:必须配置环境变量
Claude Desktop 会将 MCP 服务作为独立的子进程启动,因此你必须在配置中显式传入 API 密钥。服务器无法自动访问 shell 的环境变量或 .env 文件。
配置示例
{
"mcpServers": {
"gptr-mcp": {
"command": "python",
"args": ["/absolute/path/to/your/server.py"],
"env": {
"OPENAI_API_KEY": "your-actual-openai-key-here",
"TAVILY_API_KEY": "your-actual-tavily-key-here"
}
}
}
}
安全提示
🔒 Claude Desktop 配置文件中包含敏感的 API 密钥。 请妥善保护:
chmod 600 ~/Library/Application\ Support/Claude/claude_desktop_config.json
切勿将此文件提交到版本控制系统。
替代方案:环境变量脚本
为提高安全性,请创建一个包装脚本:
run_gptr_mcp.sh:
#!/bin/bash
source /path/to/your/.env
python /absolute/path/to/server.py
然后在 Claude Desktop 中使用:
{
"mcpServers": {
"gptr-mcp": {
"command": "/absolute/path/to/run_gptr_mcp.sh"
}
}
}
完整的分步说明,请参阅 Claude Desktop 集成指南。
📝 使用 Claude 的示例
User: I'm considering investing in NVIDIA. Can you research the current state of the company, recent stock performance, latest product announcements, and analyst opinions?
Claude: I'll help you research NVIDIA for investment purposes. This will take a moment as I conduct deep research to find the most up-to-date information about their stock performance, recent developments, and expert analysis.
[Claude uses deep_research tool - this takes 30-40 seconds]
Claude: Based on my research, here's a comprehensive analysis of NVIDIA's current state:
## NVIDIA (NVDA) Current Status
### Recent Stock Performance
- Current price: $942.89 (as of my research)
- YTD performance: +90.4%
- 52-week range: $460.30 - $974.00
- Market cap: ~$2.32 trillion
### Recent Key Developments
1. **Blackwell AI Platform**: At GTC 2024, NVIDIA unveiled the Blackwell architecture, their next-generation AI chip platform promising 4x performance improvement over Hopper. Major cloud providers (AWS, Google, Microsoft) have already committed to integrating Blackwell.
2. **Q1 FY2025 Earnings (May 2024)**:
- Revenue: $26.0 billion (+262% YoY)
- Data Center revenue: $22.6 billion (+427% YoY)
- Gross margin: 78.4%
- Announced 10-for-1 stock split effective June 7, 2024
3. **Supply Chain Expansion**: Increased investments in manufacturing capacity with TSMC to address ongoing chip shortages for their high-demand AI GPUs.
### Analyst Consensus
- Strong Buy consensus with 37 analysts rating it "Buy," 5 "Hold," and 0 "Sell"
- Average price target: $1,042 (post-split adjusted: $104.20)
- Key bull thesis: Continued AI infrastructure spending and NVIDIA's dominant position in AI chips
- Key bear concerns: Valuation, potential competition from AMD, Intel, and custom silicon from tech giants
### Industry Position
- Dominant in AI GPU market with estimated 80-90% market share
- Expanding ecosystem through CUDA software platform and industry partnerships
- Diversifying beyond chips with DGX Cloud, AI software platforms, and automotive solutions
🔧 故障排除
如果运行 MCP 服务时遇到问题:
常见问题
- API 密钥:请确保已在
.env文件中正确设置 API 密钥 - Python 版本:请确认使用的是 Python 3.11 或更高版本(gpt-researcher >=0.14.0 的要求)
- 依赖项:请确保已正确安装所有依赖项:
pip install -r requirements.txt - 服务日志:检查服务日志中的错误消息
Docker 问题
-
容器无法访问:
- 验证容器是否正在运行:
docker ps | grep gptr-mcp - 检查容器日志:
docker logs gptr-mcp - 确认服务绑定到 0.0.0.0:8000(日志中应显示此信息)
- 验证容器是否正在运行:
-
n8n 集成问题:
- 确保两个容器位于同一个 Docker 网络中
- 在 n8n 中使用容器名称
gptr-mcp作为主机名 - 将 MCP 服务 URL 设置为:
http://gptr-mcp:8000/sse
-
会话 ID 问题:
- 服务使用 SSE 传输,需要进行会话管理
- 首先,连接到
/sse端点以获取会话 ID - 在后续 MCP 请求中使用该会话 ID:
/messages/?session_id=YOUR_ID - 每个客户端都需要自己的会话 ID
n8n MCP 集成步骤
-
获取会话 ID:
curl http://gptr-mcp:8000/sse # Look for: data: /messages/?session_id=XXXXX -
初始化 MCP:
curl -X POST http://gptr-mcp:8000/messages/?session_id=YOUR_SESSION_ID \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {"roots": {"listChanged": true}}, "clientInfo": {"name": "n8n-client", "version": "1.0.0"}}}' -
调用工具:
curl -X POST http://gptr-mcp:8000/messages/?session_id=YOUR_SESSION_ID \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "quick_search", "arguments": {"query": "test"}}}'
测试服务
运行随附的测试脚本以验证功能:
python test_mcp_server.py
此脚本将测试:
- SSE 连接和会话 ID 获取
- MCP 初始化
- 工具发现和执行
Claude Desktop 问题
如果 MCP 服务无法与 Claude Desktop 配合使用:
-
Claude 中未显示服务:
- 检查
claude_desktop_config.json语法是否为有效的 JSON - 确保使用的是绝对路径(而不是相对路径)
- 确认
server.py的路径正确 - 完全重启 Claude Desktop
- 检查
-
出现“未找到 OPENAI_API_KEY”错误:
- 确保已将 API 密钥添加到配置中的
env部分 - 别忘了添加
OPENAI_API_KEY和TAVILY_API_KEY - API 密钥应为实际密钥,而不是占位符
- 确保已将 API 密钥添加到配置中的
-
未显示工具:
- 在 Claude Desktop 中查找 🔧 工具图标
- 检查 Claude Desktop 配置文件是否位于正确位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Python/权限问题:
- 确保可从命令行访问 Python:
python --version - 尝试使用完整的 Python 路径:
"command": "/usr/bin/python3"或"command": "python3" - 检查 server.py 文件的权限
- 确保可从命令行访问 Python:
-
仍然无法使用?
- 手动测试服务:
python server.py(应显示 STDIO 传输消息) - 检查 Claude Desktop 日志(如果有)
- 尝试使用上方集成部分中的替代脚本方法
- 手动测试服务:
👣 后续步骤
- 阅读 MCP 协议文档,进一步了解如何与 Claude 集成
- 了解 GPT Researcher 的核心功能,增强研究能力
- 查看高级用法指南,了解更多配置选项
📄 许可证
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
📞 支持 / 联系方式
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。