langchain-mcp-adapters  by langchain-ai

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

Created 1 year ago
3,380 stars

Top 14.1% 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

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
4
Issues (30d)
6
Star History
96 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Kent Dodds Kent Dodds(Cofounder of Remix), and
10 more.

agentic by transitive-bullshit

0.0%
18k
AI agent stdlib for LLM-based TypeScript tooling
Created 3 years ago
Updated 2 weeks ago
Starred by Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), and
9 more.

python-sdk by modelcontextprotocol

0.5%
22k
Python SDK for Model Context Protocol (MCP) servers/clients
Created 1 year ago
Updated 1 day ago
Feedback? Help us improve.