fastapi-fastmcp
Installation
SKILL.md
FastAPI + FastMCP OAuth Authentication with Scalekit
Overview
This skill documents the pattern for building production-ready MCP (Model Context Protocol) servers using FastAPI and FastMCP with OAuth 2.1 Bearer token authentication via Scalekit. This approach provides fine-grained control over authentication middleware, token validation, and server behavior compared to using FastMCP's built-in OAuth provider.
When to Use This Pattern
Use this FastAPI + FastMCP integration when you need:
- Custom middleware requirements: Implement rate limiting, request logging, or complex authorization logic beyond basic token validation
- Existing FastAPI applications: Integrate MCP tools into established FastAPI codebases without rewriting
- Advanced authorization: Enforce scope-based access control, multi-tenancy, or custom claims validation
- Full HTTP control: Manage CORS policies, health checks, and multiple endpoints alongside MCP tools
- Production requirements: Add monitoring, metrics, and deployment-specific configurations
Don't use this pattern if FastMCP's built-in OAuth provider meets your needs—the additional FastAPI layer adds complexity.