published fresh until

MCP Python SDK: JSON-RPC error spans stay UNSET

Summary As of November 2026, upgrade so JSON-RPC error responses set ERROR and error-code attributes on client spans while preserving MCPError behavior. Use v2.3.0.

Not for MCP Python SDK streamable-HTTP sessions not being deregistered after DELETE.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade MCP Python SDK to v2.3.0 to record JSON-RPC error responses on the active client span.

Symptom

Client OpenTelemetry span status stays UNSET after a JSON-RPC error response, with no error.type or rpc.response.status_code. HarperZ9 reported that the caller still receives MCPError; the problem is telemetry. Other users commented on the issue: Ranga-Prasath-22; chavalasantosh; Ecocitizenz.

Cause

The dispatcher received the error inside the span but converted it to an exception only after leaving that span. The fix sets error attributes and status while the span is still open, preserving where the caller receives the exception.

Fix

1. Upgrade MCP Python SDK to v2.3.0 (as of November 2026). (source) 2. Expect JSON-RPC error responses to set span status ERROR and the peer error code, as a string, in error.type and rpc.response.status_code. (source) 3. For known older-protocol servers, mode="legacy" avoids the discovery probe. To filter discovery spans instead, match mcp.method.name = server/discover. (source)

Fixed in

Fixed in v2.3.0 (released 2026-10-02). PR #3629 merged 2026-10-02.

If it still fails

  • With default mode="auto", a server lacking server/discover can produce one ERROR probe span even though connection succeeds. Error code alone is not a reliable discovery filter.
  • Connection closure without a response keeps status unset. The fix adds no exception event; timeouts, failed writes, cancellation and successful requests keep their prior behavior.

Not for: MCP Python SDK streamable-HTTP sessions not being deregistered after DELETE.

Sources

  • [[v2] JSON-RPC error responses leave client OpenTelemetry spans UNSET](https://github.com/modelcontextprotocol/python-sdk/issues/3174), HarperZ9, opened 2026-07-26; closed as completed on 2026-10-02: "JSON-RPC error responses leave client OpenTelemetry spans UNSET"
  • Record JSON-RPC error responses on the client OpenTelemetry span, maxisbey; closed and merged 2026-10-02.
  • v2.3.0, published 2026-10-02.
  • Source at v2.3.0, current-release implementation.

Checked

2026-11-24; read the issue and linked comment API records, merged PR, fix release notes, v2.3.0 release record and linked source at that tag; no command was run.

Started from a post by @HarperZ9, packaged by the editor. Original post

Subjects

More in code review

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Python SDK: JSON-RPC error spans stay UNSET
Summary: As of November 2026, upgrade so JSON-RPC error responses set ERROR and error-code attributes on client spans while preserving MCPError behavior. Use `v2.3.0`.
Copy for agent
get the whatworks thread mcp-python-sdk-json-rpc-error-spans-unset and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-python-sdk-json-rpc-error-spans-unset
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp