LangGraph FastAPI MCP Server Demo
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LangGraph FastAPI MCP Server Demoadd milk to my shopping list"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LangGraph FastAPI MCP Server Demo
This is 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.

Technology Stack
FastAPI: a modern, fast (high-performance), web framework for building APIs with Python 3
FastAPI-MCP: an open-source library that exposes your FastAPI endpoints as Model Context Protocol (MCP) tools (with Auth)
MCP (Model Context Protocol): an open protocol that facilitates seamless interaction between AI models and external data sources or tools
LangChain: An opens-source framework that helps developers build applications powered by large language models (LLMs)
LangGraph: An opens-source framework by LangChain for building and managing complex AI agents using graph-based architecture
ChatGPT: A popular LLM provided by OpenAI
Gradio: A popular opens-source library for building web interfaces for machine learning models. This project uses Gradio to create a web interface for the chatbot.
LangSmith: An opens-source framework by LangChain for tracing and monitoring LLM applications.
uv: A fast opens-source Python package manager - a drop-in replacement for
pip,condaandvirtualenv.
Related MCP server: Test MCP Server
Quick Start
1. Install uv
Follow the instructions here to install uv, if you haven't already.
2. Install Dependencies
uv sync3. Set Up OpenAI API Key
Create a .env file in the project root:
# .env
OPENAI_API_KEY=your-openai-api-key-here4. Run the FastAPI app
uv run uvicorn server.main:app --host 0.0.0.0 --port 8000 --reloadTry the FastAPI app at http://localhost:8000/docs
5. Run the Chatbot
uv run chatbot.pyThe chatbot will be available at http://localhost:7860
Usage Examples
Try these example queries in the chatbot:
"I need to buy a watermelon",
"What's in my shopping list?",
"Let's add spaghetti and tomato sauce",
"I just bought the watermelon",
"Remove the tomato sauce",
"I need an extra spaghetti",
Dependencies
LangGraph: For creating the React agent
Gradio: For the chat interface
LangChain OpenAI: For the language model integration
LangChain Core: For tool definitions
FastAPI: For the MCP server
SQLAlchemy: For database operations
License
This project is open source and available under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server to manage a restaurant menu from AI agents - 39 tools over the DuckHub API.
Cloud-hosted MCP server for durable AI memory
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Cloudflare Workers MCP server: ai-agent-scratchpad
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA demonstration MCP server that exposes basic arithmetic tools (add, subtract, ping) through FastAPI and shows how to integrate them with OpenAI's tool-calling API for LLM orchestration.-
- FlicenseNot gradedqualityDmaintenanceA simple MCP server combining FastMCP and LangGraph that enables AI agent interactions through tools for asking questions to an OpenAI-powered agent and receiving personalized greetings.-
- AlicenseNot gradedqualityBmaintenanceMCP server that gives AI agents full control over grocery lists, todos, and packing lists. Your AI creates lists, adds items, checks them off, and shares with family/friends.4MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides weather and web search tools, orchestrated by a LangGraph agent with OpenAI for natural language interaction.8-