OpenRouter MCP Multimodal Server

by stabgan
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Offers deployment through Docker containers, with support for environment variables and seamless integration with MCP configurations.

  • Enables use of Google's Gemini models through OpenRouter for text chat and multimodal conversations, with support for vision capabilities and model customization.

  • Provides Node.js-based installation and execution options with NPX support for easy integration into MCP environments.

OpenRouter MCP 多模式服务器

一个 MCP(模型上下文协议)服务器,通过 OpenRouter.ai 丰富的模型生态系统提供聊天和图像分析功能。该服务器将文本聊天功能与强大的图像分析功能相结合。

特征

  • 文字聊天:
    • 直接访问所有 OpenRouter.ai 聊天模型
    • 支持简单文本和多模式对话
    • 可配置温度和其他参数
  • 图像分析:
    • 使用自定义问题分析单个图像
    • 同时处理多幅图像
    • 自动调整图像大小并进行优化
    • 支持各种图像源(本地文件、URL、数据URL)
  • 模型选择:
    • 搜索并过滤可用模型
    • 验证模型 ID
    • 获取详细模型信息
    • 支持默认模型配置
  • 性能优化:
    • 智能模型信息缓存
    • 重试的指数退避
    • 自动速率限制处理

1.5.0 中的新功能

  • 改进的操作系统兼容性:
    • 增强了 Windows、macOS 和 Linux 的路径处理
    • 更好地支持带有驱动器号的 Windows 样式路径
    • 规范化路径处理以实现跨平台的一致行为
  • MCP 配置支持:
    • 无需环境变量的 Cursor MCP 集成
    • 通过 MCP 参数直接配置
    • 灵活的 API 密钥和模型规范选项
  • 强大的错误处理:
    • 改进了图像处理的回退机制
    • 通过特定诊断更好地报告错误
    • 文件读取多种备份策略
  • 图像处理增强功能:
    • 为所有图像类型提供更可靠的 base64 编码
    • Sharp 模块不可用时的后备选项
    • 通过自动优化更好地处理大图像

安装

选项 1:通过 npm 安装

npm install -g @stabgan/openrouter-mcp-multimodal

选项 2:通过 Docker 运行

docker run -i -e OPENROUTER_API_KEY=your-api-key-here stabgandocker/openrouter-mcp-multimodal:latest

快速启动配置

先决条件

  1. OpenRouter Keys获取您的 OpenRouter API 密钥
  2. 选择默认模型(可选)

MCP 配置选项

将以下配置之一添加到您的 MCP 设置文件(例如cline_mcp_settings.jsonclaude_desktop_config.json ):

选项 1:使用 npx(Node.js)

{ "mcpServers": { "openrouter": { "command": "npx", "args": [ "-y", "@stabgan/openrouter-mcp-multimodal" ], "env": { "OPENROUTER_API_KEY": "your-api-key-here", "DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free" } } } }

选项 2:使用 uv(Python 包管理器)

{ "mcpServers": { "openrouter": { "command": "uv", "args": [ "run", "-m", "openrouter_mcp_multimodal" ], "env": { "OPENROUTER_API_KEY": "your-api-key-here", "DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free" } } } }

选项 3:使用 Docker

{ "mcpServers": { "openrouter": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "OPENROUTER_API_KEY=your-api-key-here", "-e", "DEFAULT_MODEL=qwen/qwen2.5-vl-32b-instruct:free", "stabgandocker/openrouter-mcp-multimodal:latest" ] } } }

选项 4:使用 Smithery(推荐)

{ "mcpServers": { "openrouter": { "command": "smithery", "args": [ "run", "stabgan/openrouter-mcp-multimodal" ], "env": { "OPENROUTER_API_KEY": "your-api-key-here", "DEFAULT_MODEL": "qwen/qwen2.5-vl-32b-instruct:free" } } } }

示例

有关如何使用此 MCP 服务器的详细示例,请查看示例目录。我们提供:

  • Node.js 应用程序的 JavaScript 示例
  • 具有交互式聊天功能的 Python 示例
  • 用于与各种应用程序集成的代码片段

每个示例都附有清晰的文档和分步说明。

依赖项

该项目使用以下关键依赖项:

  • @modelcontextprotocol/sdk : ^1.8.0 - 用于工具实现的最新 MCP SDK
  • openai :^4.89.1 - OpenAI 兼容的 OpenRouter API 客户端
  • sharp : ^0.33.5 - 快速图像处理库
  • axios :^1.8.4 - 用于 API 请求的 HTTP 客户端
  • node-fetch : ^3.3.2 - 现代 fetch 实现

需要 Node.js 18 或更高版本。所有依赖项都会定期更新,以确保兼容性和安全性。

可用工具

mcp_openrouter_chat_completion

向 OpenRouter 模型发送文本或多模式消息:

use_mcp_tool({ server_name: "openrouter", tool_name: "mcp_openrouter_chat_completion", arguments: { model: "google/gemini-2.5-pro-exp-03-25:free", // Optional if default is set messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "What is the capital of France?" } ], temperature: 0.7 // Optional, defaults to 1.0 } });

对于带有图像的多模式消息:

use_mcp_tool({ server_name: "openrouter", tool_name: "mcp_openrouter_chat_completion", arguments: { model: "anthropic/claude-3.5-sonnet", messages: [ { role: "user", content: [ { type: "text", text: "What's in this image?" }, { type: "image_url", image_url: { url: "https://example.com/image.jpg" } } ] } ] } });
-
security - not tested
F
license - not found
-
quality - not tested

通过 OpenRouter.ai 多样化的模型生态系统提供聊天和图像分析功能,实现文本对话和使用各种 AI 模型的强大的多模式图像处理。

  1. Features
    1. What's New in 1.5.0
      1. Installation
        1. Option 1: Install via npm
        2. Option 2: Run via Docker
      2. Quick Start Configuration
        1. Prerequisites
        2. MCP Configuration Options
      3. Examples
        1. Dependencies
          1. Available Tools
            1. mcp_openrouter_chat_completion
          ID: dn5za2ql2h