Skip to content

Request Hooks/Lifecycle Callbacks for Telemetry and Observability #877

Open
@ASaiAnudeep

Description

@ASaiAnudeep

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions