Skip to content

docs(mcp): fix OAuth quickstart to use prod client_id - #2136

Merged
jung-thomas merged 2 commits into
DEVfrom
worktree-mcp-quickstart-prod-clientid
Sep 4, 2026
Merged

docs(mcp): fix OAuth quickstart to use prod client_id#2136
jung-thomas merged 2 commits into
DEVfrom
worktree-mcp-quickstart-prod-clientid

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

MCP OAuth via mcp-remote fails against production (developers.sap.com) with "The request for authorization was invalid" at /oauth/authorize. PAT auth is unaffected (it bypasses the authorize flow).

Root cause

docs/end-users/mcp-quickstart.md hardcodes the dev client in both --static-oauth-client-info blocks: sb-tutorials!t676072.

Dev and prod share one XSUAA tenant (t676072), so prod.mtaext gives prod a distinct xsappname tutorials-prod → OAuth client sb-tutorials-prod!t676072. The runtime .well-known/oauth-authorization-server discovery correctly advertises the prod-qualified scope tutorials-prod!t676072.Tutorial.MCP (derived from the bound VCAP xsappname). mcp-remote pairs that prod scope with the doc's dev client_id → the dev client can't be granted a prod-owned scope → XSUAA rejects.

xsappname client_id scope
Dev tutorials sb-tutorials!t676072 tutorials!t676072.Tutorial.MCP
Prod tutorials-prod sb-tutorials-prod!t676072 tutorials-prod!t676072.Tutorial.MCP

Change (docs only)

  • Both mcp-remote example blocks now use the prod client_id sb-tutorials-prod!t676072 (the doc's default <base> is production).
  • Added a dev/prod <base>client_id mapping table with the failure symptom.
  • Updated the cf env lookup to name both srv apps.

Prod configuration and .well-known discovery are correct and unchanged.

The mcp-remote --static-oauth-client-info blocks hardcoded the dev client
sb-tutorials!t676072. Prod runs a distinct xsappname (tutorials-prod) in the
same XSUAA tenant, so its OAuth client is sb-tutorials-prod!t676072. Against
developers.sap.com the dev client_id + prod-owned Tutorial.MCP scope (emitted
by the .well-known discovery) is rejected at /oauth/authorize as an invalid
authorization request.

Switch the example blocks to the prod client_id and add a dev/prod mapping
table plus a cf env lookup so users pick the id matching their <base>.
…-uri whitelist

Some mcp-remote builds bind the callback to the loopback IP 127.0.0.1
(RFC 8252's preferred default), producing http://127.0.0.1:<port>/oauth/callback.
XSUAA matches redirect_uri literally and the client whitelists only
http://localhost:*/oauth/callback, so the IP form fails at /oauth/authorize with
'redirect_uri does not match the configuration'. Pin --host localhost in both
example blocks and add a troubleshooting note.
@jung-thomas
jung-thomas merged commit 0c6b0c1 into DEV Sep 4, 2026
3 checks passed
@jung-thomas
jung-thomas deleted the worktree-mcp-quickstart-prod-clientid branch September 4, 2026 13:27
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