LLM Bridge MCP 允许AI代理通过标准化接口与多个大型语言模型进行交互。它利用消息控制协议(MCP)提供对不同LLM提供商的无缝访问,使得在应用程序中切换模型或使用多个模型变得容易。
<a href="https://glama.ai/mcp/servers/@sjquant/llm-bridge-mcp"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=1761773930,2827461902&fm=3081&app=3_081&f=PNG?w=760&h=400" alt="LLM Bridge MCP 服务器" /> </a>该服务器实现了以下工具:
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自动安装llm-bridge-mcp:
npx -y @smithery/cli install @sjquant/llm-bridge-mcp --client claude
git clone https://github.com/yourusername/llm-bridge-mcp.git
cd llm-bridge-mcp
# 在macOS上
brew install uv
# 在Linux上
curl -LsSf https://astral.sh/uv/install.sh | sh
# 在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/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"
}
}
}
当系统无法在PATH中找到uvx可执行文件时会出现此错误。解决方法:
解决方案:使用uvx的完整路径
查找uvx可执行文件的完整路径:
# 在macOS/Linux上
which uvx
# 在Windows上
where.exe uvx
然后更新您的MCP服务器配置以使用完整路径:
"mcpServers": {
"llm-bridge": {
"command": "/full/path/to/uvx", // 替换为您实际的路径
"args": [
"llm-bridge-mcp"
],
"env": {
// ... 您的环境变量
}
}
}
本项目根据MIT许可证发布 - 查看LICENSE文件获取详情。