LangGraph FastAPI MCP

v1.0.0Developer Toolsstable

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.

langgraph-fastapi-mcp-server-demomcpai-integration
Share:
8
Stars
0
Downloads
0
Weekly
0/5

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

Manage shopping lists via chat through LangGraph and MCP.
davidkiss

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedFeb 24, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langgraph-fastapi-mcp-server-demo

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 sync
2

Configure 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-here
3

Start 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/docs
4

Start 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:7860
5

Interact 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.

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.

Quick Config Preview

{ "mcpServers": { "langgraph-fastapi-mcp-server-demo": { "command": "npx", "args": ["-y", "langgraph-fastapi-mcp-server-demo"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides