
openrouter-mcp-multimodal
โ 52from stabgan
MCP server for OpenRouter: 300+ LLMs with vision, image gen, audio in/out, and video analysis + generation (Veo 3.1 / Sora 2 Pro / Seedance / Wan). Structured errors, IPv6 SSRF guards, path sandbox.
OpenRouter MCP Multimodal
The MCP server for multimodal AI agents.
One install ยท 14 tools ยท 300+ OpenRouter models ยท text, vision, audio & video โ analysis and generation.
Quick start ยท Tools ยท Examples ยท Security ยท Development ยท FAQ
What is this?
OpenRouter MCP Multimodal is a production-grade Model Context Protocol (MCP) server โ listed on the official MCP Registry as io.github.stabgan/openrouter-multimodal. It connects AI coding agents (Cursor, Claude Desktop, VS Code, Windsurf, Cline, and others) to OpenRouter's unified LLM API over stdio.
Unlike text-only MCP servers, one install covers the full multimodal surface:
| Capability | Tools | Highlights |
|---|---|---|
| Chat | chat_completion | 300+ models, :nitro / :exacto suffixes, provider routing, web search, response caching, reasoning tokens |
| Vision | analyze_image, generate_image | OCR, captioning, VQA, image generation with reference inputs |
| Audio | analyze_audio, generate_audio | Transcription, speech/music generation |
| Video | analyze_video, generate_video, generate_video_from_image, get_video_status | Clip understanding, Veo / Sora / Seedance / Wan generation with progress notifications |
| Catalog | search_models, get_model_info, validate_model, rerank_documents, health_check | Model discovery, validation, reranking, ops health |
Production hardening: input/output path sandboxes (including analyze_* local files as of v4.5.2), SSRF guards, structured errors with _meta.code, MCP 2025-06-18 structured outputs, async video progress notifications, and 650+ automated tests (unit, mock, regression, and live integration).
Why this server?
| Capability | This server | Typical MCP LLM servers |
|---|---|---|
| Text chat (300+ models) | โ | โ |
| Image analysis + generation | โ | partial |
| Audio analysis + TTS | โ | โ |
| Video analysis + generation | โ | โ |
| Model search / validate / rerank | โ | โ |
| Path sandbox + SSRF protection | โ | rare |
| MCP 2025 structured outputs | โ | rare |
| Async video + progress notifications | โ | โ |
Tools
14 MCP tools. Each description includes Use when, Good/Bad examples, Fails when, and Works with so agents pick the right tool and recover from errors.
| Tool | Purpose |
|---|---|
chat_completion | Text chat, web search, provider routing, caching, reasoning |
analyze_image | Vision โ local path, URL, or data URL + question |
analyze_audio | Transcribe / analyze audio files |
analyze_video | Describe / Q&A over video files |
generate_image | Text-to-image with optional reference images |
generate_audio | Text-to-speech / music |
generate_video | Text-to-video (async, resumable) |
generate_video_from_image | Image-to-video (narrower schema) |
get_video_status | Poll / resume video jobs |
search_models | Paginated model catalog search |
get_model_info | Pricing, context, modalities |
validate_model | Cheap model ID existence check |
rerank_documents | Relevance ranking for RAG |
health_check | API key + reachability probe |
Errors use a closed _meta.code taxonomy: INVALID_INPUT ยท UNSAFE_PATH ยท UPSTREAM_* ยท MODEL_NOT_FOUND ยท JOB_STILL_RUNNING ยท and more.
Examples
Chat (free model)
{
"tool": "chat_completion",
"arguments": {
"model": "google/gemma-4-26b-a4b-it:free",
"messages": [{ "role": "user", "content": "Summarize MCP in one sentence." }]
}
}Analyze an image
{
"tool": "analyze_image",
"arguments": {
"image_path": "diagram.png",
"question": "List every label in this diagram."
}
}Use
image_pathandquestionโ notimage/prompt.
Search models (vision + free)
{
"tool": "search_models",
"arguments": {
"query": "gemma",
"capabilities": { "vision": true },
"limit": 10,
"offset": 0
}
}Generate video (async)
{
"tool": "generate_video",
"arguments": {
"model": "google/veo-3.1",
"prompt": "Ocean waves at sunrise, cinematic drone shot",
"duration": 4,
"save_path": "river.mp4"
}
}If the job is still running when max_wait_ms elapses, the response succeeds with _meta.code: JOB_STILL_RUNNING and a video_id โ call get_video_status to resume. This is not an error.
More examples: docs/plans/tool-description-improvement.md
Security
- Input path sandbox โ
analyze_*and reference images must stay insideOPENROUTER_INPUT_DIR - Output path sandbox โ
save_pathmust stay insideOPENROUTER_OUTPUT_DIR - SSRF protection โ private/reserved IPs blocked on URL fetches
- Untrusted content โ analyze outputs tagged
_meta.content_is_untrusted: true
Override sandboxes only with OPENROUTER_ALLOW_UNSAFE_PATHS=1 (discouraged).
Development
git clone https://github.com/stabgan/openrouter-mcp-multimodal.git
cd openrouter-mcp-multimodal
npm install
cp .env.example .env # add OPENROUTER_API_KEY
npm run buildTesting
| Command | What it runs |
|---|---|
npm test | 652 unit + mock tests (no API key, <2s) |
npm run test:regression | Security + schema regression guards |
npm run test:integration | 16 live OpenRouter scenarios (requires .env key) |
npm run test:e2e | Full MCP stdio smoke (scripts/live-e2e.mjs) |
npm run ci | lint + format + build + all of the above except e2e |
Free models for CI / zero-credit accounts: integration tests default to google/gemma-4-26b-a4b-it:free (override with OPENROUTER_INTEGRATION_MODEL). GitHub Actions requires the OPENROUTER_API_KEY repository secret.
Mock tests live under src/__tests__/mock/ and cover handlers, path sandboxes, SSRF blocks, model-cache pagination, tool descriptions, and structured outputs โ 330+ additional cases beyond the core suite.
npm run lint
npm run format:checkCompatibility
Works with any MCP client. Protocol: MCP 2025-06-18. Node โฅ 20 (Docker image uses Node 22).
export OPENROUTER_API_KEY=sk-or-v1-...
npx -y @stabgan/openrouter-mcp-multimodalBefore it works, you'll need: OPENROUTER_API_KEY
Quick start
1. Get an API key (free tier works) โ openrouter.ai/keys
2. Run the server
export OPENROUTER_API_KEY=sk-or-v1-...
npx -y @stabgan/openrouter-mcp-multimodal3. Add to your MCP client (Cursor, Claude Desktop, VS Code, etc.) โ see Install below.
No credits required to start. Free models such as
google/gemma-4-26b-a4b-it:freework for chat and vision. Video/audio generation typically needs credits.
Install
MCP servers are distributed through several packaging models. This server is implemented in Node.js/TypeScript; the table below maps each ecosystem method to how you run it here.
| Method | Runtime | Best for | This server |
|---|---|---|---|
| npx | Node.js 20+ | Most MCP clients (default) | โ
@stabgan/openrouter-mcp-multimodal |
| uvx / pipx | Python 3.10+ and Node.js 20+ | Python-first workflows, same pattern as PyPI MCP servers | โ
mcp-server-openrouter-multimodal |
| npm global | Node.js 20+ | Pin a version without re-downloading | โ |
| node (local) | Node.js 20+ | Contributors / air-gapped builds | โ |
| Docker Hub | Docker | Isolation, no Node on host | โ
stabgan/openrouter-mcp-multimodal |
| GHCR | Docker | GitHub-native OCI pulls | โ
ghcr.io/stabgan/openrouter-mcp-multimodal |
| Smithery CLI | Node.js (via installer) | Interactive install into Claude/Cursor/etc. | โ |
| MCP Registry | npm or OCI | Official discovery (io.github.stabgan/openrouter-multimodal) | โ listing |
| One-click deeplinks | Node.js | Cursor, VS Code, Kiro | โ |
| Claude Code CLI | Node.js | Terminal-first Claude Code users | โ |
| MCP Inspector | Node.js | Debug / list tools locally | โ |
Windows cmd /c npx | Node.js | Claude Desktop / Cursor when npx not on GUI PATH | โ see below |
| pip / uv (direct) | โ | Native Python MCP servers only | โ use uvx row above |
| DXT desktop extensions | โ | Bundled Claude Desktop .dxt | not yet |
| Remote HTTP / SSE | โ | Hosted Smithery / Cloudflare endpoints | via Smithery |
uvx vs npx: In the MCP ecosystem,
npxruns npm (Node) packages anduvxruns PyPI (Python) packages. Because this server is Node-based,uvxuses a thin Python launcher that execsnpx -y @stabgan/openrouter-mcp-multimodalโ you still need Node installed.
One-click
| Cursor | |
| VS Code | |
| Kiro | |
| Claude Desktop / Windsurf / Cline | Manual JSON config (pick any method below) |
| Smithery | npx -y @smithery/cli install @stabgan/openrouter-mcp-multimodal --client claude |
| MCP Registry | Official registry page โ npm + OCI packages |
Paste your OPENROUTER_API_KEY when prompted โ deeplinks use placeholders so secrets never appear in URLs.
Manual config
npx (recommended)
export OPENROUTER_API_KEY=sk-or-v1-...
npx -y @stabgan/openrouter-mcp-multimodal{
"mcpServers": {
"openrouter": {
"command": "npx",
"args": ["-y", "@stabgan/openrouter-mcp-multimodal"],
"env": {
"OPENROUTER_API_KEY": "sk-or-v1-..."
}
}
}
}Pin a release: "args": ["-y", "@stabgan/openrouter-mcp-multimodal@4.5.3"]
uvx / pipx (Python launcher)
Install uv (includes uvx), ensure Node.js 20+ is also on your PATH, then:
export OPENROUTER_API_KEY=sk-or-v1-...
uvx mcp-server-openrouter-multimodal
# pin npm version: OPENROUTER_MCP_NPM_VERSION=4.5.3 uvx mcp-server-openrouter-multimodal{
"mcpServers": {
"openrouter": {
"command": "uvx",
"args": ["mcp-server-openrouter-multimodal"],
"env": {
"OPENROUTER_API_KEY": "sk-or-v1-..."
}
}
}
}pipx equivalent: pipx run mcp-server-openrouter-multimodal
Optional: OPENROUTER_MCP_NPM_VERSION=4.5.3 pins the underlying npm package.
npm global
npm install -g @stabgan/openrouter-mcp-multimodal{
"mcpServers": {
"openrouter": {
"command": "openrouter-multimodal",
"env": { "OPENROUTER_API_KEY": "sk-or-v1-..." }
}
}
}node (local clone)
git clone https://github.com/stabgan/openrouter-mcp-multimodal.git
cd openrouter-mcp-multimodal
npm ci && npm run build{
"mcpServers": {
"openrouter": {
"command": "node",
"args": ["/absolute/path/to/openrouter-mcp-multimodal/dist/index.js"],
"env": { "OPENROUTER_API_KEY": "sk-or-v1-..." }
}
}
}Docker
docker run --rm -i -e OPENROUTER_API_KEY=sk-or-v1-... stabgan/openrouter-mcp-multimodal:latest{
"mcpServers": {
"openrouter": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"OPENROUTER_API_KEY=sk-or-v1-...",
"stabgan/openrouter-mcp-multimodal:latest"
]
}
}
}Use -i (interactive stdio). Avoid -t (TTY corrupts MCP framing on some hosts).
GHCR (GitHub Container Registry)
docker run --rm -i -e OPENROUTER_API_KEY=sk-or-v1-... \
ghcr.io/stabgan/openrouter-mcp-multimodal:4.5.3{
"mcpServers": {
"openrouter": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "OPENROUTER_API_KEY=sk-or-v1-...",
"ghcr.io/stabgan/openrouter-mcp-multimodal:latest"
]
}
}
}Smithery
Interactive install (writes config for your client):
npx -y @smithery/cli install @stabgan/openrouter-mcp-multimodal --client claude
# or: --client cursor | vscode | windsurf | ...Listing: smithery.ai/server/@stabgan/openrouter-mcp-multimodal
MCP Registry
Official name: io.github.stabgan/openrouter-multimodal
- Registry: registry.modelcontextprotocol.io
- npm package:
@stabgan/openrouter-mcp-multimodal - OCI image:
docker.io/stabgan/openrouter-mcp-multimodal
Clients that support registry-driven install will offer npm or Docker; otherwise use the JSON blocks above.
Claude Code CLI
claude mcp add openrouter -- npx -y @stabgan/openrouter-mcp-multimodal
# project scope:
claude mcp add --scope project openrouter -- npx -y @stabgan/openrouter-mcp-multimodalSet OPENROUTER_API_KEY in your shell or client env before starting Claude Code.
MCP Inspector
Debug tools/list and tool calls against a live OpenRouter key:
export OPENROUTER_API_KEY=sk-or-v1-...
npx -y @modelcontextprotocol/inspector npx -y @stabgan/openrouter-mcp-multimodalWindows npx
When Claude Desktop or Cursor cannot find npx (GUI apps often miss shell PATH), wrap with cmd:
{
"mcpServers": {
"openrouter": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@stabgan/openrouter-mcp-multimodal"],
"env": { "OPENROUTER_API_KEY": "sk-or-v1-..." }
}
}
}If still failing, use the full path from where npx as the command.
Configuration
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
OPENROUTER_API_KEY | Yes | โ | OpenRouter API key |
OPENROUTER_DEFAULT_MODEL | No | nvidia/nemotron-nano-12b-v2-vl:free | Default when tools omit model |
OPENROUTER_INTEGRATION_MODEL | No | google/gemma-4-26b-a4b-it:free | Model used by live integration tests |
OPENROUTER_OUTPUT_DIR | No | cwd | Sandbox root for save_path |
OPENROUTER_INPUT_DIR | No | โ | Sandbox root for local input files |
OPENROUTER_LOG_LEVEL | No | info | error / warn / info / debug |
See .env.example for the full list (provider routing, image/audio/video limits, caching, video polling).
FAQ
Do I need paid OpenRouter credits?
No, to get started. Free models work for chat and vision. Audio/video generation usually requires credits; analysis may return 402 on some models โ the server surfaces that as a structured error.
Which MCP clients are supported?
Any MCP-compatible client over stdio: Cursor, Claude Desktop, VS Code Copilot, Windsurf, Cline, Kiro, and custom agents.
How is this different from calling OpenRouter directly?
This server adds MCP tool schemas, security sandboxes, error taxonomy, model caching, async video polling with progress notifications, and agent-oriented tool descriptions โ so LLMs invoke the right capability without custom HTTP glue.
Where is the security advisory for path traversal?
Fixed in 4.5.2+ โ see GHSA-3q7p-736f-x44v and docs/solutions/security-issues/.
Licensed under Apache-2.0โ you can use, modify, and redistribute it under that license's terms.
License
Apache 2.0 โ see LICENSE.