[v2] Use the documented middleware accessor in the tracing opt-out example
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 91/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- documentation
Research direction
Open docs/run/opentelemetry.md at the “Turning it off” example and compare it with the middleware accessor described in docs/advanced/middleware.md. Replace both uses of mcp._lowlevel_server.middleware with mcp.middleware, retaining the provisional API warning and OpenTelemetryMiddleware import. Done when the example uses the documented accessor in both places and preserves those notes.
Written by the indexing model from the issue text.
Description
What happened?
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.
- Example: https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/run/opentelemetry.md#turning-it-off
- Middleware guide: https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/advanced/middleware.md
AI assisted with source review and wording.
What did you expect?
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.
Area
Documentation
- Dominant language
- Python
- Stars
- 25k
- Forks
- 4.2k
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/python-sdk
-
v2
Difficulty 1/5 Under an hour Newbie friendliness 86/100
modelcontextprotocol/python-sdk#3978 · 2 comments ·
Maintainers usually reply within 1 day
-
Client serves cached tools after its context exits with an exceptionPossibly taken @jonxsong claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
modelcontextprotocol/python-sdk#3968 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
modelcontextprotocol/python-sdk#3957 ·
Maintainers usually reply within 1 day
-
bug v1
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
modelcontextprotocol/python-sdk#3929 · 2 comments ·
Maintainers usually reply within 1 day
-
DCR `RegistrationHandler` accepts `{"redirect_uris": null}` and returns `201 Created` for `authorization_code` clientsMay be free again A pull request for this issue was closed without being merged. Openbug v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/python-sdk#3885 · 3 comments ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/python-sdk
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day