[v2] Use the documented middleware accessor in the tracing opt-out example

Đang mở Phù hợp với người mới
#3,934 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
91/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Mở docs/run/opentelemetry.md tại ví dụ “Turning it off” và so sánh với accessor middleware được mô tả trong docs/advanced/middleware.md. Thay cả hai chỗ sử dụng mcp._lowlevel_server.middleware bằng mcp.middleware, giữ lại cảnh báo API đang ở trạng thái tạm thời và import OpenTelemetryMiddleware. Hoàn tất khi ví dụ sử dụng accessor được tài liệu hóa ở cả hai chỗ và giữ nguyên các ghi chú đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

v2
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.

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

Ngôn ngữ chính
Python
Star
25k
Fork
4.2k
Merge trung bình
10 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/python-sdk

Tất cả issue của modelcontextprotocol/python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.