Commit d1fcbd2
fix: detect 401 errors from StreamableHTTP transport for OAuth flow
The server-side error handling only checked for SseError instances
when detecting 401 responses from MCP servers. StreamableHTTPClientTransport
throws a different error type (generic Error with "HTTP 401" message)
when there's no authProvider configured.
This caused the proxy to return 500 instead of 401 to the client,
preventing the OAuth discovery and redirect flow from triggering.
Added is401Error() helper that checks for:
- SseError with code 401
- StreamableHTTPError with code 401
- Generic Error with "HTTP 401" or "(401)" in message
Fixes #960
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 2b79e36 commit d1fcbd2
1 file changed
+24
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
47 | 66 | | |
48 | 67 | | |
49 | 68 | | |
| |||
508 | 527 | | |
509 | 528 | | |
510 | 529 | | |
511 | | - | |
| 530 | + | |
512 | 531 | | |
513 | 532 | | |
514 | | - | |
| 533 | + | |
515 | 534 | | |
516 | 535 | | |
517 | 536 | | |
| |||
649 | 668 | | |
650 | 669 | | |
651 | 670 | | |
652 | | - | |
| 671 | + | |
653 | 672 | | |
654 | 673 | | |
655 | 674 | | |
| |||
695 | 714 | | |
696 | 715 | | |
697 | 716 | | |
698 | | - | |
| 717 | + | |
699 | 718 | | |
700 | 719 | | |
701 | 720 | | |
| |||
0 commit comments