Get the FREE Ultimate OpenClaw Setup Guide →

langchain

Model Context Protocol tool support for LangChain

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio rectalogic-langchain-mcp uv run tests/demo.py Read and summarize the file ./LICENSE \
  --env GROQ_API_KEY="Your Groq API key for demo execution (optional for local testing)"

How to use

This MCP server exposes LangChain-compatible tool calling through the Model Context Protocol. It uses a LangChain MCP Toolkit that integrates with an mcp.ClientSession. After initializing the toolkit, you can call toolkit.get_tools() to retrieve the list of LangChain tools (BaseTool instances) available for the current session. Use these tools to perform schema-aware, model-context-driven actions within your application. The included demo shows how to execute a LangChain-based workflow against a Groq-backed environment by running a Python script through uv, which demonstrates file-reading and summarization capabilities via MCP-tooling integration.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • uv (the Python execution runner used in the example) installed and available in PATH
  • Internet access to install Python packages

Installation steps:

  1. Install the MCP package from PyPI (or install from source if you have a clone):

    • pip install langchain-mcp
  2. (Optional) If you want to run the included demo exactly as shown, ensure you have a Groq API key for testing. Set it in your environment:

    • export GROQ_API_KEY=your_key_here
  3. Run the demo using uv (as shown in the README example):

    • uv run tests/demo.py "Read and summarize the file ./LICENSE"
  4. If you’re developing locally, install dependencies and run the script directly with Python as an alternative:

    • python -m pip install -r requirements.txt # if a requirements file is provided
    • python tests/demo.py "Read and summarize the file ./LICENSE"

Additional notes

Notes and tips:

  • The demo relies on GROQ for the data source. You can either provide a valid GROQ_API_KEY or adapt the demo to a different data source.
  • The MCP setup shown uses the uv runner to execute a Python script that exercises the LangChain MCP toolkit; ensure your environment has access to the script path used in the command.
  • If you encounter issues with tool discovery, verify that the LangChain MCP Toolkit is correctly installed and that the Python path includes the project modules.
  • Environment variables used in the example are placeholder suggestions; replace or extend with variables relevant to your environment (e.g., API keys, endpoint URLs).
  • This package is aligned with the LangChain MCP ecosystem; for newer adapters or official implementations, consider alternative packages such as langchain-mcp-adapters.

Related MCP Servers

Sponsor this space

Reach thousands of developers