MCP: pass protocol cancellation through to Sentry API requests

Đang mở
#2,275 1 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start at handleToolCall in packages/mcp-core/src/server.ts (around line 410) and trace how the tool context is built, then follow how the API client is constructed from it. The reference behavior is the shared transport in @sentry/api (transport.ts, test/cancellation.test.ts), which already honors per-request signals and stops retry backoff. Thread extra.signal through the context and every API call including polling and retry waits, recognizing cancellation by signal.aborted/abort reason. Done when a new test cancels an in-flight call, asserts no further API requests, and concurrent calls still complete.

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

Mô tả

When an MCP client cancels a tool call, the work keeps running. handleToolCall in packages/mcp-core/src/server.ts only takes params, so the SDK's extra.signal never reaches the tool context, the API client or its polling and retry waits.

The transport side is already done in @sentry/api. Its shared transport, which MCP uses since getsentry/toolkit#1722, honors per-request signals and stops retry backoff on abort (transport.ts, covered by test/cancellation.test.ts, from getsentry/sentry-api-schema#105).

What's left:

  • Thread extra.signal from the tool handler into the invocation context and every API call the tool makes, including polling and retry waits.
  • Keep cancellation scoped to the one invocation, so concurrent calls on the same server keep running.
  • Recognize cancellation by signal.aborted and the abort reason, not only error.name === "AbortError", since MCP reasons can be strings.
  • Add a test that cancels an in-flight tool call and checks that no further API requests go out.

Split out of getsentry/sentry-api-schema#95.

via @BYK.

--

View Session [Sentry]

Ngôn ngữ chính
TypeScript
Star
961
Fork
179
Merge trung bình
15 giờ 33 phút
Pull request đã merge (30 ngày)
476

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 getsentry/toolkit

Tất cả issue của getsentry/toolkit

Issue tương tự

Thêm issue về TypeScript

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.