hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
使用 LangChain / Python 的 MCP 客户端
这个简单的模型上下文协议 (MCP)客户端演示了 LangChain ReAct Agent 对 MCP 服务器工具的使用。
它利用了langchain_mcp_tools
中的实用函数convert_mcp_to_langchain_tools()
。
此函数处理指定的多个 MCP 服务器的并行初始化,并将它们可用的工具转换为与 LangChain 兼容的工具列表 ( List[BaseTool] )。
目前支持 Anthropic、OpenAI 和 Groq 的 LLM。
此 MCP 客户端的 TypeScript 版本可在此处获取
先决条件
- Python 3.11+
- [可选] 安装
uv
(uvx
)来运行基于 Python 包的 MCP 服务器 - [可选] npm 7+ (
npx
)用于运行基于 Node.js 包的 MCP 服务器 - 根据需要从Anthropic 、 OpenAI和/或Groq获取 API 密钥
设置
- 安装依赖项:Copy
- 设置 API 密钥:Copy
- 根据需要更新
.env
。 .gitignore
配置为忽略.env
以防止意外提交凭据。
- 根据需要更新
- 根据需要配置 LLM 和 MCP 服务器设置
llm_mcp_config.json5
。- MCP 服务器的配置文件格式遵循与Claude for Desktop相同的结构,但有一点不同:键名
mcpServers
已更改为mcp_servers
,以遵循 JSON 配置文件中常用的 snake_case 约定。 - 文件格式为JSON5 ,其中允许使用注释和尾随逗号。
- 该格式进一步扩展,用相应环境变量的值替换
${...}
符号。 - 将所有凭证和私人信息保存在
.env
文件中,并根据需要使用${...}
符号引用它们。
- MCP 服务器的配置文件格式遵循与Claude for Desktop相同的结构,但有一点不同:键名
用法
运行应用程序:
Copy
第一次运行需要一段时间。
以详细模式运行:
Copy
查看命令行选项:
Copy
在提示符下,您只需按 Enter 即可使用执行 MCP 服务器工具调用的示例查询。
可以在llm_mcp_config.json5
中配置示例查询
This server cannot be installed
该服务器有助于调用来自 Anthropic、OpenAI 和 Groq 等提供商的 AI 模型,使用户能够无缝管理和配置大型语言模型交互。
Related Resources
Appeared in Searches
- A server for Minecraft MCP gameplay or resources
- Resources and guidance for coding, developing, and training AI models
- Developing AI-Powered Mobile and Web Applications by Combining and Transferring Knowledge from Open Source AI Models
- HubSpot - Marketing and CRM Software
- Finding tasks for large language model agents