get_event_attachment inlines files up to 30 MiB, which can drop the transport

Ouverte
#2,508 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é
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript

Piste de recherche

Start with packages/mcp-core/src/api-client/client.ts around the inline attachment size cap and download handling, then read tools/catalog/get-event-attachment.ts for the tool schema and response. Check how the tool can return a link without buffering a large file and how its tests cover inline and oversized attachments. Done means callers can get a usable result for large attachments without the transport closing; the reported client limit and memory impact are still unverified.

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

Description

MCP mcp-feedback-pattern

Pattern: get_event_attachment returns any attachment up to 30 MiB inline as a base64 blob in one JSON-RPC result, and a caller has no way to ask for a link instead. For a ~22 MiB file the client's transport closed before it got a usable result.

Reports: 1 (MCP user feedback MCP-SERVER-GW8, get_event_attachment, server 0.42.0, Codex over HTTP, kind=broken, impact=blocked). Customer identifiers are left out on purpose; the internal feedback log has them.

What happened: listing an event's attachments worked. Downloading a 23,439,996-byte .tar.gz closed the transport before the client got either the embedded resource or a download link. Sampled server spans for those calls are all ok: the attachment list GET and the ?download=1 GET returned 200 and the tools/call span finished in ~1.2 s, so the handler completed and the failure came after the result left it.

Cause (code verified, transport side inferred):

  • The inline cap is DEFAULT_MAX_INLINE_ATTACHMENT_BYTES = 30 * 1024 * 1024, sized for the Worker's 128 MB isolate, not for what MCP clients accept (packages/mcp-core/src/api-client/client.ts:372-378 @ 0c6b028).
  • Only attachments over that cap skip the download and return a presigned link (client.ts:4160-4171, tools/catalog/get-event-attachment.ts:124-134). A 22.4 MiB file falls under it, so the bytes are buffered (client.ts:4192) and returned as a ~31 MB base64 EmbeddedResource (get-event-attachment.ts:147-166).
  • The input schema has only attachmentId to pick a file; nothing requests metadata or a link only (get-event-attachment.ts:91-101).
  • Sentry already answers ?download=1 for objectstore attachments with a redirect to a presigned URL (getsentry/sentry src/sentry/api/endpoints/event_attachment_details.py:124 @ 0d74e59b939), which the oversized path uses via resolveDirectDownloadUrl.

Not checked: the client-side error and the client's maximum message size, so it's inferred, not confirmed, that the result size closed the transport. I also didn't check whether the Worker came close to its memory limit while serializing the result. Related but different: the "hosted MCP connection dropped mid-call" reports were transient and worked on retry; this one is size-dependent.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_18245721458ab109a53742963df57e13.

--

View Session [Sentry]

Langage dominant
TypeScript
Étoiles
975
Forks
189
Merge moyen
19 h 57 min
PR mergées (30 j)
542

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.