OpenRouter MCP 服务器
模型上下文协议 (MCP) 服务器,可与 OpenRouter.ai 丰富的模型生态系统无缝集成。通过统一、类型安全的接口访问各种 AI 模型,该接口内置缓存、速率限制和错误处理功能。
特征
- 模型访问
- 直接访问所有 OpenRouter.ai 模型
- 自动模型验证和能力检查
- 默认模型配置支持
- 性能优化
- 智能模型信息缓存(1小时有效)
- 自动速率限制管理
- 失败请求的指数退避
- 统一响应格式
- 所有响应的
ToolResult
结构一致 - 使用
isError
标志清除错误标识 - 带有上下文的结构化错误消息
- 所有响应的
安装
配置
先决条件
- 从OpenRouter Keys获取您的 OpenRouter API 密钥
- 选择默认模型(可选)
环境变量
设置
添加到您的 MCP 设置配置文件( cline_mcp_settings.json
或claude_desktop_config.json
):
响应格式
所有工具都以标准化结构返回响应:
成功案例:
错误示例:
可用工具
聊天完成
向 OpenRouter.ai 模型发送消息:
搜索模型
搜索并过滤可用型号:
获取模型信息
获取特定型号的详细信息:
验证模型
检查模型 ID 是否有效:
错误处理
服务器提供带有上下文信息的结构化错误:
常见错误类别:
Validation Error
:输入参数无效API Error
:OpenRouter API 通信问题Rate Limit
:请求节流检测Internal Error
:服务器端处理失败
处理响应:
发展
有关以下方面的详细信息,请参阅CONTRIBUTING.md :
- 开发设置
- 项目结构
- 功能实现
- 错误处理指南
- 工具使用示例
变更日志
查看CHANGELOG.md了解最新更新,包括:
- 统一响应格式实现
- 增强的错误处理系统
- 类型安全接口改进
执照
该项目根据 Apache License 2.0 获得许可 - 有关详细信息,请参阅LICENSE文件。
You must be authenticated.
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.
提供与OpenRouter.ai的集成,允许通过统一的界面访问各种AI模型。
Related MCP Servers
- -securityAlicense-qualityThis server facilitates the invocation of AI models from providers like Anthropic, OpenAI, and Groq, enabling users to manage and configure large language model interactions seamlessly.Last updated -9PythonMIT License
- -securityAlicense-qualityA proxy server that bridges AI agents and external APIs by dynamically translating OpenAPI specifications into standardized MCP tools, enabling seamless interaction without custom integration code.Last updated -39PythonMIT License
- -securityAlicense-qualityEnables AI agents to interact with multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek) through a standardized interface, making it easy to switch between models or use multiple models in the same application.Last updated -3PythonMIT License
- AsecurityAlicenseAqualityAn AI router that connects applications to multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek, Ollama, etc.) with smart model orchestration capabilities, enabling dynamic switching between models for different reasoning tasks.Last updated -3811TypeScriptMIT License