{
  "markdown": "<div align=\"center\">\n  <img src=\"./logo.png\" alt=\"mcp-openrouter\" width=\"360\" />\n\n  **🚀 One MCP server for OpenRouter models 🚀**\n</div>\n\n<!-- mcp-name: io.github.tsilva/mcp-openrouter -->\n\n`mcp-openrouter` is a Python MCP server that lets Codex, Claude Code, opencode, and other MCP hosts call OpenRouter models from local stdio tools.\n\nIt exposes chat, image generation, embeddings, model listing, and model search through a small FastMCP server with retry handling, host-aware installation, and optional default model environment variables.\n\n## Install\n\nInstall the published server into every detected MCP client:\n\n```bash\nuvx mcp-openrouter install --yes\n```\n\nInstall into selected clients:\n\n```bash\nuvx mcp-openrouter install --yes --clients codex,claude,opencode\n```\n\nRun from a local checkout:\n\n```bash\ngit clone https://github.com/tsilva/mcp-openrouter.git\ncd mcp-openrouter\nuv sync --dev\nkeyenv doctor\nkeyenv run -- uv run mcp-openrouter\n```\n\n`mcp-openrouter` with no arguments starts the stdio server. The explicit command is `uv run mcp-openrouter serve`.\n\n## Commands\n\n```bash\nuvx mcp-openrouter install --yes                 # install into detected MCP clients\nuvx mcp-openrouter install --yes --force         # replace an existing openrouter config\nuvx mcp-openrouter uninstall --yes               # remove from detected MCP clients\nuv run mcp-openrouter                            # run the local stdio server\nuv run pytest tests/test_cli.py tests/test_client.py tests/test_config.py tests/test_installer.py tests/test_release_metadata.py tests/test_server.py\nkeyenv run -- uv run pytest tests/test_tools.py\nuv run ruff check src/\nuv run ruff format src/\n```\n\n## Tools\n\n| Tool | Purpose |\n| --- | --- |\n| `chat` | Send a prompt or message list to an OpenRouter chat model. |\n| `generate_image` | Generate one image and optionally save it to an absolute local path. |\n| `embed` | Generate embeddings for a string or list of strings. |\n| `list_models` | List models, optionally filtered by `vision`, `image_gen`, `embedding`, `tools`, or `long_context`. |\n| `find_models` | Search model names and slugs, returning up to 20 matches. |\n\nExample MCP prompts:\n\n```text\nUse openrouter chat with anthropic/claude-sonnet-4 to summarize this file\nUse openrouter generate_image with google/gemini-3-pro-image-preview to create a square app icon\nUse openrouter embed with mistralai/mistral-embed-2312 to embed \"Hello world\"\nUse openrouter list_models with capability \"image_gen\"\nUse openrouter find_models to search for \"claude\"\n```\n\n## Configuration\n\n`OPENROUTER_API_KEY` is required for all tool calls. For a local checkout, its `.keyenv.toml` maps the variable to macOS Keychain: use `keyenv set OPENROUTER_API_KEY` to replace it, `keyenv doctor` to verify it, and `keyenv run -- ...` to launch the server or live tests. Python still reads the value normally from `os.environ`.\n\nOptional defaults make the `model` parameter optional for matching tools:\n\n```bash\nDEFAULT_TEXT_MODEL=google/gemini-3-pro-image-preview\nDEFAULT_IMAGE_MODEL=google/gemini-3-pro-image-preview\nDEFAULT_CODE_MODEL=anthropic/claude-sonnet-4.5\nDEFAULT_VISION_MODEL=google/gemini-3-pro-image-preview\nDEFAULT_EMBEDDING_MODEL=mistralai/mistral-embed-2312\n```\n\nThe current tools read `DEFAULT_TEXT_MODEL`, `DEFAULT_IMAGE_MODEL`, and `DEFAULT_EMBEDDING_MODEL`. `DEFAULT_CODE_MODEL` and `DEFAULT_VISION_MODEL` are available for client conventions. Non-secret defaults may remain in `.env`; the API key must not.\n\n## Notes\n\n- Python 3.10+ is required.\n- The published runtime command installed into hosts is `uvx mcp-openrouter`.\n- Supported installer targets are Codex, Claude Code, and opencode.\n- `generate_image.output_path` must be absolute, for example `/Users/you/output.png`.\n- Unit tests mock network calls. `tests/test_tools.py` requires a live `OPENROUTER_API_KEY`.\n- After changing server code, restart the MCP host so it launches a fresh server process.\n- Keep `server.json`, `CHANGELOG.md`, and the package version in sync before release. The Makefile release helper is `make release-x.y.z`.\n\n## Local MCP Development\n\nRegister a local checkout when you want an MCP host to run your working tree instead of the published PyPI package.\n\nClaude Code:\n\n```bash\nclaude mcp add openrouter --scope user -- keyenv run --manifest /path/to/mcp-openrouter/.keyenv.toml -- uv run --directory /path/to/mcp-openrouter mcp-openrouter\n```\n\nCodex:\n\n```bash\ncodex mcp add openrouter -- keyenv run --manifest /path/to/mcp-openrouter/.keyenv.toml -- uv run --directory /path/to/mcp-openrouter mcp-openrouter\n```\n\nopencode:\n\n```json\n{\n  \"mcp\": {\n    \"openrouter\": {\n      \"type\": \"local\",\n      \"command\": [\"keyenv\", \"run\", \"--manifest\", \"/path/to/mcp-openrouter/.keyenv.toml\", \"--\", \"uv\", \"run\", \"--directory\", \"/path/to/mcp-openrouter\", \"mcp-openrouter\"],\n      \"enabled\": true\n    }\n  }\n}\n```\n\n## Architecture\n\n![mcp-openrouter architecture diagram](./architecture.png)\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 4968,
  "sha": "d1cfb53a6f21c16c505c7fa786db7bbb677c19e6967bcf7dd213a3563ee42bdb",
  "repo_slug": "tsilva/mcp-openrouter",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_tsilva_mcp_openrouter_2bf5829a/readme"
}