Skip to main content
Glama
adityapal26may

mcp-langchain-agent

mcp-langchain-agent

A Model Context Protocol (MCP) server exposing a small set of tools, paired with a LangChain agent that uses those tools to complete multi-step tasks.

πŸ“Œ What this proves to a recruiter: I can build agentic systems β€” tool use, MCP, multi-step planning β€” extending the kind of MCP server work happening on Adobe AEM today.

What's in here

mcp-langchain-agent/
β”œβ”€β”€ mcp_server/          # MCP server that exposes tools via stdio
β”‚   β”œβ”€β”€ server.py        #   entrypoint, registers tools
β”‚   β”œβ”€β”€ tools.py         #   the actual tool implementations
β”‚   └── schemas.py       #   JSON schemas for tool inputs/outputs
β”œβ”€β”€ agent/
β”‚   β”œβ”€β”€ client.py        #   LangChain agent that connects to the MCP server
β”‚   └── chains.py        #   reusable prompt/chain definitions
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_server.py
β”‚   └── test_agent.py
└── examples/
    └── run_demo.py      #   end-to-end demo of the agent solving a task

Related MCP server: mcp-rag-server

The tools

The MCP server exposes three tools an LLM can call:

Tool

What it does

search_docs(query, top_k)

BM25-ish keyword search over a local corpus of markdown notes

get_doc(doc_id)

Fetch the full text of a doc by id

summarize(doc_id, max_words)

Returns a short summary of a doc (LLM-backed)

The agent

The LangChain agent:

  1. Receives a user task in natural language (e.g. "Find what our handbook says about vacation policy and give me a 3-bullet summary")

  2. Decides which tools to call, in what order

  3. Calls the tools via the MCP client

  4. Synthesises the answer from the tool outputs

Powered by langchain-mcp-adapters so the MCP tools become LangChain Tool objects β€” no glue code.

Quickstart

Prerequisites

  • Python 3.11+

  • An OpenAI or Anthropic API key

Install

git clone https://github.com/adityapal26may/mcp-langchain-agent
cd mcp-langchain-agent
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

Configure

export OPENAI_API_KEY=sk-...
# or
export ANTHROPIC_API_KEY=sk-ant-...

Run the demo

python examples/run_demo.py

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LangChain Agent β”‚ ──────▢ β”‚  MCP Server (stdio)β”‚
β”‚   (client.py)    β”‚  tools  β”‚   (server.py)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  JSON   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β–²                              β”‚
        β”‚                              β–Ό
        β”‚                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                     β”‚  Tool Implementationsβ”‚
        β”‚                     β”‚   (tools.py)        β”‚
        β”‚                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                               β”‚
        └─────── synthesized answer β”€β”€β”€β”€β”˜

Why MCP

MCP is becoming the standard protocol for connecting LLMs to tools and data sources β€” Anthropic, OpenAI, and major IDE vendors all support it. Building a server + client pair here is a direct demonstration of:

  • Multi-step agentic reasoning

  • Tool schema design (JSON Schema for inputs)

  • Process-level service boundaries (the MCP server runs as a separate process)

Tech Stack

  • Python 3.11, FastAPI (for the HTTP wrapper demo)

  • LangChain (langchain, langchain-openai, langchain-anthropic)

  • MCP (mcp Python SDK, langchain-mcp-adapters)

  • rank-bm25 for keyword search

  • pytest for tests

Roadmap

  • Streaming token output from the agent

  • Persistent conversation memory

  • Observability: log every tool call + token usage

  • HTTP transport (in addition to stdio)

  • Eval suite: 20+ tasks with expected tool-call sequences

Author

Aditya Pal β€” @adityapal26may

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server implementation that provides tools for retrieving and processing documentation through vector search, enabling AI assistants to augment their responses with relevant documentation context
    19 npm
    265
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that indexes documents and serves relevant context to LLMs via Retrieval Augmented Generation (RAG).
    22 npm
    36
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for indexing, semantic search, and generation of multi-format documents. Exposes 13 tools over JSON-RPC 2.0 so an LLM can search your local PDF, Excel, and Word files, and create or edit Excel and Word documents.
    AGPL 3.0