ResearchMCP is a service that provides internet research capabilities through the Model Completion Protocol (MCP). It leverages Perplexity AI's API to offer in-depth, up-to-date information on a wide range of topics, making it useful for applications that need to access current internet-based knowledge.
First, configure the necessary environment variables. You can create a .env
file in your project directory with the following settings:
PERPLEXITY_API_KEY=your_api_key_here
PERPLEXITY_MODEL=sonar-medium-online
PERPLEXITY_TIMEOUT=120
PERPLEXITY_MAX_RETRIES=3
PERPLEXITY_INITIAL_BACKOFF=2
PERPLEXITY_MAX_BACKOFF=15
Variable | Description | Required | Default |
---|---|---|---|
PERPLEXITY_API_KEY | API key for Perplexity AI | Yes | - |
PERPLEXITY_MODEL | Model to use for research | No | sonar-medium-online |
PERPLEXITY_TIMEOUT | Timeout in seconds for API requests | No | 90 |
PERPLEXITY_MAX_RETRIES | Maximum number of retry attempts | No | 2 |
PERPLEXITY_INITIAL_BACKOFF | Initial backoff time in seconds | No | 1 |
PERPLEXITY_MAX_BACKOFF | Maximum backoff time in seconds | No | 10 |
Build and run the service with the following commands:
go build
./ResearchMCP
The service provides a tool called research
that can be accessed through the MCP protocol.
The research tool accepts the following input parameters:
{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The research query or question"
}
},
"required": ["query"]
}
Here's an example of how to make a request to the research tool:
{
"name": "research",
"arguments": {
"query": "What is the current state of quantum computing?"
}
}
The service will respond with a structured answer that includes both the research content and sources:
{
"content": [
{
"type": "text",
"text": "Comprehensive research report on quantum computing...\n\nSources:\n- https://example.com/source1\n- https://example.com/source2"
}
]
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "researchmcp" '{"command":"go","args":["run","github.com/chew-z/researchmcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"researchmcp": {
"command": "go",
"args": [
"run",
"github.com/chew-z/researchmcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"researchmcp": {
"command": "go",
"args": [
"run",
"github.com/chew-z/researchmcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect