mcpField
L
LLM Bridge MCP

LLM Bridge MCP

本地服务
github.com/sjquantAI 与智能体666 周前更新

关于 LLM Bridge MCP

LLM Bridge MCP 是一款 MCP 服务,让 AI Agent 通过统一接口调用多个 LLM 提供商。它支持配置生成参数,并跟踪使用情况指标。

主要功能

  1. 01统一访问多个 LLM 提供商
  2. 02支持 OpenAI、Anthropic、Google 和 DeepSeek
  3. 03可配置 temperature 和令牌上限
  4. 04通过 Pydantic AI 进行类型校验
  5. 05使用情况跟踪与指标

适用场景

  1. 01在 AI Agent 中切换模型
  2. 02通过一个工具调用不同 LLM 提供商

MCP 相关

该服务向 MCP 客户端提供 run_llm 工具,支持选择模型并传入提示词及生成参数。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"llm-bridge": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
启动命令npx -y @smithery/cli

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@smithery/cli

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

LLM Bridge MCP

smithery badge

LLM Bridge MCP 让 AI Agent 能够通过标准化接口与多个大模型交互。它利用 Message Control Protocol(MCP)实现对不同 LLM 提供商的无缝访问,方便在不同模型之间切换,或在同一个应用中使用多个模型。

LLM Bridge MCP server

功能

  • 为多个 LLM 提供商提供统一接口:
    • OpenAI(GPT 模型)
    • Anthropic(Claude 模型)
    • Google(Gemini 模型)
    • DeepSeek
    • ...
  • 使用 Pydantic AI 构建,确保类型安全和验证
  • 支持自定义 temperature 和 max tokens 等参数
  • 提供用量跟踪和指标

工具

该服务实现了以下工具:

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:要生成的最大 token 数量
  • 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 文件。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。