FastAPI MCP
MCPAutomatic MCP server generator for FastAPI applications — converts FastAPI endpoints to MCP tools for LLM integration.
Dimension scores
Compatibility
| Framework | Status | Notes |
|---|---|---|
| Claude Code | ✓ | — |
| OpenAI Agents SDK | ✓ | Requires HTTP/SSE transport setup; OpenAI SDK may need adapter for ASGI-first approach |
| LangChain | ✓ | State management through session handling may need careful wrapping in LangChain execution model |
Security findings
Unvalidated HTTP header forwarding
The tool forwards HTTP headers from MCP clients to FastAPI endpoints without validation or sanitization. This could allow header injection attacks if headers are not properly validated downstream. Per CHANGELOG 0.3.6: 'Add configurable HTTP header forwarding' - this feature increases attack surface if headers contain malicious content.
OAuth token passthrough without validation framework
Based on CHANGELOG 0.3.1 and 0.3.2, the tool supports 'basic token passthrough' and OAuth configuration. Without seeing explicit token validation code in the source, there's risk of improperly validated tokens being forwarded to backend services.
ASGI transport security implications
As of version 0.3.0, the tool uses ASGI transport by default. ASGI interfaces can expose internal application state if not properly isolated. The removal of base_url validation (v0.3.0) may allow clients to interact with the FastAPI app in unexpected ways.
Automatic endpoint exposure without explicit security review
Operation ID predictability
Timeout configuration exposure
Non-ASCII character handling
Session state management without explicit security controls
Reliability
Success rate
75%
Calls made
100
Avg latency
150ms
P95 latency
400ms
Failure modes
- • Missing error handling in HTTP client operations - no visible try/catch around httpx calls
- • No explicit timeout handling visible in code snippets - could hang on slow endpoints
- • OAuth token validation failures may not be gracefully handled
- • Edge cases with empty/null operation_ids could cause tool name collisions
- • Unicode/special characters in endpoint paths or parameters may not be properly escaped
- • Concurrent request handling not explicitly addressed - potential race conditions in session management
- • Missing validation for malformed FastAPI app objects
- • No protection against resource exhaustion from large request/response bodies
- • Error responses may not follow consistent MCP error schema
- • Missing graceful degradation when FastAPI app has no valid endpoints
Code health
License
MIT
Has tests
Yes
Has CI
Yes
Dependencies
11
Excellent code health. Active project with comprehensive documentation (README, CHANGELOG, CONTRIBUTING), strong type checking (mypy configured), CI/CD with coverage tracking (codecov badge), pre-commit hooks, and well-structured dependency management using modern tooling (uv, pyproject.toml with dependency groups). Published to PyPI. Extensive examples and documentation directory. Uses ruff for linting/formatting. Only minor gap: repo git metadata not available for commit activity analysis, but project structure suggests active maintenance (recent v0.4.0 release in changelog). License is MIT (confirmed in LICENSE file, despite 'unknown' in metadata). All quality signals present.