langgraph-mcp

MCP.Pizza Chef: prsdm

LangGraph-MCP is a client that integrates the Model Context Protocol with LangGraph agents, enabling dynamic access to external tools, data sources, and APIs. It supports automatic tool discovery and multi-server connections, making AI workflows modular, flexible, and efficient. This client facilitates seamless interaction with MCP servers to perform tasks like web searches and video summarization, enhancing AI system capabilities through standardized context sharing and tool orchestration.

Use This MCP client To

Connect LangGraph agents to multiple MCP servers simultaneously Automatically discover and use external tools via MCP Perform web searches through integrated MCP tools Summarize YouTube videos using connected MCP servers Extend AI workflows by adding custom MCP servers Enable modular AI systems with dynamic tool access Orchestrate multi-step tasks across diverse data sources

README

LangGraph Agent with MCP

This project is designed to efficiently integrate Model Context Protocol (MCP) with a LangGraph Agent, allowing it to dynamically access external tools, data sources, and APIs.

Using this project, you can connect a LangGraph agent to MCP servers and use predefined tools to perform various tasks, such as web searches and summarizing YouTube videos. You can also add additional servers as needed.

This integration enables automatic tool discovery and multi-server support, making AI systems more modular and powerful. It allows AI systems to automatically find tools and connect to multiple servers, increasing their flexibility and efficiency.

image

What is MCP and Why It Matters?

The Model Context Protocol (MCP) is an open standard that provides a structured way for AI applications to interact with external data, tools, and APIs. MCP was developed by Anthropic to address the challenge of dynamically connecting LLMs to external data sources without requiring custom integrations for each tool.

MCP is important because it helps AI systems share and access data easily, removing barriers between different tools. This makes AI more connected and efficient. It also allows developers to build smarter AI systems that can work with many different tools and grow easily.

Project Structure

langgraph_mcp/
│-- agent.py  
│-- servers/
│   ├── tavily.py          
│   ├── yt_transcript.py   
│   ├── math_server.py 
│   ├──weather.py
│-- .env          
│-- requirements.txt   

Installation

  1. Clone the Repository:
git clone https://github.com/your-repo/langgraph-mcp.git
cd langgraph-mcp
  1. Install Dependencies
pip install -r requirements.txt
  1. Create a .env file and add:
TAVILY_API_KEY=<your-tavily-api-key>
OPENAI_API_KEY=<your-openai-api-key>

How It Works

To start, run servers/server.py in your terminal. This will start the MCP server. Then, in a new terminal, run agent.py. The agent will connect to the server via the MCP client and execute your query, as shown in the demo.

demo.mp4

langgraph-mcp FAQ

How does LangGraph-MCP handle multiple MCP servers?
It supports multi-server connections, allowing agents to interact with various MCP servers simultaneously for broader tool and data access.
Can I add custom tools or servers to LangGraph-MCP?
Yes, you can add additional MCP servers and tools to extend functionality beyond the predefined set.
What types of tasks can LangGraph-MCP perform?
It enables tasks like web searches, video summarization, and other workflows by leveraging connected MCP servers and tools.
Is LangGraph-MCP limited to specific AI models?
No, it is provider-agnostic and works with models like OpenAI, Anthropic Claude, and Google Gemini.
How does LangGraph-MCP improve AI system modularity?
By enabling automatic tool discovery and multi-server support, it allows AI systems to dynamically find and use tools, increasing flexibility and efficiency.
What programming languages or environments does LangGraph-MCP support?
It is designed to integrate with LangGraph agents, typically used in JavaScript/TypeScript environments, but can be adapted as needed.
Does LangGraph-MCP support real-time context updates?
Yes, it leverages MCP's protocol to provide real-time structured context to AI models for dynamic interaction.
How secure is the interaction between LangGraph-MCP and MCP servers?
MCP includes built-in principles for secure, scoped, and observable model interactions, which LangGraph-MCP inherits.