首页
学习
活动
专区
圈层
工具
发布
MCP广场 >详情页
LLM桥接-MCP2026-06-02279分享添加福利群:解决AI开发者的「MCP实战痛点」
启用AI代理通过标准化接口与多个大语言模型提供商(OpenAI、Anthropic、Google、DeepSeek)进行交互,从而方便在模型之间切换或在同一应用中使用多个模型。
By sjquant
2026-06-02279
github
详情内容

LLM Bridge MCP

smithery badge

LLM Bridge MCP 允许 AI 代理通过标准化接口与多个大型语言模型进行交互。它利用消息控制协议(MCP)提供对不同 LLM 提供商的无缝访问,使得在模型之间切换或在同一应用程序中使用多个模型变得容易。

特性

  • 统一接口支持多个 LLM 提供商:
    • OpenAI (GPT 模型)
    • Anthropic (Claude 模型)
    • Google (Gemini 模型)
    • DeepSeek
    • ...
  • 使用 Pydantic AI 构建以确保类型安全和验证
  • 支持自定义参数如温度和最大令牌数
  • 提供使用跟踪和指标

工具

服务器实现了以下工具:

run_llm(
    prompt: str,
    model_name: KnownModelName = "openai:gpt-4o-mini",
    temperature: float = 0.7,
    max_tokens: int = 8192,
    system_prompt: str = "",
) -> LLMResponse
  • prompt: 发送给 LLM 的文本提示
  • model_name: 要使用的特定模型(默认: "openai:gpt-4o-mini")
  • temperature: 控制随机性(0.0 到 1.0)
  • max_tokens: 生成的最大令牌数
  • system_prompt: 可选的系统提示,用于指导模型的行为

安装

通过 Smithery 安装

要通过 Smithery自动为 Claude Desktop 安装 llm-bridge-mcp:

npx -y @smithery/cli install @sjquant/llm-bridge-mcp --client claude

手动安装

  1. 克隆仓库:
git clone https://github.com/yourusername/llm-bridge-mcp.git
cd llm-bridge-mcp
  1. 安装 uv(如果尚未安装):
# On macOS
brew install uv

# On Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

配置

在根目录创建一个 .env 文件,并填写您的 API 密钥:

OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GOOGLE_API_KEY=your_google_api_key
DEEPSEEK_API_KEY=your_deepseek_api_key

使用

与 Claude Desktop 或 Cursor 一起使用

在您的 Claude Desktop 配置文件或 .cursor/mcp.json 中添加一个服务器条目:

"mcpServers": {
  "llm-bridge": {
    "command": "uvx",
    "args": [
      "llm-bridge-mcp"
    ],
    "env": {
      "OPENAI_API_KEY": "your_openai_api_key",
      "ANTHROPIC_API_KEY": "your_anthropic_api_key",
      "GOOGLE_API_KEY": "your_google_api_key",
      "DEEPSEEK_API_KEY": "your_deepseek_api_key"
    }
  }
}

故障排除

常见问题

1. "spawn uvx ENOENT" 错误

当系统无法在您的 PATH 中找到 uvx 可执行文件时会发生此错误。解决方法如下:

解决方案:使用 uvx 的完整路径

找到您的 uvx 可执行文件的完整路径:

# On macOS/Linux
which uvx

# On Windows
where.exe uvx

然后更新您的 MCP 服务器配置以使用完整路径:

"mcpServers": {
  "llm-bridge": {
    "command": "/full/path/to/uvx",  // Replace with your actual path
    "args": [
      "llm-bridge-mcp"
    ],
    "env": {
      // ... your environment variables
    }
  }
}

许可证

本项目根据 MIT 许可证授权 - 详情请参阅 LICENSE 文件。

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档