Skip to content

MCP sign-in: a refused client registration names its fix, and an ask card's failed start lands on Integrations - #76

Closed
erikcostlow wants to merge 1 commit into
nmamano:mainfrom
erikcostlow:fix/mcp-oauth-registration-refused
Closed

erikcostlow wants to merge 1 commit into
nmamano:mainfrom
erikcostlow:fix/mcp-oauth-registration-refused

Conversation

@erikcostlow

Copy link
Copy Markdown
Contributor

Fixes #75.

When a service refuses the Dynamic Client Registration - the issue's real case is Harness's Keycloak answering 403 insufficient_scope - the sign-in route already answers 502 sign_in_failed with reason registration_refused, but signInErrorText had no case for it, so the member saw the bare "The sign-in failed. Try again.", which retrying can never fix. The secret ask card's OAuth save swallowed the failure entirely (.catch(() => {}), and the save closes the card), so there the member saw nothing at all - no page ever opened.

The change:

  • signInErrorText gives registration_refused its own message in all four catalogs: the service refused to register a client automatically; enter the client ID from the service's documentation in the server's settings, in Integrations → MCP.
  • ui/integrations/sign-in-return.ts gains failMcpSignIn: a caller whose card the save already closed (SecretAskCard) sends the browser to /integrations?mcpSignIn= - where the OAuth callback would have landed - with the usual note of whose server it was, so the server's row shows the reason and offers the sign-in again. The code is the office's own fixed reason, never the authorization server's text (the rule by backToIntegrations; the endpoint's error_description stays unseen for the same reason).
  • The stub authorization server can answer a registration with a status other than 400 (dcrStatus), and tests cover the 403 path: server (the reason, and nothing stored), the form's alert and the returned notice, and the ask card's navigation.

Checks, run on macOS - bun run ci runs only on Linux and was not run:

  • bun run typecheck: pass.
  • bun run lint: 0 errors, 39 warnings, all pre-existing in files this diff does not touch.
  • bun run format: reformatted only this diff's files.
  • bun scripts/gate-tests.ts, then bun test on the 368 listed paths: 3915 pass, 38 skip, 23 fail. Every one of the 23 fails the same way at the base commit (600be24) on this machine - each failing file run alone at HEAD and at base gives identical counts. They are environment-sensitive tests (ICU date wording, container/system-prompt, the pinned Claude CLI's model ids), unrelated to this diff.
  • The gate's cp line, control-plane/web-reachability.test.ts: 6 pass, 0 fail. No web line, so ci:web was not needed.
  • The tests nearest this change all pass: server/mcp-oauth.test.ts (48 with catalog), server/mcp-oauth.ask-return.test.ts, ui/integrations/McpSection.dom.test.tsx, ui/log-view/SecretAskCard.dom.test.tsx, ui/integrations/sign-in-return.test.ts, shared/i18n/catalog.test.ts.

…card's failed start lands on Integrations

When a service's registration endpoint refuses the dynamic client
registration - the real case is Harness's Keycloak answering 403
insufficient_scope from its "DCR Trusted hosts" policy - the sign-in
route already says registration_refused, but no UI message existed for
that code, so the member saw the bare "The sign-in failed. Try again."
and retrying could never help. signInErrorText now has its own message
for it, in all four catalogs, pointing to the client ID from the
service's documentation, in the server's settings on Integrations → MCP.

The secret-request card's OAuth save started the sign-in with the
failure swallowed, and the save closes the ask, so a refused start left
the member with nothing at all - no page ever opened. A refused start
now sends the browser to /integrations?mcpSignIn=<reason>, where the
callback would have gone, with the usual note of whose server it was,
so the server's row shows the reason and offers the sign-in again.

The registration stub can answer a refusal with another status than 400
(dcrStatus), so the tests cover the 403 case end to end.
@erikcostlow
erikcostlow requested a review from nmamano as a code owner November 19, 2026 15:29
nmamano pushed a commit that referenced this pull request Nov 19, 2026
…card's failed start lands on Integrations (task f51a8f51, PR #76, closes #75)

When a service's registration endpoint refuses the dynamic client
registration (for example a Keycloak "DCR Trusted hosts" policy answering
403 insufficient_scope), the sign-in route already answered
registration_refused, but the UI had no message for that code and showed
the generic "try again". signInErrorText now has its own message in all
four catalogs: the server refused to register a client, so enter a client
ID from its documentation.

The secret-request card's OAuth save started the sign-in and swallowed a
failure, and the save closes the ask, so a refused start left the member
with nothing. A refused start now sends the browser to
/integrations?mcpSignIn=<reason>, with the usual note of whose server it
was, so the server's row shows the reason and offers the sign-in again.

The registration stub can answer a refusal with a status other than 400
(dcrStatus), so the tests cover the 403 case end to end. Tests also cover
the ask card's refused reason and a network error. asks-design.md says
where a failed ask-card start lands.

Contributed by Erik Costlow in PR #76; review fixes and tests by the Isomux
loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nmamano added a commit that referenced this pull request Nov 19, 2026
… in the words Nil approved (task d2080083, sign-off change for f51a8f51, PR #76)

Shortens settings.mcpServers.signInError.registrationRefused in en, ca, es
and zh. Copy only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nmamano

nmamano commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks for the fix and the clear write-up. It landed in main as one squash commit with your name on it (1e8e26e), so I am closing this PR. Our review added a case for a start that fails with no reason (a network error), which now also lands on Integrations, and shortened the new message to "This server refused to register a client. Enter a client ID." It ships in the next release.

Written by an AI model (Claude), working for Nil.

@nmamano nmamano closed this Nov 19, 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.

MCP OAuth sign-in: a refused client registration shows a generic error, and from an ask card nothing at all

2 participants