🤖 跨LLM MCP服务器
从一个地方访问多个LLM API。 调用ChatGPT、Claude、DeepSeek、Gemini、Grok、Kimi、Perplexity、Mistral和拥抱面部推理路由器,并使用智能模型选择、偏好和提示日志记录。
一 MCP(模型上下文协议) 该服务器为Cursor和Claude Desktop等AI编码环境提供对多个大型语言模型API的统一访问。

为什么使用交叉LLM MCP?
- 🌐 9 LLM提供商 –ChatGPT、克劳德、DeepSeek、双子座、格鲁克、基米、困惑、米斯特拉尔、拥抱的脸
- 🎯 智能模型选择 基于标签的偏好(编码、商业、推理、数学、创意、一般)
- 📊 提示日志记录 –使用历史记录、统计数据和分析跟踪所有提示
- 💰 成本优化 –根据喜好选择旗舰或更便宜的型号
- ⚡ 轻松设置 –在Cursor中单击安装或简单的手动设置
- 🔄 呼叫所有LLM –同时获取所有提供商的响应
快速开始
准备好访问多个LLM了吗?几秒钟内安装:
在Cursor中安装(推荐):
或手动安装:
npm install -g cross-llm-mcp
# Or from source:
git clone https://github.com/JamesANZ/cross-llm-mcp.git
cd cross-llm-mcp && npm install && npm run build特性
🤖 个人LLM工具
call-chatgpt–OpenAI的ChatGPT APIcall-claude–Anthropic公司的Claude APIcall-deepseek–DeepSeek APIcall-gemini–谷歌Gemini APIcall-grok–xAI的Grok APIcall-kimi–Moonshot AI的Kimi APIcall-perplexity-困惑AI APIcall-mistral–Mistral AI APIcall-huggingface–拥抱面部推理路由器(兼容OpenAI的Hub型号)
🔄 组合工具
call-all-llms–以相同的提示呼叫所有LLMcall-llm–按名称呼叫特定提供商
⚙️ 首选项和型号选择
get-user-preferences–获取当前偏好set-user-preferences–设置默认模型、成本偏好和基于标签的偏好get-models-by-tag–按标签查找模型(编码、业务、推理、数学、创意、通用)
📝 提示日志记录
get-prompt-history–使用过滤器查看提示历史记录get-prompt-stats–获取有关提示日志的统计信息delete-prompt-entries–按条件删除日志条目clear-prompt-history–清除所有提示日志
安装
光标(单击一次)
单击上面的安装链接或使用:
cursor://anysphere.cursor-deeplink/mcp/install?name=cross-llm-mcp&config=eyJjcm9zcy1sbG0tbWNwIjp7ImNvbW1hbmQiOiJucHgiLCJhcmdzIjpbIi15IiwiY3Jvc3MtbGxtLW1jcCJdfX0=安装后,在Cursor设置中添加API键(请参阅下面的配置)。
手动安装
要求: Node.js 18+和npm
# Clone and build
git clone https://github.com/JamesANZ/cross-llm-mcp.git
cd cross-llm-mcp
npm install
npm run build克劳德桌面版
添加 claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json\ 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"cross-llm-mcp": {
"command": "node",
"args": ["/absolute/path/to/cross-llm-mcp/build/index.js"],
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here",
"ANTHROPIC_API_KEY": "your_anthropic_api_key_here",
"DEEPSEEK_API_KEY": "your_deepseek_api_key_here",
"GEMINI_API_KEY": "your_gemini_api_key_here",
"XAI_API_KEY": "your_grok_api_key_here",
"KIMI_API_KEY": "your_kimi_api_key_here",
"PERPLEXITY_API_KEY": "your_perplexity_api_key_here",
"MISTRAL_API_KEY": "your_mistral_api_key_here",
"HF_TOKEN": "your_huggingface_token_here"
}
}
}
}配置后重新启动Claude Desktop。
配置
API密钥
为要使用的LLM提供程序设置环境变量:
export OPENAI_API_KEY="your_openai_api_key"
export ANTHROPIC_API_KEY="your_anthropic_api_key"
export DEEPSEEK_API_KEY="your_deepseek_api_key"
export GEMINI_API_KEY="your_gemini_api_key"
export XAI_API_KEY="your_grok_api_key"
export KIMI_API_KEY="your_kimi_api_key"
export PERPLEXITY_API_KEY="your_perplexity_api_key"
export MISTRAL_API_KEY="your_mistral_api_key"
export HF_TOKEN="your_huggingface_token"
# Or: HUGGINGFACE_API_KEY (same as HF_TOKEN)
# Optional: DEFAULT_HUGGINGFACE_MODEL, HUGGINGFACE_INFERENCE_BASE_URL (default https://router.huggingface.co/v1)获取API密钥
- 开放人工智能: https://platform.openai.com/api-keys
- Anthropic: https://console.anthropic.com/
- 深度求索: https://platform.deepseek.com/
- 谷歌双子座: https://makersuite.google.com/app/apikey
- xAI Grok: https://console.x.ai/
- 月之暗面: https://platform.moonshot.ai/
- 困惑度: https://www.perplexity.ai/hub
- 米斯特拉尔: https://console.mistral.ai/
- 拥抱脸:使用创建细粒度令牌 推断 (无服务器/推理提供程序)访问 https://huggingface.co/settings/tokens。参见 聊天补全 支持的型号。
在本地(此MCP之外)运行Hub模型
使用示例
调用ChatGPT
从OpenAI获取回复:
{
"tool": "call-chatgpt",
"arguments": {
"prompt": "Explain quantum computing in simple terms",
"temperature": 0.7,
"max_tokens": 500
}
}呼唤拥抱的脸
通过推理路由器从Hub模型获取响应(model 是Hub仓库id,例如。 Qwen/Qwen2.5-7B-Instruct):
{
"tool": "call-huggingface",
"arguments": {
"prompt": "Reply with exactly: ok",
"model": "Qwen/Qwen2.5-7B-Instruct",
"temperature": 0.3,
"max_tokens": 32
}
}呼叫所有LLM
获取所有提供商的响应:
{
"tool": "call-all-llms",
"arguments": {
"prompt": "Write a short poem about AI",
"temperature": 0.8
}
}设置基于标签的首选项
自动为每种任务类型使用最佳模型:
{
"tool": "set-user-preferences",
"arguments": {
"defaultModel": "gpt-4o",
"costPreference": "cheaper",
"tagPreferences": {
"coding": "deepseek-r1",
"general": "gpt-4o",
"business": "claude-3.5-sonnet-20241022",
"reasoning": "deepseek-r1",
"math": "deepseek-r1",
"creative": "gpt-4o"
}
}
}获取提示历史记录
查看提示日志:
{
"tool": "get-prompt-history",
"arguments": {
"provider": "chatgpt",
"limit": 10
}
}型号标签
模型按其优势进行标记:
- 编程:
deepseek-r1,deepseek-coder,gpt-4o,claude-3.5-sonnet-20241022 - 业务:
claude-3-opus-20240229,gpt-4o,gemini-1.5-pro - 推理:
deepseek-r1,o1-preview,claude-3.5-sonnet-20241022 - 数学:
deepseek-r1,o1-preview,o1-mini - 创造性的:
gpt-4o,claude-3-opus-20240229,gemini-1.5-pro - 通用:
gpt-4o-mini,claude-3-haiku-20240307,gemini-1.5-flash
用例
- 多视角分析 –从多个法学硕士那里获得不同的观点
- 模型比较 –比较回答以了解优势和劣势
- 成本优化 –为每项任务选择最具成本效益的模型
- 质量保证 –来自多个模型的交叉引用响应
- 智能选择 -自动使用最佳模型进行编码、业务、推理等。
- 即时分析 –使用自动日志记录跟踪使用情况、成本和模式
技术细节
内置: Node.js、TypeScript、MCP SDK\ 依赖关系: @modelcontextprotocol/sdk, superagent, zod\ 平台: macOS、Windows、Linux
首选存储:
- Unix/macOS:
~/.cross-llm-mcp/preferences.json - 窗户:
%APPDATA%/cross-llm-mcp/preferences.json
提示日志存储:
- Unix/macOS:
~/.cross-llm-mcp/prompts.json - 窗户:
%APPDATA%/cross-llm-mcp/prompts.json
贡献
⭐ 如果这个项目对你有帮助,请在GitHub上加星! ⭐
欢迎投稿!请打开问题或提交拉取请求。
许可证
MIT许可证——见 许可证.md 了解详情。
支持
如果你觉得这个项目有用,可以考虑支持它:
⚡ 闪电网络
lnbc1pjhhsqepp5mjgwnvg0z53shm22hfe9us289lnaqkwv8rn2s0rtekg5vvj56xnqdqqcqzzsxqyz5vqsp5gu6vh9hyp94c7t3tkpqrp2r059t4vrw7ps78a4n0a2u52678c7yq9qyyssq7zcferywka50wcy75skjfrdrk930cuyx24rg55cwfuzxs49rc9c53mpz6zug5y2544pt8y9jflnq0ltlha26ed846jh0y7n4gm8jd3qqaautqa₿ 比特币: bc1ptzvr93pn959xq4et6sqzpfk2args22ewv5u2th4ps7shfaqrshe0xtp
※以太坊/EVM。: 0x42ea529282DDE0AA87B42d9E83316eb23FE62c3f
