FastAPI SSESAFE
A working example to create a FastAPI server with SSE-based MCP support
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
English | 简体中文
A Server-Sent Events (SSE) implementation using FastAPI framework with Model Context Protocol (MCP) integration.
What is MCP?
The Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development:
- Context limitations: Allows models to access up-to-date information beyond their training data
- Tool integration: Provides a standardized way for models to use external tools and APIs
- Interoperability: Creates a common interface between different AI models and tools
- Extensibility: Makes it easy to add new capabilities to AI systems without retraining
This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a FastAPI web application.
Description
This project demonstrates how to implement Server-Sent Events (SSE) using the FastAPI framework while integrating Model Context Protocol (MCP) functionality. The key feature is the seamless integration of MCP's SSE capabilities within a full-featured FastAPI web application that includes custom routes.
Features
- Server-Sent Events (SSE) implementation with MCP
- FastAPI framework integration with custom routes
- Unified web application with both MCP and standard web endpoints
- Customizable route structure
- Clean separation of concerns between MCP and web functionality
Architecture
This project showcases a modular architecture that:
- Integrates MCP SSE endpoints (
/sseand/messages/) into a FastAPI application - Provides standard web routes (
/,/about,/status,/docs,/redoc) - Demonstrates how to maintain separation between MCP functionality and web routes
Installation & Usage Options
Prerequisites
Install [UV Package Manager](https://docs.astral.sh/
712240fd0dcbOBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control.
claude mcp add fastapi-mcp-sse -- uvx fastapi-mcp-sse
{
"mcpServers": {
"fastapi-mcp-sse": {
"command": "uvx",
"args": [
"fastapi-mcp-sse"
]
}
}
}Exposed tools (2)
2 read · 0 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
get_alerts | read | Get weather alerts for a US state. |
get_forecast | read | Get weather forecast for a location. |
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | PASS |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- declared (1 observation(s))
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (2)
sse
.flake8
Gates applied: no_behavioural_pass.
712240fd0dcbfull audit observations/trust-audit/mcp-server/panz2018__fastapi-sse.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 712240fd0dcb | SAFE | B | 89 | first audit |
Questions
What is the FastAPI SSE MCP server?
A working example to create a FastAPI server with SSE-based MCP support
What tools does FastAPI SSE expose?
2 in total: 2 read-only, 0 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is FastAPI SSE safe to connect to an agent?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean server reads B.
What credentials does FastAPI SSE need?
No credential environment variables were found in its source, so it appears to need none.
How does FastAPI SSE run?
It speaks sse, so it runs as a service you connect to over the network. It is published on PyPI as fastapi-mcp-sse.
How current is this page?
The grade is for one exact copy of the source (712240fd0dcb), read on 2026-10-08. The repository is watched and re-audited when it changes.