LangGraph FastAPI MCP
A sample project that turns a shopping list FastAPI app into an MCP server and connects a LangGraph based chatbot to the MCP server so that it can manage the user's shopping list via chat.
What is LangGraph FastAPI MCP?
LangGraph FastAPI MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to sample project that turns a shopping list fastapi app into an mcp server and connects a langgraph based chatbot to the mcp server so that it can manage the user's shopping list via chat.
A sample project that turns a shopping list FastAPI app into an MCP server and connects a LangGraph based chatbot to the MCP server so that it can manage the user's shopping list via chat.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A sample project that turns a shopping list FastAPI app into
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx langgraph-fastapi-mcp-server-demoConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use LangGraph FastAPI MCP
The LangGraph FastAPI MCP Server Demo shows how to turn an existing FastAPI application into an MCP server and connect a LangGraph-powered chatbot to it. The demo app manages a shopping list — users can add, view, update, and remove items through natural conversation, with LangGraph orchestrating tool calls to the FastAPI backend via the MCP protocol.
Prerequisites
- Python 3.10+ installed on your system
- uv package manager installed (see https://docs.astral.sh/uv/getting-started/installation/)
- An OpenAI API key for the LangGraph chatbot
- Git to clone the repository
- A modern web browser to access the Gradio chat interface on port 7860
Clone the repository and install dependencies
Clone the demo repository and use uv to install all Python dependencies including FastAPI, LangGraph, LangChain, and Gradio. The uv sync command reads pyproject.toml and creates an isolated virtual environment automatically.
git clone https://github.com/davidkiss/langgraph-fastapi-mcp-server-demo.git
cd langgraph-fastapi-mcp-server-demo
uv syncConfigure your OpenAI API key
Create a .env file in the project root and add your OpenAI API key. The LangGraph chatbot uses this key to call the language model that drives the shopping list assistant.
# .env
OPENAI_API_KEY=your-openai-api-key-hereStart the FastAPI MCP server
Launch the FastAPI server in one terminal. It serves both the REST API and the MCP endpoint. The --reload flag enables hot reloading during development. Once started, the MCP endpoint is available for the chatbot to connect to.
uv run uvicorn server.main:app --host 0.0.0.0 --port 8000 --reload
# API docs available at: http://localhost:8000/docsStart the LangGraph chatbot
In a second terminal, run the chatbot script. It connects to the FastAPI MCP server and starts a Gradio web interface on port 7860 where you can chat with the shopping list assistant.
uv run chatbot.py
# Gradio interface at: http://localhost:7860Interact with the shopping list via chat
Open your browser to http://localhost:7860 and start chatting. The LangGraph agent will interpret your requests, call the appropriate MCP tools on the FastAPI server, and respond with the updated shopping list state.
LangGraph FastAPI MCP Examples
Client configuration
This demo uses a direct LangGraph-to-MCP connection rather than Claude Desktop. The FastAPI server exposes the MCP endpoint at port 8000. To connect Claude Desktop instead, point it at the server URL.
{
"mcpServers": {
"shopping-list": {
"type": "sse",
"url": "http://localhost:8000/mcp"
}
}
}Prompts to try
Natural language prompts for the shopping list chatbot that exercise all available MCP tools.
- "I need to buy a watermelon"
- "What's in my shopping list?"
- "Let's add spaghetti and tomato sauce"
- "I just bought the watermelon, mark it as purchased"
- "Remove the tomato sauce from the list"
- "I need an extra spaghetti, update the quantity to 2"Troubleshooting LangGraph FastAPI MCP
The chatbot cannot connect to the FastAPI MCP server
Make sure you started the FastAPI server first (step 3) before running chatbot.py. Both processes must be running simultaneously. Check that port 8000 is not already in use by another application with `lsof -i :8000`.
OpenAI API errors or authentication failures in the chatbot
Verify your .env file exists in the project root directory and contains a valid OPENAI_API_KEY. Run `uv run python -c "import os; from dotenv import load_dotenv; load_dotenv(); print(os.getenv('OPENAI_API_KEY'))"` to confirm the key is loaded correctly.
uv command not found
Install uv using the official installer: `curl -LsSf https://astral.sh/uv/install.sh | sh` then restart your terminal. Alternatively, install via pip: `pip install uv`.
Frequently Asked Questions about LangGraph FastAPI MCP
What is LangGraph FastAPI MCP?
LangGraph FastAPI MCP is a Model Context Protocol (MCP) server that sample project that turns a shopping list fastapi app into an mcp server and connects a langgraph based chatbot to the mcp server so that it can manage the user's shopping list via chat. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install LangGraph FastAPI MCP?
Follow the installation instructions on the LangGraph FastAPI MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with LangGraph FastAPI MCP?
LangGraph FastAPI MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is LangGraph FastAPI MCP free to use?
Yes, LangGraph FastAPI MCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
LangGraph FastAPI MCP Alternatives — Similar Developer Tools Servers
Looking for alternatives to LangGraph FastAPI MCP? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up LangGraph FastAPI MCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use LangGraph FastAPI MCP?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.