How panz2018/fastapi_mcp_sse works
Project type and purpose
• This is a backend-focused demonstration tool that uses FastAPI to expose both standard web endpoints and Server-Sent Events (SSE) endpoints implemented according to the Model Context Protocol (MCP).
• Purpose: show how to integrate MCP SSE into a FastAPI application, expose /sse and /messages/ for SSE clients, and host standard web routes (/, /about, /status, /docs, /redoc).
File structure
• Top-level: configuration files (.flake8, .gitignore, pyproject.toml, etc.) and README.md.
• src/ folder contains the application code:
• server.py – initializes FastAPI, sets up MCP SSE transport & handlers, includes routers.
• routes.py – defines standard web endpoints via an APIRouter.
• weather.py – defines MCP tool functions (get_alerts, get_forcast) acting as domain logic.
• app.py – (optional helper) may assemble the FastAPI app.
• No database layer is present; domain logic is in-process.
• Deployment is via Uvicorn (invoked in server.py or uv run start).
Key insights from the README
• FastAPI is the web framework.
• MCP SSE is the core feature: SSE transport for live event streaming, plus an HTTP POST /messages/ for submitting messages.
• Standard web routes coexist with MCP SSE routes.
• Extensibility via adding new APIRouter routes or new MCP tool functions.