You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[v2] Use the documented middleware accessor in the tracing opt-out example #3934
While integrating the SDK into mcpstat, I needed to disable the SDK's inbound server spans while preserving other middleware.
The "Turning it off" example uses mcp._lowlevel_server.middleware. This works, but MCPServer exposes the same list through the documented mcp.middleware accessor.
Could the example use mcp.middleware in both places, retaining the existing provisional API warning? This would avoid accessing the internal _lowlevel_server attribute.
Use mcp.middleware in both places in the example, retaining the existing warning about the provisional middleware API and OpenTelemetryMiddleware import.
This would be a documentation-only change. I would be happy to contribute it if the maintainers consider it useful.
Code to reproduce
SDK version
Integration: mcp 2.3.0. Documentation and accessor checked on main at 77001c9.
Verified this on main: mcp.middleware exposes the same underlying list (self._lowlevel_server.middleware), and in-place slice assignment (mcp.middleware[:] = [...]) removes OpenTelemetryMiddleware as expected. The only English doc reference to update is docs/run/opentelemetry.md (lines 86–87).
@tekkidev since you offered to contribute this, I don't want to step on your toes—happy to pick this up and open the PR if you don't have the bandwidth and maintainers are good with the change.
Activity
Arks-06 commentedon Dec 2, 2026
Verified this on
main:mcp.middlewareexposes the same underlying list (self._lowlevel_server.middleware), and in-place slice assignment (mcp.middleware[:] = [...]) removesOpenTelemetryMiddlewareas expected. The only English doc reference to update isdocs/run/opentelemetry.md(lines 86–87).@tekkidev since you offered to contribute this, I don't want to step on your toes—happy to pick this up and open the PR if you don't have the bandwidth and maintainers are good with the change.
tekkidev commentedon Dec 2, 2026
@Arks-06 Thanks for verifying this and offering to help! I'd still be happy to contribute the change once the maintainers give the go-ahead.