Skip to content

fix(mcp): keep OAuth challenges at HTTP boundary - #529

Draft
matoous wants to merge 1 commit into
mainfrom
agent/fix-mcp-http-auth-errors
Draft

fix(mcp): keep OAuth challenges at HTTP boundary#529
matoous wants to merge 1 commit into
mainfrom
agent/fix-mcp-http-auth-errors

Conversation

@matoous

@matoous matoous commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What changed

  • remove downstream API 401 conversion into JSON-RPC InternalError
  • preserve the original SumUp SDK authentication error
  • deprecate the ineffective resource metadata constructor options
  • document bearer validation, HTTP challenges, and authInfo propagation for remote transports

Why

MCP OAuth discovery requires an HTTP 401 response with a WWW-Authenticate header. A tool-level JSON-RPC error carrying a similarly named data property cannot trigger the client authorization flow and incorrectly claimed protocol compliance.

Impact

The toolkit no longer emits a nonstandard OAuth representation. Remote HTTP deployments have an explicit contract to reject invalid credentials before MCP dispatch and pass validated tokens through request auth context.

Validation

  • npm --prefix typescript run lint:fix
  • npm --prefix typescript test -- --runInBand

Specification reference: https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization

The MCP adapter converted downstream SumUp API 401 responses into JSON-RPC InternalError values containing a pseudo WWW-Authenticate field. MCP clients require a real HTTP 401 challenge and cannot discover OAuth from that tool-level error.

Remove the nonstandard conversion, preserve the original SDK error, deprecate the ineffective resource options, and document transport-boundary bearer validation and authInfo propagation.
@matoous matoous self-assigned this Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant