fix(client): map bare HTTP 401/403 to distinguishable JSON-RPC errors by sgoel2be24-cyber · Pull Request #3276 · modelcontextprotocol/python-sdk · GitHub
Skip to content

fix(client): map bare HTTP 401/403 to distinguishable JSON-RPC errors - #3276

Closed
sgoel2be24-cyber wants to merge 3 commits into
modelcontextprotocol:mainfrom
sgoel2be24-cyber:fix/streamable-http-401-unauthorized
Closed

sgoel2be24-cyber wants to merge 3 commits into
modelcontextprotocol:mainfrom
sgoel2be24-cyber:fix/streamable-http-401-unauthorized

Conversation

@sgoel2be24-cyber

@sgoel2be24-cyber sgoel2be24-cyber commented Aug 10, 2026

Copy link
Copy Markdown

Bare auth failures were collapsing into the generic "Server returned an error response" fallback, so agents could not handle operation-specific denials without tearing down the session. Surface Unauthorized/Forbidden with http_status metadata instead.

Fixes #1295

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Bare auth failures were collapsing into the generic "Server returned an
error response" fallback, so agents could not handle operation-specific
denials without tearing down the session. Surface Unauthorized/Forbidden
with http_status metadata instead.

Fixes modelcontextprotocol#1295

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@sgoel2be24-cyber

Copy link
Copy Markdown
Author

@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

401 in Streamable HTTP should be handled gracefully

1 participant