Skip to content

Openrouter MCP

Stateless MCP server and CLI for OpenRouter (MCP 2026-07-28): use any OpenRouter model from Claude Code and other MCP clients. 13 tools, 1 resource, HTTP and stdio.

Install: git clone https://github.com/th3nolo/openrouter-mcp

Works with Claude Code · 13 GitHub stars

Install

$git clone https://github.com/th3nolo/openrouter-mcp

Install command taken from the project's README or registry entry. Always review code before running it.

OpenRouter MCP server

This project connects agents to OpenRouter through two front doors: an agent-first command-line interface and a strict stateless MCP server. Both use the same operation layer and stable response shapes. The MCP server exposes thirteen focused tools and one API-key usage resource.

Version 3.0 targets MCP 2026-07-28 only. Each HTTP POST is independent. The server does not accept initialize, create Mcp-Session-Id sessions, expose a GET event stream, or run a legacy fallback.

Design notes and the reasoning behind the stateless 2026-07-28 surface are in the engineering note Building a strict stateless MCP 2026-07-28 server for OpenRouter. More notes and case studies: th3nolo.com. Author: Manuel Parra.

What changed in 3.0

  • list_models sends pagination, filters, and sorting to OpenRouter instead of downloading the full catalog.
  • get_model calls OpenRouter's direct model endpoint. It replaces get_model_info; there is no alias.
  • list_model_endpoints returns provider price, context, uptime, latency, throughput, and supported parameters.
  • list_providers exposes provider geography, policy links, and service-status metadata without a browser.
  • list_model_rankings and list_app_rankings expose bounded versions of OpenRouter's public rankings pages.
  • get_credits and list_activity expose account data with a separate management-key boundary.
  • get_analytics_schema and query_analytics expose the current Activity Explore analytics contract with explicit time ranges and bounded results.
  • chat_with_model and compare_models return a generation_id and the resolved model.
  • get_generation uses that ID to fetch exact provider, token, latency, and cost metadata.
  • The openrouter-mcp CLI exposes the same operations directly, emits JSON automatically when piped, and never prompts.
  • Browser inspection informed the surface contract, but no browser, cookie, HAR file, or browser session is required at runtime.
  • openrouter://models and openrouter://pricing were removed. Their unbounded catalog payloads are not retained as fallbacks.
  • Unknown fields added by OpenRouter are stripped at the API boundary. The MCP output schemas remain stable.
  • Static discovery responses declare a one-hour public cache hint. API-key usage remains private with a five-second hint.
  • Model comparisons run at most three OpenRouter calls at once. Paid calls are never retried automatically.
  • Custom OpenRouter base URLs must use HTTPS. Plain HTTP is accepted only for loopback development.

See docs/API.md for the complete tool contract, docs/CLI.md for direct CLI use, and docs/MCP-2026-07-28.md for wire-level behavior.

Requirements

  • Node.js 24 LTS
  • pnpm 12.0.0, exactly as pinned in package.json
  • An OpenRouter API key for rankings, inference, generation metadata, and key-usage data
  • An OpenRouter management key for credit totals, account activity, and analytics

OpenRouter currently serves public model and provider discovery without a key. That anonymous behavior may be rate-limited or changed upstream.

Install

git clone https://github.com/th3nolo/openrouter-mcp.git
cd openrouter-mcp
pnpm install
pnpm run check

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

MCP serverDatabases+105 this week

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

Explore related