Incorporates Google's Gemini model (gemini-2.0-flash-001) as one of the research agents for information gathering and analysis.
Leverages OpenAI models (gpt-4o-search-preview and gpt-4o-mini-search-preview) as research agents for conducting information searches and analysis.
Uses Perplexity models (sonar-deep-research, sonar-pro, sonar-reasoning-pro, sonar-reasoning) for advanced research tasks with specialized search capabilities.
OpenRouter Agents MCP Server
Overview
Production-ready MCP server for multi-agent AI research with OpenRouter integration. Fully compliant with MCP Specification 2025-06-18 and prepared for November 2025 spec updates.
Key Features
Multi-Agent Orchestration: Plan → parallelize → synthesize workflow with adaptive concurrency
Async Operations: Job system with SSE streaming for long-running research tasks
Knowledge Base: Hybrid BM25+vector search with PGlite + pgvector
Model Support: Dynamic catalog supporting Anthropic Sonnet-4, OpenAI GPT-5, Google Gemini, and more
Production Hardened: Rate limiting, request size limits, multi-tier auth (JWT/API key)
MCP Compliant: 100% spec compliance with server discovery and extension metadata
Three Modes: AGENT (simple), MANUAL (granular), or ALL (both)
Related MCP server: Ultimate MCP Server
Install / Run
Install (project dependency)
Global install (optional)
Run with npx (no install)
What's new (v1.7.0 - December 3, 2025)
Adaptive Tokens: Model-aware token limits using OpenRouter catalog (fixes report truncation)
Tool Chaining: Recursive tool execution with
chainaction (max depth: 3)Claude Code Integration: One-liner setup, slash commands, and LLM integration guide
Truncation Detection: Warns when API responses appear cut off mid-sentence
Changelog → | Compliance Report →
Quick start
Prereqs
Node 18+ (20 LTS recommended), npm, Git, OpenRouter API key
Install
Configure (.env)
Run
STDIO (for Cursor/VS Code MCP):
HTTP/SSE (local daemon):
Windows PowerShell examples
STDIO
HTTP/SSE
One-liner demo scripts
Dev (HTTP/SSE):
STDIO (Cursor/VS Code):
MCP client JSON configuration (no manual start required)
You can register this server directly in MCP clients that support JSON server manifests.
Minimal examples:
STDIO transport (recommended for IDEs)
HTTP/SSE transport (daemon mode)
With the package installed globally (or via npx), MCP clients can spawn the server automatically. See your client's docs for where to place this JSON (e.g., ~/.config/client/mcp.json).
Claude Code Integration
One-liner setup for Claude Code:
Or interactive setup with slash commands and hooks:
Included Slash Commands
Command | Description |
| Check server health and recent activity |
| Run synchronous research query |
| Run async research (returns job_id) |
| Search the knowledge base |
| Execute SQL query |
Environment Setup
Set your API key before using:
Portable Project Configuration
The setup creates a .mcp.json file for team-shareable configuration:
Verification
After setup, verify the connection:
Or use the tools directly:
See .claude/README.md for detailed configuration options.
Tools (high‑value)
Always‑on (all modes):
ping,get_server_status,job_status,get_job_status,cancel_jobAGENT:
agent(single entrypoint for research / follow_up / retrieve / query)MANUAL/ALL toolset:
submit_research(async),conduct_research(sync/stream),research_follow_up,search(hybrid),retrieve(index/sql),query(SELECT),get_report_content,list_research_historyJobs:
get_job_status,cancel_jobRetrieval:
search(hybrid BM25+vector with optional LLM rerank),retrieve(index/sql wrapper)SQL:
query(SELECT‑only, optionalexplain)Knowledge base:
get_past_research,list_research_history,get_report_contentDB ops:
backup_db(tar.gz),export_reports,import_reports,db_health,reindex_vectorsModels:
list_modelsWeb:
search_web,fetch_urlIndexer:
index_texts,index_url,search_index,index_status
Tool usage patterns (for LLMs)
Use tool_patterns resource to view JSON recipes describing effective chaining, e.g.:
Search → Fetch → Research
Async research: submit, stream via SSE
/jobs/:id/events, then get report content
Notes
Data lives locally under
PGLITE_DATA_DIR(default./researchAgentDB). Backups are tarballs in./backups.Use
list_modelsto discover current provider capabilities and ids.
Architecture at a glance
See docs/diagram-architecture.mmd (Mermaid). Render to SVG with Mermaid CLI if installed:
Or use the script:
If the image doesn’t render in your viewer, open docs/diagram-architecture-branded.svg directly.
Answer crystallization view
How it differs from typical “agent chains”:
Not just hardcoded handoffs; the plan is computed, then parallel agents search, then a synthesis step reasons over consensus, contradictions, and gaps.
The system indexes what it reads during research, so subsequent queries get faster/smarter.
Guardrails shape attention: explicit URL citations, [Unverified] labelling, and confidence scoring.
Minimal‑token prompt strategy
Compact mode strips preambles to essential constraints; everything else is inferred.
Enforced rules: explicit URL citations, no guessing IDs/URLs, confidence labels.
Short tool specs: use concise param names and rely on server defaults.
Common user journeys
“Give me an executive briefing on MCP status as of July 2025.”
Server plans sub‑queries, fetches authoritative sources, synthesizes with citations.
Indexed outputs make related follow‑ups faster.
“Find vision‑capable models and route images gracefully.”
/modelsdiscovered and filtered, router template generated, fallback to text models.
“Compare orchestration patterns for bounded parallelism.”
Pulls OTel/Airflow/Temporal docs, produces a MECE synthesis and code pointers.
Cursor IDE usage
Add this server in Cursor MCP settings pointing to
node src/server/mcpServer.js --stdio.Use the new prompts (
planning_prompt,synthesis_prompt) directly in Cursor to scaffold tasks.
FAQ (quick glance)
How does it avoid hallucinations?
Strict citation rules, [Unverified] labels, retrieval of past work, on‑the‑fly indexing.
Can I disable features?
Yes, via env flags listed above.
Does it support streaming?
Yes, SSE for HTTP; stdio for MCP.
Command Map (quick reference)
Start (stdio):
npm run stdioStart (HTTP/SSE):
npm startRun via npx (scoped):
npx @terminals-tech/openrouter-agents --stdioGenerate examples:
npm run gen:examplesList models: MCP
list_models { refresh:false }Submit research (async):
submit_research { q:"<query>", cost:"low", aud:"intermediate", fmt:"report", src:true }Track job:
get_job_status { job_id:"..." }, cancel:cancel_job { job_id:"..." }Unified search:
search { q:"<query>", k:10, scope:"both" }SQL (read‑only):
query { sql:"SELECT ... WHERE id = $1", params:[1], explain:true }Get past research:
get_past_research { query:"<query>", limit:5 }Index URL (if enabled):
index_url { url:"https://..." }Micro UI (ghost): visit
http://localhost:3002/uito stream job events (SSE).
Package publishing
Name:
@terminals-tech/openrouter-agentsVersion: 1.3.2
Bin:
openrouter-agentsAuthor: Tej Desai admin@terminals.tech
Homepage: https://terminals.tech
Install and run without cloning:
Publish (scoped)
Validation – MSeeP (Multi‑Source Evidence & Evaluation Protocol)
Citations enforced: explicit URLs, confidence tags; unknowns marked
[Unverified].Cross‑model triangulation: plan fans out to multiple models; synthesis scores consensus vs contradictions.
KB grounding: local hybrid index (BM25+vector) retrieves past work for cross‑checking.
Human feedback:
rate_research_report { rating, comment }stored to DB; drives follow‑ups.Reproducibility:
export_reports+backup_dbcapture artifacts for audit.
Quality feedback loop
Run examples:
npm run gen:examplesReview:
list_research_history,get_report_content {reportId}Rate:
rate_research_report { reportId, rating:1..5, comment }Improve retrieval:
reindex_vectors,index_status,search_index { query }
Architecture diagram (branded)
See
docs/diagram-architecture-branded.svg(logo links tohttps://terminals.tech).
Stargazers
Appeared in Searches
- OpenRouter thinking or reasoning capabilities
- Developing a Framework for Creating Autonomous Agent Solutions for Startup Studios
- An exploration of the term 'multimodal' and its applications
- An MCP tool for AI to ask questions to other AIs
- Using OpenRouter API to integrate calls to other LLMs on Claude desktop