Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Improve log clarity for "Terminating session: None" in stateless mode

Đang mở
#2,329 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, observability

Hướng nghiên cứu

Bắt đầu với phương thức terminate() trong src/mcp/server/streamable_http.py, sau đó so sánh với _handle_stateless_request() trong src/mcp/server/streamable_http_manager.py. Xác nhận rằng việc dọn dẹp stateless được phân biệt với việc kết thúc phiên và rằng các lần kết thúc phiên thực sự vẫn giữ nguyên hành vi ghi log hiện có.

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

Mô tả

enhancement P3
Description

In stateless HTTP mode, every request logs INFO:mcp.server.streamable_http:Terminating session: None. This is correct behavior — stateless mode creates a new transport with mcp_session_id=None per request and terminates it afterward — but the message is confusing to end users who see it and assume their connection is failing or being dropped.

I maintain an MCP server (ha-mcp) that runs in stateless mode, and this log message regularly causes confusion among users who think they aren't connected.

Suggested change

Differentiate the log message for stateless (session-less) terminations:

# Current (streamable_http.py):
logger.info(f"Terminating session: {self.mcp_session_id}")

# Suggested:
if self.mcp_session_id:
    logger.info(f"Terminating session: {self.mcp_session_id}")
else:
    logger.debug("Stateless request completed, cleaning up transport")

This would:

  • Downgrade stateless cleanup to DEBUG (routine, not noteworthy)
  • Use wording that doesn't alarm users ("completed" vs "Terminating")
  • Keep the existing INFO-level log for actual session terminations
References
Ngôn ngữ chính
Python
Star
24.3k
Fork
4k
Merge trung bình
1 ngày 19 phút
Pull request đã merge (30 ngày)
29

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.