MCP 服务器
MCP 服务器设置指南
让任意 MCP 客户端实时访问 UnoRouter:搜索模型目录、查询价格,并通过 unorouter-mcp 服务器与任意模型对话。
概览
unorouter-mcp 是一个 npm 包,以 stdio 方式运行 MCP 服务器,并以 com.unorouter/mcp 的名称收录在官方 MCP 注册表中。它提供三个工具:search_models 过滤实时目录并支持 free_only 选项;get_pricing 返回每 100 万 token 的美元标价;chat 向任意模型发送提示词。源码位于 github.com/0-don/unorouter-mcp。
快速配置
将这些值填入客户端。登录后会自动填入你的密钥。
text
基础 URL: https://api.unorouter.com/v1
API 密钥: YOUR_API_KEY兼容性
Chat Completions
逐步设置
- 1获取 API 密钥
在 unorouter.com/token 创建密钥。服务器从环境变量 UNOROUTER_API_KEY 读取密钥。UNOROUTER_BASE_URL 是可选的端点覆盖。
bashUNOROUTER_API_KEY=YOUR_API_KEY UNOROUTER_BASE_URL=https://api.unorouter.com/v1 - 2把服务器添加到 Claude Desktop
把这个配置块加入 Claude Desktop 的配置文件。npx 会在首次运行时拉取 unorouter-mcp,无需提前安装。
json{ "mcpServers": { "unorouter": { "command": "npx", "args": ["-y", "unorouter-mcp"], "env": { "UNOROUTER_API_KEY": "YOUR_API_KEY" } } } } - 3或在 Claude Code 中注册
一条命令即可携带密钥注册服务器。
bashclaude mcp add unorouter -e UNOROUTER_API_KEY=YOUR_API_KEY -- npx -y unorouter-mcp - 4使用这些工具
让客户端查找模型、比较价格或向模型发送提示词,它会按需调用 search_models、get_pricing 和 chat。任何支持 stdio 的 MCP 客户端都能使用。
textsearch_models filter the live catalog (free_only option) get_pricing USD list prices per 1M tokens chat send a prompt to any model
推荐模型
在这里表现良好的免费模型。把任意模型 ID 粘贴到客户端即可。
dracarys-llama-3.1-70b-instruct:freegemini-flash-latest:freegemini-2.5-flash-lite:freeseed-oss-36b:freegpt-4.1-nano:free
注意事项
- 带 :free 后缀的模型完全免费。每个免费模型约有每分钟 1 次请求的速率限制。
- UNOROUTER_API_KEY 为必填。只有在把服务器指向其他端点时才需要设置 UNOROUTER_BASE_URL。
- 支持注册表的 MCP 客户端可以直接用注册名 com.unorouter/mcp 安装该服务器,而不必使用 npx 命令。