fastmcp.server.middleware.logging

Comprehensive logging middleware for FastMCP servers.

Classes

LoggingMiddleware

Middleware that provides comprehensive request and response logging.

Logs all MCP messages with configurable detail levels. Useful for debugging, monitoring, and understanding server usage patterns.

StructuredLoggingMiddleware

Middleware that provides structured JSON logging for better log analysis.

Outputs structured logs that are easier to parse and analyze with log aggregation tools like ELK stack, Splunk, or cloud logging services.