langchain-mcp-adapters  by langchain-ai

LangChain tool adapter for Anthropic's Model Context Protocol (MCP)

created 5 months ago
2,429 stars

Top 19.5% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This library provides adapters to integrate Model Context Protocol (MCP) tools with LangChain and LangGraph, enabling seamless use of external services within agentic workflows. It targets developers building complex, multi-tool AI agents who need to leverage existing MCP-compatible services or create new ones. The primary benefit is simplifying the connection and management of diverse tools for LangChain agents.

How It Works

The library acts as a bridge, converting MCP tools into LangChain-compatible Tool objects. It offers a client implementation that can connect to multiple MCP servers via different transport protocols (stdio, SSE). This allows agents to discover and utilize tools exposed by these servers, facilitating dynamic tool loading and management within LangChain's agentic framework.

Quick Start & Requirements

  • Install: pip install langchain-mcp-adapters
  • Prerequisites: Python 3.x, LangChain, LangGraph, OpenAI API key (for example).
  • Setup: Requires running MCP servers (examples provided for math_server.py and weather_server.py).
  • Docs: LangGraph API server guide

Highlighted Details

  • Converts MCP tools into LangChain tools for use with LangGraph agents.
  • Supports connecting to multiple MCP servers simultaneously.
  • Demonstrates integration with LangGraph's create_react_agent.
  • Provides examples for stdio and sse transport protocols.

Maintenance & Community

  • Developed by langchain-ai.
  • No specific community links (Discord/Slack) or roadmap mentioned in the README.

Licensing & Compatibility

  • License: Not explicitly stated in the README.
  • Compatibility: Designed for use with LangChain and LangGraph. Commercial use depends on the underlying LangChain/LangGraph licenses and any unstated license for this adapter library.

Limitations & Caveats

The README requires users to manually update file paths for local server execution. The library's own licensing is not specified, which could impact commercial adoption.

Health Check
Last commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
11
Issues (30d)
20
Star History
889 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Didier Lopes Didier Lopes(Founder of OpenBB), and
1 more.

langgraph by langchain-ai

2.1%
17k
Agent orchestration framework for building controllable agents
created 2 years ago
updated 1 day ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Carol Willing Carol Willing(Core Contributor to CPython, Jupyter), and
38 more.

langchain by langchain-ai

0.4%
113k
Framework for building LLM-powered applications
created 2 years ago
updated 1 day ago
Feedback? Help us improve.