Description
Is your feature request related to a problem? Please describe.
Currently, I think there's no built-in way to hook into the request lifecycle to monitor things like request counts, malformed requests, or general observability metrics. This makes it difficult to understand how my MCP tools are being used in production and to debug issues effectively.
Describe the solution you'd like
I'd like request hooks/lifecycle callbacks similar to what's available in the community-maintained Go MCP SDK.
https://github.com/mark3labs/mcp-go/blob/main/examples/everything/main.go#L33-L72
This would allow me to:
- Hook into incoming requests before processing
- Capture outgoing responses after processing
Describe alternatives you've considered
- Implementing custom logic in my application to track
@mcp.tool()
@track
def get_active_users():
pass
Additional context
Having hooks functionality would be extremely valuable for production deployments where monitoring, analytics, and observability are essential requirements.