-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedhelp wantedContributions especially welcome if you have a good knowledge of the codebase and languageContributions especially welcome if you have a good knowledge of the codebase and language
Description
When using the MCP TypeScript SDK (SSEClientTransport / StreamableHTTPClientTransport) with Undici instrumentation (e.g., OpenTelemetry), successful MCP POST requests are being reported as aborted.
This happens because close() immediately calls:
this._abortController?.abort()If a POST response is still being processed, Undici receives the abort signal and marks the span as an error, even though the server returned 200 OK. This results in spans like:
UND_ERR_ABORTED: The operation was aborted
for successful requests.
Impact
- Successful MCP requests show up as failed in traces
- Undici logs aborted errors
- Misleading telemetry in distributed tracing
- Connections stay open until Undici’s idle timeout (~10–14 seconds)
Reproduction
-
Enable OTel Undici instrumentation
-
Use
SSEClientTransportorStreamableHTTPClientTransport -
Send any POST request (
initialize,callTool, etc.) -
Immediately call
client.close() -
Observe:
- Response is 200 OK
- Undici reports
UND_ERR_ABORTED - Span is marked as failed
Request
Could the SDK:
- Avoid calling
AbortController.abort()while requests are still in-flight - Optionally provide a graceful close mode that waits for active requests to finish
This would prevent Undici from misclassifying successful MCP requests as aborted and keep telemetry accurate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedhelp wantedContributions especially welcome if you have a good knowledge of the codebase and languageContributions especially welcome if you have a good knowledge of the codebase and language