Title: Introduce typed error classes with metadata · Issue #1742 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Introduce typed error classes with metadata · Issue #1742 · modelcontextprotocol/python-sdk
X Title: Introduce typed error classes with metadata · Issue #1742 · modelcontextprotocol/python-sdk
Description: Summary Replace generic exceptions with SDK-native error classes that include useful metadata like fault attribution, retryability, and HTTP details. Problem The SDK currently raises generic exceptions from various layers (httpx, anyio, ...
Open Graph Description: Summary Replace generic exceptions with SDK-native error classes that include useful metadata like fault attribution, retryability, and HTTP details. Problem The SDK currently raises generic except...
X Description: Summary Replace generic exceptions with SDK-native error classes that include useful metadata like fault attribution, retryability, and HTTP details. Problem The SDK currently raises generic except...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1742
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Introduce typed error classes with metadata","articleBody":"## Summary\n\nReplace generic exceptions with SDK-native error classes that include useful metadata like fault attribution, retryability, and HTTP details.\n\n## Problem\n\nThe SDK currently raises generic exceptions from various layers (httpx, anyio, task groups) with no context about:\n- Whether the error is retryable\n- Who is at fault (client, server, network, protocol violation)\n- HTTP status codes and response bodies (often discarded)\n\nThis makes it hard for users to build robust error handling.\n\n## Goal\n\nA hierarchy of typed errors like:\n- `McpError` (base) with `fault`, `is_retryable`, `http_status_code`, `response_body`\n- `McpTransportError` for connection/network issues\n- `McpProtocolError` for invalid JSON-RPC responses\n- `McpAuthError` for 401/403 responses\n\n---\n\n\u003csub\u003e[AI Disclaimer](https://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d)\u003c/sub\u003e","author":{"url":"https://github.com/maxisbey","@type":"Person","name":"maxisbey"},"datePublished":"2025-12-05T17:02:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1742/python-sdk/issues/1742"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:be6859be-11d3-f143-1fd0-ec0b73ab3374 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D65A:19C81F:AFFEBC:ED7356:6A5A8FBE |
| html-safe-nonce | 2ae249992a72618e16170de9953041d382bcc76f0243e38ee918fb7cb6027a0c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjVBOjE5QzgxRjpBRkZFQkM6RUQ3MzU2OjZBNUE4RkJFIiwidmlzaXRvcl9pZCI6IjMzNTYwMzM5OTYwMTA3MjEyMTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c432b5216ad29d658739ca2968cf1a879e458d39552c0fcbd52fbb5d5ddf3f0a |
| hovercard-subject-tag | issue:3699693502 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/1742/issue_layout |
| twitter:image | https://opengraph.githubassets.com/48a3ea178105a0bd8b889cf27aa30e41170e45abb6ff69105ccc552689b7d0d7/modelcontextprotocol/python-sdk/issues/1742 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/48a3ea178105a0bd8b889cf27aa30e41170e45abb6ff69105ccc552689b7d0d7/modelcontextprotocol/python-sdk/issues/1742 |
| og:image:alt | Summary Replace generic exceptions with SDK-native error classes that include useful metadata like fault attribution, retryability, and HTTP details. Problem The SDK currently raises generic except... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxisbey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9989a1a1d89aa5a38a19e5d0c7ee88a8ffde84acde90048990492aae52f235db |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ba6769fbf719c56dbf7bed650ce454dafc5b1528 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width