langchain-mcp-adapters  by langchain-ai

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

Created 7 months ago
2,804 stars

Top 17.0% on SourcePulse

GitHubView on GitHub
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

1 week ago

Responsiveness

1 day

Pull Requests (30d)
11
Issues (30d)
30
Star History
209 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.