FastMCP Project Structure
Overview
Project Tree Structure
fastmcp/
βββ README.md # Project documentation and quick start
βββ pyproject.toml # Modern Python project configuration
βββ LICENSE # Apache License 2.0
βββ .gitignore # Git ignore patterns
β
βββ fastmcp/ # Core framework package
β βββ __init__.py # Package initialization and exports
β βββ server.py # FastMCP server implementation (Decorator, Builder patterns)
β βββ client.py # MCP client implementations
β βββ types.py # MCP protocol type definitions
β βββ context.py # Context management (Strategy pattern)
β β
β βββ transports/ # Communication layer (Adapter pattern)
β β βββ __init__.py # Transport interface definitions
β β βββ stdio.py # STDIO transport adapter
β β βββ http.py # HTTP transport adapter
β β βββ sse.py # Server-Sent Events transport
β β
β βββ tools/ # Tool execution framework
β β βββ __init__.py # Tool registry and management
β β βββ registry.py # Tool registration system (Registry pattern)
β β βββ decorators.py # @mcp.tool decorator implementation
β β
β βββ resources/ # Resource management system
β β βββ __init__.py # Resource interface definitions
β β βββ base.py # Base resource classes
β β βββ providers.py # Resource provider implementations
β β
β βββ prompts/ # Prompt template management
β β βββ __init__.py # Prompt system initialization
β β βββ templates.py # Template management (Template Method pattern)
β β βββ registry.py # Prompt registry system
β β
β βββ proxy/ # Proxy server capabilities (Proxy pattern)
β β βββ __init__.py # Proxy system exports
β β βββ server.py # Proxy server implementation
β β βββ routing.py # Request routing logic
β β
β βββ monitoring/ # Observability system (Observer pattern)
β β βββ __init__.py # Monitoring interface
β β βββ observers.py # Observer implementations
β β βββ metrics.py # Metrics collection
β β βββ logging.py # Structured logging
β β
β βββ utils/ # Utility functions and helpers
β βββ __init__.py # Utility exports
β βββ schema.py # Schema generation utilities
β βββ validation.py # Type validation helpers
β βββ auth.py # Authentication utilities
β
βββ examples/ # Usage examples and demos
β βββ basic_server.py # Simple MCP server example
β βββ multi_transport.py # Multi-transport server demo
β βββ proxy_composition.py # Server composition example
β βββ context_management.py # Context strategy examples
β βββ production_ready.py # Production deployment example
β
βββ docs/ # Documentation
β βββ index.md # Documentation home
β βββ quickstart.md # Getting started guide
β βββ patterns.md # Design patterns documentation
β βββ transports.md # Transport protocol guide
β βββ deployment.md # Production deployment guide
β βββ api/ # API reference documentation
β βββ server.md # Server API reference
β βββ client.md # Client API reference
β βββ transports.md # Transport API reference
β
βββ tests/ # Test suites
β βββ __init__.py # Test package initialization
β βββ conftest.py # Pytest configuration and fixtures
β β
β βββ unit/ # Unit tests
β β βββ test_server.py # Server implementation tests
β β βββ test_decorators.py # Decorator pattern tests
β β βββ test_transports.py # Transport adapter tests
β β βββ test_patterns.py # Design pattern integration tests
β β
β βββ integration/ # Integration tests
β β βββ test_workflows.py # End-to-end workflow tests
β β βββ test_composition.py # Server composition tests
β β βββ test_monitoring.py # Observability integration tests
β β
β βββ performance/ # Performance tests
β βββ test_throughput.py # Throughput benchmarks
β βββ test_latency.py # Latency measurements
β βββ test_scaling.py # Scaling behavior tests
β
βββ scripts/ # Development and deployment scripts
βββ setup_dev.py # Development environment setup
βββ build_docs.py # Documentation generation
βββ run_benchmarks.py # Performance benchmarking
βββ deploy.py # Deployment automationKey Architectural Components
Core Framework (fastmcp/)
fastmcp/)Server Implementation (server.py)
server.py)Transport Layer (transports/)
transports/)Tool System (tools/)
tools/)Proxy System (proxy/)
proxy/)Monitoring System (monitoring/)
monitoring/)Pattern Implementation Mapping
Component
Primary Patterns
Pattern Application
Enterprise Value
LLM-Specific Architectural Innovations
AI-Aware Decorators
Context-Sensitive Proxying
Semantic Transport Abstraction
Production-Ready Features
Monitoring and Observability
Authentication and Security
Configuration Management
Enterprise Deployment Patterns
Single-Server Deployment
Federated Deployment
Multi-Transport Architecture
Development and Testing Architecture
Test Organization
Documentation Strategy
Development Workflow
Last updated