MCP Catalogs
首页langchain-mcp-tools-py screenshot

langchain-mcp-tools-py

by hideya·28·综合分 44

将 MCP 服务器工具转换为 LangChain 兼容工具的 Python 实用程序,支持本地和远程服务器。

ai-llmdeveloper-toolsproductivity
10
Forks
2
活跃 Issue
2 个月前
最近提交
2 天前
收录于

概述

一个轻量级 Python 库,简化了将 MCP 服务器工具集成到 LangChain 应用中的过程。它提供了一个实用函数,可以并行初始化多个 MCP 服务器并将它们的工具转换为 LangChain 兼容的工具。该库支持各种 MCP 服务器配置,包括本地命令式服务器和远程 HTTP/SSE/WebSocket 服务器。但是,它只支持工具调用的文本结果,并且不实现其他 MCP 功能,如资源或提示。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:将 MCP 工具集成到 LangChain 智能体中
:使用 Python 处理本地 MCP 服务器
:通过 HTTP/WebSocket 连接到远程 MCP 服务器
:这个库支持所有 MCP 功能吗?
:我可以使用此库处理非文本工具结果吗?

什么时候选它

当你需要一个简单的方法将MCP服务器与LangChain集成,并且只需要基本工具功能时,选择这个。

什么时候不要选它

如果你需要完整的MCP协议支持,包括资源、提示或多种内容类型(图像等)的结果,不要选择这个。

此 server 暴露的工具

从 README 抽取出 1 个工具
  • convert_mcp_to_langchain_toolsconvert_mcp_to_langchain_tools(mcp_servers)

    Converts MCP server configurations to LangChain tools by initializing servers and wrapping their tools.

说明:The README focuses on a utility function that converts MCP servers to LangChain tools, but doesn't explicitly list the specific MCP tools that would be exposed. The actual tools would depend on the MCP servers configured.

可对比工具

langchain-mcp-adaptersmcp-chat

安装

pip install langchain-mcp-tools

Claude Desktop 配置

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    },
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"]
    }
  }
}

FAQ

这个库支持所有 MCP 功能吗?
不,这个库仅支持 MCP 工具。资源和提示等其他 MCP 功能尚未实现。
我可以使用此库处理非文本工具结果吗?
目前,仅支持工具调用的文本结果。该库会过滤并仅使用文本内容。

langchain-mcp-tools-py 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。