MCP to LangChain/LangGraph Adapter

by SDCalvo

312 downloads
Not rated
GitHub

About

Addapter that turns MCP server tools into langchain usable tools

Details

Author
SDCalvo
Downloads
312
Categories
AI

- Connects to any MCP server via stdio transport.
- Automatically discovers and converts MCP tools to LangChain BaseTool.
- Supports both LangChain agents and LangGraph react agents.
- Manages conversation history with LangGraph memory checkpoints.
- Allows custom environment variables per server process.

Install the required Python packages (mcp, langchain, langchain‑openai, langgraph, python‑dotenv). Create an MCP server script (e.g., simple_server.py), then instantiate MCPAdapter with the script path. Call get_tools() to retrieve LangChain tools and integrate them into LangChain agents or LangGraph react agents.

MCP to LangChain/LangGraph Adapter

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.

Table of Contents

- Introduction - Installation - Getting Started - Setting Up the MCP Server - Connecting to the MCP Server - Using MCP Tools with LangChain - Using MCP Tools with LangGraph - API Reference - MCPAdapter - MCPToolWrapper - Utility Functions - Examples - Basic Usage - Integration with LangChain Agents - Integration with LangGraph Agents - Troubleshooting - Contributing

Introduction

The MCP to LangChain/LangGraph Adapter bridges the gap between MCP servers, which provide various tools through a standardized interface, and LangChain/LangGraph, popular frameworks for building applications with large language models. This adapter enables you to: - Connect to an MCP server - Discover available tools - Convert MCP tools to LangChain-compatible tools - Use these tools in LangChain agents, chains, and LangGraph agents

Installation

To use this adapter, you need to have the necessary packages installed: ```bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.