wdmtech/openrouter-search-mcp
If you are the rightful owner of openrouter-search-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The OpenRouter Search MCP Server is a Model Context Protocol server that provides web search functionality using OpenRouter's online-enabled models.
OpenRouter Search MCP Server
A Model Context Protocol (MCP) server that provides web search functionality using OpenRouter's online-enabled models.
Features
- Web Search: Search the web using OpenRouter's online models
- Customizable Models: Configure which OpenRouter model to use via environment variables or per-request parameters
- Flexible Configuration: Support for both global and per-request model selection
Installation
- Clone or create this server in your MCP servers directory
- Install dependencies:
npm install
- Build the server:
npm run build
Configuration
Environment Variables
OPENROUTER_API_KEY
(required): Your OpenRouter API keyDEFAULT_MODEL
(optional): Default model to use (defaults toopenai/gpt-4o:online
)
MCP Settings
Add to your MCP settings configuration:
{
"mcpServers": {
"openrouter-search": {
"command": "node",
"args": ["/path/to/openrouter-search/build/index.js"],
"env": {
"OPENROUTER_API_KEY": "your-api-key-here",
"DEFAULT_MODEL": "openai/gpt-4o:online"
},
"disabled": false,
"autoApprove": []
}
}
}
Available Tools
web_search
Search the web using OpenRouter's online models.
Parameters:
query
(string, required): The search querymodel
(string, optional): OpenRouter model to use for this search
Example:
{
"query": "latest developments in AI",
"model": "anthropic/claude-3-5-sonnet:online"
}
Supported Models
For web search functionality, you can use any OpenRouter model with the :online
suffix:
openai/gpt-4o:online
(default)anthropic/claude-3-5-sonnet:online
anthropic/claude-3-haiku:online
google/gemini-pro:online
openrouter/auto
(automatically selects best model with web plugin)
How it works: Adding :online
to any model slug enables web search via OpenRouter's web plugin powered by Exa. This is equivalent to using the web plugin explicitly.
Alternative: You can also use openrouter/auto
which automatically selects the best model and enables web search.
Usage Examples
Once configured, you can use the search functionality through your MCP client:
- Basic search: "Search for information about quantum computing"
- Model-specific search: Use the
web_search
tool with a specific model parameter - Environment-based: Set
DEFAULT_MODEL
to change the default model globally
Deployment
This server can be deployed as a web service on platforms like Render.com, Heroku, or Railway.
Render.com Deployment
- Fork or clone this repository to your GitHub account
- Connect your GitHub repository to Render.com
- Create a new Web Service with these settings:
- Build Command:
npm install && npm run build
- Start Command:
npm start
- Environment Variables:
OPENROUTER_API_KEY
: Your OpenRouter API keyNODE_ENV
:production
(optional)DEFAULT_MODEL
: Your preferred model (optional)
- Build Command:
The server will automatically detect the deployment environment and run in web mode, providing both a documentation interface and REST API endpoints.
Web API Endpoints
When deployed as a web service:
GET /
- Documentation and status pageGET /health
- Health check endpointPOST /search
- Web search endpoint
Example API usage:
curl -X POST https://your-deployment-url.com/search \
-H "Content-Type: application/json" \
-d '{"query": "latest AI developments", "model": "openai/gpt-4o:online"}'
Development
To modify or extend this server:
- Edit
src/index.ts
- Run
npm run build
to compile - Restart your MCP client to reload the server
License
MIT License