Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FastAPI MCP Servershow me the source code for the /login POST route"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
FastAPI MCP Server
A Model Context Protocol (MCP) server that provides comprehensive tools for introspecting and working with FastAPI applications.
Features
๐ง Tools
load_fastapi_app - Load a FastAPI application from a module path
list_routes - List all routes with optional filtering
get_route_details - Get comprehensive details about a specific route
get_openapi_schema - Extract the OpenAPI schema
list_models - List all Pydantic models used in the app
get_model_schema - Get detailed schema for a specific model
search_routes - Search routes by query and criteria
analyze_dependencies - Analyze dependency injection usage
get_route_source - View the source code of route handlers
Installation
Usage
With Claude Desktop
Add to your claude_desktop_config.json:
Standalone
Example Usage
1. Load Your FastAPI App
2. List All Routes
Or with filters:
3. Get Route Details
4. Search for Routes
5. View Route Source Code
6. List All Models
7. Get Model Schema
8. Get OpenAPI Schema
Or for specific paths:
9. Analyze Dependencies
Example FastAPI App
See example_app.py for a sample FastAPI application to test with.
Use Cases
๐ API Discovery
Quickly understand what endpoints exist
Find routes by functionality or path
Explore API structure
๐ Documentation Generation
Extract OpenAPI schemas
Get detailed parameter information
View model schemas with examples
๐ Debugging
Inspect route configurations
View dependency injection hierarchy
Check parameter validations
๐จ Development
Generate client code from schemas
Understand existing APIs before modification
Find all routes using specific models
๐งช Testing
List all endpoints for test coverage
Get parameter requirements for test cases
Validate response models
Requirements
Python 3.10+
FastAPI 0.100.0+
MCP 1.0.0+
Pydantic 2.0.0+
Contributing
Contributions are welcome! This tool helps developers work more efficiently with FastAPI applications.
License
MIT License - feel free to use in your projects!
Author
Created as part of the FastAPI ecosystem to improve developer experience with AI-assisted development.