MCP to LangChain/LangGraph Adapter logo

MCP to LangChain/LangGraph Adapter

by SDCalvo

This project provides an adapter that allows you to use MCP (Multi-modal Conversational Procedure) server tools in LangChain and LangGraph applications. With this adapter, you can seamlessly integrate MCP's tools into your AI application pipelines.

View on GitHub

Last updated: N/A

What is MCP to LangChain/LangGraph Adapter?

The MCP to LangChain/LangGraph Adapter bridges the gap between MCP servers and LangChain/LangGraph, enabling the use of MCP tools within these frameworks.

How to use MCP to LangChain/LangGraph Adapter?

To use the adapter, install the required packages, set up an MCP server, connect to the server using the MCPAdapter class, retrieve available tools, and then use these tools in LangChain or LangGraph agents and chains.

Key features of MCP to LangChain/LangGraph Adapter

  • Connect to an MCP server

  • Discover available tools

  • Convert MCP tools to LangChain-compatible tools

  • Use tools in LangChain agents, chains, and LangGraph agents

Use cases of MCP to LangChain/LangGraph Adapter

  • Integrating MCP tools into LangChain agents

  • Integrating MCP tools into LangGraph agents

  • Building conversational AI applications with MCP

  • Extending LangChain/LangGraph functionality with external tools

FAQ from MCP to LangChain/LangGraph Adapter

What is an MCP server?

An MCP (Multi-modal Conversational Procedure) server provides various tools through a standardized interface.

What packages do I need to install?

You need to install mcp, langchain, langchain-openai, langgraph, and python-dotenv.

How do I set up an MCP server?

You need to create an MCP server script that exposes tools using the mcp library.

How do I connect to the MCP server?

You can use the MCPAdapter class to connect to the MCP server by providing the path to the server script.

How do I use the tools in LangChain/LangGraph?

Once you have the tools, you can use them in LangChain agents, chains, or LangGraph agents by passing them to the agent constructor or chain definition.