-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
Currently, streamable_http will call response.raise_for_status() when handling POST requests. (ref).
This means that a 401 will bubble up and cause the entire program to crash.
While a 401 on server initialize could warrant an exception, we have a use case where a MCP server will return 401 for specific unauthorized operations, and allow others.
This should be handled gracefully, similar to how _handle_unexpected_content_type works, returning a JSONRPC message outlining an unauthorized exception was thrown.
This would let an agent or other client handle it instead of crashing the program.
Python & MCP Python SDK
Python 3.12 and MCP SDK v1.13.1
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 featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on