OpenRouter Agents MCP Server
OpenRouter Agents MCP Server
Production MCP server for multi-agent AI research. Plan, parallelize, synthesize.
Install
npx @terminals-tech/openrouter-agents --stdioClaude Code one-liner:
claude mcp add openrouter-agents -- npx @terminals-tech/openrouter-agents --stdioWhat's New (v2.0.0)
MCP SDK 1.27.1 — registerTool/registerPrompt/registerResource APIs, security fixes
Zod 4 — Upgraded from Zod 3; z.record() syntax, config schema fixes
Express 5 — Upgraded from Express 4; modern path patterns, req.query handling
Streamable HTTP — Primary transport (SSE deprecated as legacy fallback)
Circuit breaker — Model API fault tolerance with configurable thresholds
Embedding-based model routing — Local vector similarity for model selection (no LLM call)
Persistent storage — Reports, jobs, knowledge graph persist across sessions by default
macOS/Node 25 Note: A cosmetic
libc++abi: mutex lock failedmessage may appear on shutdown. This is harmless — data is checkpointed before shutdown. SetDB_AUTO_HEAL=truefor in-memory mode (no persistence, no message).
Full Changelog | Extensions Guide | MCP Compliance Report
Configuration
Set OPENROUTER_API_KEY in your environment, then configure via .env or .mcp.json:
Variable | Default | Description |
| required | OpenRouter API key |
| (optional) | Comma-separated OpenRouter keys for rotation |
|
| Base cooldown per key after failures |
|
| HTTP server port |
|
|
|
|
| Enable embedding-based model routing |
|
| Enable knowledge indexing |
{
"mcpServers": {
"openrouter-agents": {
"command": "npx",
"args": ["@terminals-tech/openrouter-agents", "--stdio"],
"env": {
"OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}",
"INDEXER_ENABLED": "true"
}
}
}
}Multi-Client Setup
Transport Modes
Transport | Flag | Use Case |
STDIO | (default) | MCP clients (Claude, Jan AI, Continue) |
HTTP |
| Web apps, shared server |
STDIO is the default transport per MCP spec. Use --http explicitly for HTTP mode.
Client-Specific Setup
Enable MCP Servers in Settings → Advanced → Experimental
Click + to add server
Configure:
Name:
openrouter-agentsCommand:
npxArguments:
@terminals-tech/openrouter-agentsEnvironment:
OPENROUTER_API_KEY=sk-or-...
Note: STDIO is now default - no --stdio flag needed.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"openrouter-agents": {
"command": "npx",
"args": ["@terminals-tech/openrouter-agents"],
"env": {
"OPENROUTER_API_KEY": "sk-or-..."
}
}
}
}Standard MCP config - STDIO is default, no flags needed:
{
"command": "npx",
"args": ["@terminals-tech/openrouter-agents"],
"env": { "OPENROUTER_API_KEY": "..." }
}Feature Matrix
Feature | All MCP Clients | Claude Code Only |
Core Research Tools | ✓ | ✓ |
Knowledge Base | ✓ | ✓ |
Session/Graph Tools | ✓ | ✓ |
Rail Protocol Tools | ✓ | ✓ |
Slash Commands | - | ✓ |
Models (v2.0.0)
High-Cost Tier
Model | Domains |
| reasoning, technical, general, creative |
| reasoning, technical, general, creative |
| reasoning, technical, general |
| coding, technical, reasoning |
| reasoning, technical, general |
| coding, editing, technical |
Low-Cost Tier
Model | Domains |
| coding, editing, technical |
| general, technical, reasoning |
| general, reasoning, technical, coding |
| general, reasoning, technical, coding |
| general, reasoning, search |
Models are selected via embedding-based routing — query embeddings are matched to model domain profiles without an LLM call.
Tools
Tool | Description |
| Async research (returns job_id) |
| Sync research with streaming |
| Parallel batch queries |
| Context-aware follow-up |
| Unified entrypoint (auto-routes) |
Tool | Description |
| Hybrid BM25+vector search |
| Index or SQL query |
| SQL SELECT with params |
| Get report by ID |
| List recent reports |
Tool | Description |
| Session time-travel |
| Named save points |
| Create alternate timeline |
| Explore knowledge graph |
| Find node clusters |
| Importance rankings |
Tool | Description |
| List rails, tunnels, routes, consensus |
| Detailed rail/tunnel config |
| All defined routes |
| Active agent-to-agent tunnels |
| Streaming consensus sessions |
Tool | Description |
| Health check |
| Full diagnostics |
| Check async job |
| Current timestamp |
| Math evaluation |
| Available tools |
MCP Compliance
Compliant with MCP Specification 2025-11-25 (stable, AAIF/Linux Foundation governance).
Feature | SEP | Status |
JSON-RPC 2.0 | Core | Compliant |
Tools/Resources/Prompts | Core | Compliant |
Task Protocol | SEP-1686 | Compliant |
Sampling with Tools | SEP-1577 | Compliant |
Elicitation | SEP-1036 | Compliant |
MCP Apps | SEP-1865 | Compliant |
Enterprise Auth | SEP-990 | Compliant |
Client Metadata | SEP-991 | Compliant |
Architecture
User Query
│
▼
┌─────────────────┐
│ Planning Agent │ ─── Decomposes into sub-queries
└────────┬────────┘
│
┌────┴────┐
▼ ▼
┌───────┐ ┌───────┐
│Agent 1│ │Agent N│ ─── Parallel research (embedding-routed models)
└───┬───┘ └───┬───┘
│ │
▼ ▼
┌─────────────────┐
│ Synthesizer │ ─── Consensus + citations (Signal protocol)
└────────┬────────┘
│
▼
┌─────────────────┐
│ Knowledge Base │ ─── PGlite + pgvector (persistent)
└─────────────────┘Core Abstractions
Module | Purpose |
Signal Protocol | Inter-agent communication with confidence scoring and consensus |
Rail Protocol | Bidirectional channels with backpressure, provenance, tunnels |
Error Taxonomy | Deterministic classification with auto-learning and circuit breakers |
Circuit Breaker | Model API fault tolerance with configurable thresholds and auto-recovery |
Parameter Normalization | Declarative alias system ( |
RoleShift Protocol | Bidirectional server↔client via MCP sampling/elicitation |
Embedding Router | Local vector-based model selection via |
Circuit Breaker
Protects against cascading model API failures. Configurable via environment:
Variable | Default | Description |
|
| Enable circuit breaker |
|
| Failures before tripping |
|
| Recovery timeout (ms) |
States: closed (normal) -> open (failing, requests rejected) -> half-open (testing recovery).
Transport (v2.0.0)
Transport | Status | Use Case |
Streamable HTTP | Primary | All new integrations |
SSE | Deprecated | Legacy compatibility only |
STDIO | Default | MCP clients (Claude, Jan AI, Continue) |
Links
Homepage: terminals.tech
GitHub: terminals-tech/openrouter-agents
Docs: CLAUDE.md | Tool Patterns | Getting Started
Releasing
Releases are automated via release-please:
Push conventional commits to
main(e.g.feat:,fix:,chore:)release-please opens a version-bump PR
Merge the PR → GitHub Release created automatically
npm publish triggers on release via CI
Manual publish:
npm test && npm publish --access publicVersion: 2.0.0 | MCP SDK: 1.27.1 | MCP Spec: 2025-11-25 | Author: Tej Desai | License: MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wheattoast11/openrouter-deep-research-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server