OpenRouter
Access over 400 AI models from OpenRouter's collection.
OpenRouter MCP Server
A Model Context Protocol (MCP) server that provides access to OpenRouter's extensive collection of 400+ AI models through Claude.
Features
- 🤖 Access to 400+ language models including GPT-4, Claude, Gemini, Llama, and more
- 🔍 List and search available models with pricing information
- 💬 Chat with any model through a unified interface
- 🔄 Compare responses from multiple models side-by-side
- 📊 Get detailed model information including context limits and capabilities
- 🔧 Seamless integration with Claude Desktop and Claude Code
Installation
# Clone the repository
git clone https://github.com/th3nolo/openrouter-mcp.git
cd openrouter-mcp
# Install dependencies
npm install
# or
yarn install
# Build the TypeScript code
npm run build
# or
yarn build
Configuration
- Get your OpenRouter API key from OpenRouter
- Copy
.env.exampleto.env:cp .env.example .env - Edit
.envand add your API key:OPENROUTER_API_KEY=your_api_key_here
Usage
Available MCP Tools
list_models- Get a list of all available models with pricingchat_with_model- Send a message to a specific model- Parameters:
model,message,max_tokens,temperature,system_prompt
- Parameters:
compare_models- Compare responses from multiple models- Parameters:
models[],message,max_tokens
- Parameters:
get_model_info- Get detailed information about a specific model- Parameters:
model
- Parameters:
Available MCP Resources
openrouter://models- List of all available models with pricingopenrouter://pricing- Current pricing information for all modelsopenrouter://usage- Your OpenRouter usage statistics
Claude Code Integration
Add the server to Claude Code:
claude mcp add openrouter -s user \
-e OPENROUTER_API_KEY=your_api_key_here \
-- node /path/to/openrouter-mcp/dist/server.js
Or add it manually to your Claude Desktop configuration:
{
"mcpServers": {
"openrouter": {
"command": "node",
"args": ["/path/to/openrouter-mcp/dist/server.js"],
"env": {
"OPENROUTER_API_KEY": "your_api_key_here"
}
}
}
}
Example Usage
Once configured, you can use these commands in Claude:
"List all available Gemma models"
"Chat with gpt-4 and ask it to explain quantum computing"
"Compare responses from claude-3-opus and gpt-4 about climate change"
"Get detailed information about google/gemini-pro"
Development
# Run in development mode
npm run dev
# Run tests
npm test
# Lint code
npm run lint
# Type check
npm run typecheck
Environment Variables
OPENROUTER_API_KEY- Your OpenRouter API key (required)OPENROUTER_BASE_URL- API base URL (default: https://openrouter.ai/api/v1)OPENROUTER_SITE_URL- Your site URL for API attributionOPENROUTER_APP_NAME- Application name for API headers
Security
- API keys are stored in environment variables only
- The
.envfile is excluded from version control - Never commit your API keys to the repository
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Related Servers
Geo Location Demo
Retrieves user geolocation information using EdgeOne Pages Functions and exposes it via an MCP server.
MCP Weather
A server for fetching weather information using the OpenWeather API.
Google Admin MCP
A Model Context Protocol (MCP) server enabling interaction with Google Admin APIs.
Shared Memory MCP
An example project for deploying a remote MCP server on Cloudflare Workers without authentication.
Netlify
Create, build, deploy, and manage Netlify resources using natural language.
MCP Snapshot Server
Query spaces, proposals, and users on the Snapshot.org platform.
API-MARKET MCP Server
Exposes API-Market's endpoints as MCP resources, requiring an API key for access.
Render
Manage your Render.com services, deployments, and infrastructure.
Commvault
Interact with Commvault software to access job details, security posture, and SLA status of the commcell.
Greenhouse MCP Server by CData
A read-only MCP server for querying live Greenhouse data using the CData JDBC driver.