Skip to content

fix(mcp): fail loudly when a server has no DCR endpoint - #1791

Merged
vastsa merged 4 commits into
vastsa:mainfrom
muzimu217:fix/mcp-oauth-no-dcr
Oct 21, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
muzimu217:fix/mcp-oauth-no-dcr

Conversation

@muzimu217

Copy link
Copy Markdown
Contributor

What this fixes

Fixes #1782.

When discovery returns no registration_endpoint, the login flow fell back to a literal client id:

} else {
  clientId = "pi-desktop";
}

No authorization server has ever registered that id, so the app opened <authorize>?client_id=pi-desktop and the user landed on a bare 404 — no explanation, no way forward. This is not GitHub-specific: every OAuth MCP server without Dynamic Client Registration is affected.

Change

Throw before opening anything, naming what is missing and the two real ways forward (ask the server operator for a client id, or use a server that supports DCR). The message deliberately does not promise a settings field that does not exist yet.

Verification

  • mcp-oauth.test.mjs + mcp-oauth-discovery.test.mjs — 42/42 pass (tsc --noEmit clean).
  • New test drives the real startLogin against a mocked discovery that omits registration_endpoint, and asserts both the error message and that openExternal was never called (opened deep-equals []).
  • Reverse check against the old code: with the fallback restored, that test does not merely fail — it hangs until the 300s timeout, because the old flow opened a browser and waited for a callback that could never arrive. That is the experience the report describes, so the test provably bites the original failure mode.
  • Branch is one commit on current main (710f493cc), 0 behind, 2 files +51/−2.

vastsa#1782: when discovery returns no registration endpoint, the login flow fell
back to a literal client id:

    } else {
      clientId = "pi-desktop";
    }

No authorization server has ever registered that id, so the app opened
`<authorize>?client_id=pi-desktop` and the user landed on a bare 404 — with
no explanation and no way forward. It is not a GitHub-specific failure: any
OAuth MCP server without Dynamic Client Registration is affected.

Throw before opening anything, naming what is missing and the two real ways
out. A settings field for a client id does not exist yet, so the message does
not promise one.

The test drives the real startLogin through a mocked discovery that omits
registration_endpoint, and asserts both the message and that openExternal was
never called. Verified against the old code: the test does not merely fail,
it hangs until the 300s timeout, because the previous flow waited for a
callback that could never arrive — the same experience the report describes.

Verification: mcp-oauth.test.mjs 20/20, mcp-oauth-discovery.test.mjs pass,
tsc --noEmit clean.
Bring the contributor branch onto the current integration base before validating and merging the OAuth fix.
Integrate the reviewed OAuth fallback fix with the latest main before final validation.
Fail before opening OAuth with an unregistered client, and send a
stable error code so settings can show translated recovery guidance.
@vastsa
vastsa merged commit 58da41a into vastsa:main Oct 21, 2026
4 of 6 checks passed
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.

[Bug] MCP OAuth opens browser with unregistered client_id=pi-desktop → GitHub 404 (GitHub Copilot MCP)

2 participants