GPT Researcher
assafelovic/gptr-mcp · 346 stars · Python · MIT
MCP server MCP server for enabling LLM applications to perform deep research via the MCP protocol
Install
The repo has no one-line install. Follow its README.
Files
🔍 GPT Researcher MCP Server
Why GPT Researcher MCP?
While LLM apps can access web search tools with MCP, GPT Researcher MCP delivers deep research results. Standard search tools return raw results requiring manual filtering, often containing irrelevant sources and wasting context window space.
GPT Researcher autonomously explores and validates numerous sources, focusing only on relevant, trusted and up-to-date information. Though slightly slower than standard search (~30 seconds wait), it delivers:
- ✨ Higher quality information
- 📊 Optimized context usage
- 🔎 Comprehensive results
- 🧠 Better reasoning for LLMs
💻 Claude Desktop Demo
https://github.com/user-attachments/assets/ef97eea5-a409-42b9-8f6d-b82ab16c52a8
🚀 Quick Start with Claude Desktop
Want to use this with Claude Desktop right away? Here's the fastest path:
- Install dependencies:
git clone https://github.com/assafelovic/gptr-mcp.git
pip install -r requirements.txt
- Set up your Claude Desktop config at
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"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"
}
}
}
}
- Restart Claude Desktop and start researching! 🎉
For detailed setup instructions, see the full Claude Desktop Integration section below.
Resources
research_resource: Get web resources related to a given task via research.
Primary Tools
deep_research: Performs deep web research on a topic, finding the most reliable and relevant informationquick_search: Performs a fast web search optimized for speed over quality, returning search results with snippets. Supports any GPTR supported web retriever such as Tavily, Bing, Google, etc... Learn more herewrite_report: Generate a report based on research resultsget_research_sources: Get the sources used in the researchget_research_context: Get the full context of the research
Prompts
research_query: Create a research query prompt
Prerequisites
Before running the MCP server, make sure you have:
- Python 3.11 or higher installed
- Important: GPT Researcher >=0.12.16 requires Python 3.11+
- API keys for the services you plan to use:
You can also connect any other web search engines or MCP using GPTR supported retrievers. Check out the docs here
⚙️ Installation
- Clone the GPT Researcher repository:
git clone https://github.com/assafelovic/gpt-researcher.git
cd gpt-researcher
- Install the gptr-mcp dependencies:
cd gptr-mcp
pip install -r requirements.txt
- Set up your environment variables:
- Copy the
.env.examplefile to create a new file named.env:
cp .env.example .env
- Edit the
.envfile and add your API keys and configure other settings:
OPENAI_API_KEY=your_openai_api_key
TAVILY_API_KEY=your_tavily_api_key
You can also add any other env variable for your GPT Researcher configuration.
🚀 Running the MCP Server
You can run the MCP server in several ways:
Method 1: Directly using Python
python server.py
Method 2: Using the MCP CLI (if installed)
mcp run server.py
Method 3: Using Docker (recommended for production)
#### Quick Start
The simplest way to run with 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
#### For n8n Integration
If you need to connect to an existing n8n network:
# 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
Note: The Docker image uses Python 3.11 to meet the requirements of gpt-researcher >=0.12.16. If you encounter errors during the build, ensure you're using the latest Dockerfile from this repository.
Once the server is running, you'll see output indicating that the server is ready to accept connections. You can verify it's working by:
- SSE Endpoint: Access the Server-Sent Events endpoint at http://localhost:8000/sse to get a session ID
- MCP Communication: Use the session ID to send MCP messages to http://localhost:8000/messages/?session_id=YOUR_SESSION_ID
- Testing: Run the test script with
python test_mcp_server.py
Important for Docker/n8n Integration:
- The server binds to
0.0.0.0:8000to work with Docker containers - Uses SSE transport for web-based MCP communication
- Session management requires getting a session ID from
/sseendpoint first - Each client connection needs a unique session ID for proper communication
🚦 Transport Modes & Best Practices
The GPT Researcher MCP server supports multiple transport protocols and automatically chooses the best one for your environment:
Transport Types
Automatic Detection
The server automatically detects your environment:
# 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
Environment Variables
Configuration Examples
#### For Claude Desktop (Local)
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"gpt-researcher": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"..."
}
}
}
}
#### For Docker/Web Deployment
# Set transport explicitly for web deployment
export MCP_TRANSPORT=sse
python server.py
# Or use Docker (auto-detects)
docker-compose up -d
#### For n8n MCP Integration
# 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
Transport Endpoints
When using SSE or HTTP transports:
- Health Check:
GET /health - SSE Endpoint:
GET /sse(get session ID) - MCP Messages:
POST /messages/?session_id=YOUR_SESSION_ID
Best Practices
- Local Development: Use default STDIO for Claude Desktop
- Production: Use Docker with automatic SSE detection
- Testing: Use health endpoints to verify connectivity
- n8n Integration: Always use container networking with Docker
- Web Deployment: Consider Streamable HTTP for modern clients
Integrating with Claude
You can integrate your MCP server with Claude using:
Claude Desktop Integration - For using with Claude desktop application on Mac
For detailed instructions, follow the link above.
💻 Claude Desktop Integration
To integrate your locally running MCP server with Claude for Mac, you'll need to:
- Make sure the MCP server is installed and running
- Configure Claude Desktop:
- Locate or create the configuration file at
~/Library/Application Support/Claude/claude_desktop_config.json - Add your local GPT Researcher MCP server to the configuration with environment variables
- Restart Claude to apply the configuration
⚠️ Important: Environment Variables Required
Claude Desktop launches your MCP server as a separate subprocess, so you must explicitly pass your API keys in the configuration. The server cannot access your shell's environment variables or .env file automatically.
Configuration Example
{
"mcpServers": {
"gptr-mcp": {Facts
- Kind
- MCP server
- Repo
- assafelovic/gptr-mcp
- Group
- Uncategorized
- Stars
- 346
- License
- MIT
- Language
- Python
- Last push
- 2025-11-07
- Forks
- 66
- Homepage
- gptr.dev
- Topics
- deep-research, deepresearch, gpt-researcher, mcp, mcp-server, websearch
- 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
- 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
- 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
- 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
- 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k