RobertoRuben/mcp-northwind-fastapi-example
If you are the rightful owner of mcp-northwind-fastapi-example and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project demonstrates the use of fastapi-mcp to create a Model Context Protocol (MCP) server for LLM interaction with a REST API.
🚀 Northwind FastAPI MCP Example
This project demonstrates how to use fastapi-mcp to create a Model Context Protocol (MCP) server that allows Large Language Models (LLMs) to connect and interact with a REST API.
📋 Overview
The Northwind API is a simple example that shows how to expose data from the classic Northwind database through both a traditional REST API and an MCP endpoint, making it accessible for LLMs to query and understand.
🏁 Getting Started
Prerequisites
- Python 3.10+ 🐍
- Virtual environment tool 🔧
Installation
-
Clone the repository and install dependencies:
git clone https://github.com/RobertoRuben/mcp-northwind-fastapi-example.git cd mcp-northwind-fastapi-example python -m venv venv venv\Scripts\activate # On Windows pip install -r requirements.txt
-
Run the application:
uvicorn src.main:app --reload
-
Access the API documentation at
http://localhost:8000/api/v1/docs
📝
🔌 Available Endpoints
REST API Endpoints
GET /api/v1/products
: List all products 📦
MCP Endpoint
http://localhost:8000/mcp
: Model Context Protocol endpoint for LLM connections 🤖
🔗 Connecting an LLM to the API
This example demonstrates how fastapi-mcp creates a bridge between your REST API and Large Language Models:
- Traditional REST endpoints serve structured data at
/api/v1/products*
📊 - The MCP endpoint at
/mcp
allows LLMs to discover and interact with your API programmatically 🧠 - LLMs can understand your data schema and execute appropriate API calls automatically. ✨