datalayer

๐Ÿฆœ ๐Ÿ”— LangChain MCP Client

Community datalayer
Updated

๐Ÿฆœ๐Ÿ”— LangChain Model Context Protocol (MCP) Client

Datalayer

Become a Sponsor

๐Ÿฆœ ๐Ÿ”— LangChain MCP Client

Github Actions StatusPyPI - Version

This simple Model Context Protocol (MCP) client demonstrates the use of MCP server tools by LangChain ReAct Agent.

  • ๐ŸŒ Seamlessly connect to any MCP servers.
  • ๐Ÿค– Use any LangChain-compatible LLM for flexible model selection.
  • ๐Ÿ’ฌ Interact via CLI, enabling dynamic conversations.

Conversion to LangChain Tools

It leverages a utility function convert_mcp_to_langchain_tools(). This function handles parallel initialization of specified multiple MCP servers and converts their available tools into a list of LangChain-compatible tools (List[BaseTool]).

Installation

The python version should be 3.11 or higher.

pip install langchain_mcp_client

Configuration

Create a .env file containing all the necessary API_KEYS to access your LLM.

Configure the LLM, MCP servers, and prompt example in the llm_mcp_config.json5 file:

  1. LLM Configuration: Set up your LLM parameters.
  2. MCP Servers: Specify the MCP servers to connect to.
  3. Example Queries: Define example queries that invoke MCP server tools. Press Enter to use these example queries when prompted.

Usage

Below an example with a Jupyter MCP Server:

Check the llm_mcp_config.json5 configuration (commands depends if you are running on Linux or macOS/Windows).

# Start jupyterlab.
make jupyterlab
# Launch the CLI.
make cli

This is a prompt example.

create matplolib examples with many variants in jupyter

Credits

This initial code of this repo is taken from hideya/mcp-client-langchain-py (MIT License) and from langchain_mcp_tools (MIT License).

MCP Server ยท Populars

MCP Server ยท New

    reticlehq

    reticle

    AI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.

    Community reticlehq
    tubeagentkit

    YouTube MCP Server: Transcripts, Search, Channels & Playlists

    YouTube MCP server: get YouTube video transcripts, search YouTube, browse channels and playlists from Claude, ChatGPT, Cursor and VS Code. Remote, free tier.

    Community tubeagentkit
    lrvx

    lrvx

    Framework for building trading systems

    Community lrvx
    koda-ai-studio

    agent-bom

    Open security scanner and self-hosted control plane for AI, MCP, and cloud. One evidence model โ€” run scans in your environment, centralize findings, govern in your VPC.

    Community koda-ai-studio
    DenRakEiw

    Scumble

    Free, open-source desktop editor for AI inpainting: select, prompt, get a colour-matched layer. FLUX 3 Image, FLUX.2, GPT Image, Nano Banana, Seedream and Qwen through your API key or your own ComfyUI. Layers, PSD export, MCP.

    Community DenRakEiw