Skip to content

Conversation

@jamadeo
Copy link
Collaborator

@jamadeo jamadeo commented Sep 23, 2025

When streamable HTTP servers return 401s, surface them to the client.

Motivation and Context

This is necessary for clients to determine whether oauth is needed.

How Has This Been Tested?

Tested with https://github.com/block/goose

Breaking Changes

It adds a new error variant to StreamableHttpError

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

@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Sep 23, 2025
@jamadeo jamadeo force-pushed the jamadeo/error-pass-thru branch from fb01267 to 7d7f11b Compare September 23, 2025 16:18
@jamadeo jamadeo requested a review from alexhancock September 23, 2025 16:22
Err(err) => {
let _ = responder.send(Err(err));
return Err(WorkerQuitReason::fatal(
StreamableHttpError::TransportChannelClosed,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the only bit I don't understand. why do we only return this here? are the other variants of StreamableHttpError not relevant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an unfortunate result of the fact that you can't generally clone an Err. But it doesn't matter too much here: the returned error here is logged/thrown away when .close is called on the transport here: https://github.com/modelcontextprotocol/rust-sdk/blob/3310718b9c922a618007649eeaf9bc3d9a53fe80/crates/rmcp/src/transport/worker.rs#L208. The important part is the line before, where we .send() it to the caller.

That said I could put an actual message here, which would improve it

Copy link
Contributor

Choose a reason for hiding this comment

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

All good. Makes sense!

@jamadeo jamadeo force-pushed the jamadeo/error-pass-thru branch from 7d7f11b to 3f460a7 Compare September 23, 2025 16:45
@alexhancock alexhancock self-requested a review September 23, 2025 17:00
@jamadeo jamadeo merged commit 5216ab2 into main Sep 23, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Sep 23, 2025
@jamadeo jamadeo mentioned this pull request Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants