wheattoast11
openrouter-deep-research-mcp
JavaScript

A multi-agent research MCP server + mini client adapter - orchestrates a net of async agents or streaming swarm to conduct ensemble consensus-backed research. Each task builds its own indexed pglite database on the fly in web assembly. Includes semantic + hybrid search, SQL execution, semaphores, prompts/resources and more

Last updated Jul 29, 2026
53
Stars
13
Forks
4
Issues
0
Stars/day
Attention Score
49
Language breakdown
JavaScript 97.9%
TypeScript 1.0%
HTML 0.8%
Shell 0.2%
Dockerfile 0.0%
β–Έ Files click to expand
README

OpenRouter Agents MCP Server

npm MCP Stable GitHub

Production MCP server for multi-agent AI research. Plan, parallelize, synthesize.

Install

npx @terminals-tech/openrouter-agents --stdio

Claude Code one-liner:

claude mcp add openrouter-agents -- npx @terminals-tech/openrouter-agents --stdio

What'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 failed message may appear on shutdown. This is harmless β€” data is checkpointed before shutdown. Set DBAUTOHEAL=true for in-memory mode (no persistence, no message).

Full Changelog | Extensions Guide | MCP Compliance Report

Configuration

Set OPENROUTERAPIKEY in your environment, then configure via .env or .mcp.json:

| Variable | Default | Description | |----------|---------|-------------| | OPENROUTERAPIKEY | required | OpenRouter API key | | OPENROUTERAPIKEYS | (optional) | Comma-separated OpenRouter keys for rotation | | OPENROUTERKEYCOOLDOWN_MS | 5000 | Base cooldown per key after failures | | SERVER_PORT | 3002 | HTTP server port | | MODE | ALL | AGENT, MANUAL, or ALL | | EMBEDDINGROUTINGENABLED | true | Enable embedding-based model routing | | INDEXER_ENABLED | true | Enable knowledge indexing |

Full ENV Reference

.mcp.json example (team-shareable)

{
  "mcpServers": {
    "openrouter-agents": {
      "command": "npx",
      "args": ["@terminals-tech/openrouter-agents", "--stdio"],
      "env": {
        "OPENROUTERAPIKEY": "${OPENROUTERAPIKEY}",
        "INDEXER_ENABLED": "true"
      }
    }
  }
}

Multi-Client Setup

Transport Modes

| Transport | Flag | Use Case | |-----------|------|----------| | STDIO | (default) | MCP clients (Claude, Jan AI, Continue) | | HTTP | --http | Web apps, shared server |

STDIO is the default transport per MCP spec. Use --http explicitly for HTTP mode.

Client-Specific Setup

Jan AI

  • Enable MCP Servers in Settings β†’ Advanced β†’ Experimental
  • Click + to add server
  • Configure:
- Name: openrouter-agents - Command: npx - Arguments: @terminals-tech/openrouter-agents - Environment: OPENROUTERAPIKEY=sk-or-...

Note: STDIO is now default - no --stdio flag needed.

Claude Desktop

Add to ~/Library/Application Support/Claude/claudedesktopconfig.json (macOS) or %APPDATA%\Claude\claudedesktopconfig.json (Windows):

{
  "mcpServers": {
    "openrouter-agents": {
      "command": "npx",
      "args": ["@terminals-tech/openrouter-agents"],
      "env": {
        "OPENROUTERAPIKEY": "sk-or-..."
      }
    }
  }
}

Continue / Zed / Other MCP Clients

Standard MCP config - STDIO is default, no flags needed:

{   "command": "npx",   "args": ["@terminals-tech/openrouter-agents"],   "env": { "OPENROUTERAPIKEY": "..." } }

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 | |-------|---------| | anthropic/claude-sonnet-4.5 | reasoning, technical, general, creative | | anthropic/claude-opus-4.6 | reasoning, technical, general, creative | | openai/gpt-5.2-chat | reasoning, technical, general | | openai/gpt-5.3-codex | coding, technical, reasoning | | google/gemini-3-pro-preview | reasoning, technical, general | | qwen/qwen3-coder | coding, editing, technical |

Low-Cost Tier

| Model | Domains | |-------|---------| | google/gemini-3-flash-preview | coding, editing, technical | | anthropic/claude-haiku-4.5 | general, technical, reasoning | | deepseek/deepseek-chat-v3.1 | general, reasoning, technical, coding | | deepseek/deepseek-v3.2 | general, reasoning, technical, coding | | openai/gpt-oss-120b | general, reasoning, search |

Models are selected via embedding-based routing β€” query embeddings are matched to model domain profiles without an LLM call.

Tools

Research

| Tool | Description | |------|-------------| | research | Async research (returns job_id) | | conduct_research | Sync research with streaming | | batch_research | Parallel batch queries | | researchfollowup | Context-aware follow-up | | agent | Unified entrypoint (auto-routes) |

Knowledge Base

| Tool | Description | |------|-------------| | search | Hybrid BM25+vector search | | retrieve | Index or SQL query | | query | SQL SELECT with params | | get_report | Get report by ID | | history | List recent reports |

Session & Graph

| Tool | Description | |------|-------------| | undo / redo | Session time-travel | | checkpoint | Named save points | | fork_session | Create alternate timeline | | graph_traverse | Explore knowledge graph | | graph_clusters | Find node clusters | | graph_pagerank | Importance rankings |

Rail Protocol

| Tool | Description | |------|-------------| | list_rails | List rails, tunnels, routes, consensus | | explain_rail | Detailed rail/tunnel config | | list_routes | All defined routes | | list_tunnels | Active agent-to-agent tunnels | | list_consensus | Streaming consensus sessions |

Utility

| Tool | Description | |------|-------------| | ping | Health check | | getserverstatus | Full diagnostics | | job_status | Check async job | | date_time | Current timestamp | | calc | Math evaluation | | list_tools | 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 |

Full Compliance Report

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 (qβ†’query, costβ†’costPreference) | | RoleShift Protocol | Bidirectional server↔client via MCP sampling/elicitation | | Embedding Router | Local vector-based model selection via @terminals-tech/embeddings |

Circuit Breaker

Protects against cascading model API failures. Configurable via environment:

| Variable | Default | Description | |----------|---------|-------------| | RAILCIRCUITBREAKER | true | Enable circuit breaker | | RAILCIRCUITTHRESHOLD | 5 | Failures before tripping | | RAILCIRCUITRESET_MS | 120000 | 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

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 public

Version: 2.0.0 | MCP SDK: 1.27.1 | MCP Spec: 2025-11-25 | Author: Tej Desai | License: MIT

Β© 2026 GitRepoTrend Β· wheattoast11/openrouter-deep-research-mcp Β· Updated daily from GitHub