This repository provides a LangChain client for the Model Context Protocol, enabling seamless connection to MCP servers. It converts MCP tools for use with LangChain, facilitating dynamic conversations.
This LangChain MCP Client facilitates seamless integration with Model Context Protocol (MCP) servers, enabling LangChain ReAct Agents to leverage external tools. It connects to any MCP server, supports any LangChain-compatible LLM, and allows dynamic conversations via CLI.
The client utilizes convert_mcp_to_langchain_tools()
from the langchain_mcp_tools
library to initialize multiple MCP servers in parallel and convert their tools into a list of LangChain-compatible tools.
Installation: Requires Python 3.11 or higher. Install using pip install langchain_mcp_client
.
Configuration: Create a .env
file for LLM API keys. Configure LLM parameters, MCP servers, and example queries in llm_mcp_config.json5
.
Usage: Run the client with langchain-mcp-client
.
The initial code is derived from hideya/mcp-client-langchain-py (MIT License).
datalayer/langchain-mcp-client
February 12, 2025
March 17, 2025
Python