MCP Servers

A collection of Model Context Protocol servers, templates, tools and more.

M
MCP Demo Langchain

Agentic AI demo showcasing custom MCP servers integrated with a LangGraph ReAct agent using LangChain and UV.

Created 1/29/2026
Updated 26 days ago
Repository documentation and setup instructions

🧩 MCP Demo with LangChain, LangGraph & UV

This project demonstrates how to build custom MCP (Model Context Protocol) servers and integrate them with a LangGraph ReAct agent using LangChain MCP adapters. All dependencies are managed using the UV package manager.


🖼️ MCP Host–Server Architecture

MCP Host and Server

What this shows:

  • An MCP Host (Claude, Cursor, or your own app) runs MCP clients.
  • Each MCP client maintains a 1:1 JSON-RPC connection with an MCP server.
  • MCP servers act as adapters to:
    • Private APIs
    • Databases
    • Public web APIs

In this project, the LangGraph agent acts as the MCP host.


🖼️ MCP Servers, Clients & Agent Interaction

MCP Servers and Clients

Explanation:

  • Each MCP server can expose multiple tools.
  • MCP clients live inside the host application.
  • The LangGraph ReAct agent dynamically loads MCP tools and decides when to invoke them.
  • Your Python MCP client uses load_mcp_tools internally via adapters.

This maps directly to:

  • mathserver.py → Math tools
  • weather.py → Weather tool

🖼️ Model Context Protocol (MCP) Flow

MCP Flow

Flow explained step-by-step:

  1. User asks a question
  2. LLM reasons inside the agent
  3. MCP Client sends a standardized request
  4. MCP Server fetches or executes logic
  5. Data is returned back through MCP
  6. Agent responds with final output

📁 Project Structure

mcp-demo-langchain/
│
├── client.py            # MCP client + LangGraph ReAct agent
├── mathserver.py        # Math MCP server (stdio)
├── weather.py           # Weather MCP server (streamable-http)
│
├── requirements.txt
├── pyproject.toml
├── uv.lock
├── README.md
├── .gitignore
├── .env
└── .venv/

⚙️ Setup Using UV

pip install uv
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt

🚀 Running the Project

Start Weather MCP Server

python weather.py

Run MCP Client & Agent

python client.py

🧪 Example Outputs

Math

User: what's (3 + 5) x 12?
Output: 96

Weather

User: what is the weather in California?
Output: It's always raining in California

✨ Key Takeaways

  • MCP standardizes tool communication for LLMs
  • MCP servers are reusable, language-agnostic adapters
  • LangGraph enables structured agent reasoning
  • UV provides fast, reproducible dependency management

📄 License

For educational and demonstration purposes.

Quick Setup
Installation guide for this server

Install Package (if required)

uvx mcp-demo-langchain

Cursor configuration (mcp.json)

{ "mcpServers": { "ram677-mcp-demo-langchain": { "command": "uvx", "args": [ "mcp-demo-langchain" ] } } }