MCP: pass protocol cancellation through to Sentry API requests

Ouverte
#2,275 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
65/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
tooling

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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]

Langage dominant
TypeScript
Étoiles
961
Forks
179
Merge moyen
15 h 33 min
PR mergées (30 j)
476

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de getsentry/toolkit

Toutes les issues de getsentry/toolkit

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.