MCP工具转换服务

提供MCP工具到LangChain工具的自动转换服务,简化开发流程。

  • by vkeerthi1
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 vkeerthi1/LangChain_MCP_adapter

使用说明

工作GITHUB MCP代码

  • HTTP方式与代码


带MCP适配器-自动转换

tools=等待load_mcp_tools(会话)#✅ MCP → LangChain转换完成!

无适配器(手动方式):

手动转换-您编写包装器

for t in mcp_tools:
    # Build Pydantic schema
    # Create wrapper function
    # Create StructuredTool
    # Add to tools list

load_mcp_tools在内部做什么:

Calls session.list_tools() to get MCP tool definitions
Converts JSON schemas → Pydantic models
Creates async wrapper functions that call session.call_tool()
Wraps in StructuredTool objects
Returns list of LangChain tools ready to use