What is Mcp Langchain Bridge?
Mcp Langchain Bridge is a Python library that exposes any LangChain chain, agent, or tool—such as RAG chains, agentic workflows, or custom tools—as a Model Context Protocol (MCP) server. It is designed for developers who want to make existing LangChain orchestration logic callable from any MCP client, including Claude Desktop and Cursor.
How to use Mcp Langchain Bridge?
Import the bridge module from mcp_langchain_bridge, then call bridge.create_server() with a server name, a list of LangChain BaseTool instances (or any subclass), and optional retry and timeout settings. The server is started with .run().
Key features of Mcp Langchain Bridge
- Auto‑schema: each LangChain tool’s
args_schema becomes the MCP tool’s input schema (Pydantic v2).
- Configurable retry/backoff per tool with circuit‑breaker behavior.
- Per‑tool execution timeout, configurable via decorator or environment variable.
- OpenTelemetry tracing on every tool call; integrates with LangSmith when
LANGSMITH_API_KEY is set.
- Output validation against Pydantic schemas before returning results to the agent.
Use cases of Mcp Langchain Bridge
- Make a LangChain retrieval‑augmented generation (RAG) chain available as an MCP tool in Claude Desktop without rewriting.
- Expose LangChain agents (e.g., tool‑using agents) to any MCP‑compatible IDE or chat interface.
- Wrap custom LangChain tools with retry and timeout policies for production‑grade MCP deployments.
- Bridge LangGraph state machines into the MCP ecosystem without altering the graph logic.
- Add telemetry and output validation to existing LangChain tool sets used via MCP.
コメント