feat: add URL-mode elicitation support#1423
Conversation
The MCP spec (2025-11-25) added URL-mode elicitation alongside form mode, allowing servers to direct users to external URLs for out-of-band interactions (auth flows, payments, sensitive data). This implements client-side support for rendering and handling URL-mode elicitation requests, and announces the capability during initialization. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the clickable URL link with a consent dialog that displays the URL as plain text when "Open URL" is clicked, letting the user confirm before navigating. Add a separate "Accept" button that resolves the elicitation without the content field, per the MCP spec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a tool call returns an MCP error (e.g. -32042 URLElicitationRequired),
the catch block was only capturing error.message (a string), discarding the
structured error.code and error.data fields.
Now McpError instances push the full JSON-RPC error structure to history:
{ error: { code, message, data } }
This means the Response panel will show the complete error including
data.elicitations for -32042, rather than just a message string.
This reverts commit 86f6d09.
|
@claude review |
|
Claude finished @cliffhall's task in 2m 35s —— View job Code Review: URL-mode elicitation support
Nice work — the discriminated-union refactor is clean, form mode is left untouched, the consent dialog is a good touch, and the capability declaration / notification registration line up with SEP‑1036. I checked the implementation against the SDK ( 🔴 1. URL scheme is not validated — spec requires HTTPS-only (
|
Address Claude review on #1423: - Validate the server-supplied URL before opening it; refuse non-https schemes (http/file/javascript/data) and malformed URLs, disabling the "Open URL" button and showing an error state instead of calling window.open (SEP-1036 URL Security Requirements, a spec MUST). - Display the parsed destination host prominently in the consent dialog to surface look-alike/embedded-credential URLs. - Document that elicitation/complete is surfaced via the notification panel and resolved manually (no auto-correlation), a conscious choice per the spec's MAY/SHOULD. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the thorough review! Addressed in f75bd62. 🔴 1 — HTTPS-only validation (blocking): Fixed. The URL-mode handler now parses 🟡 2 — Display target domain prominently: Done. The consent dialog now shows the parsed 🟡 3 — 🟢 Nits: Thanks for confirming the off-by-one fix, the Verification: |
|
@claude review |
|
Claude finished @cliffhall's task in 1m 29s —— View job Code Review: URL-mode elicitation (round 2)
Re-reviewed the changes in ✅ #1 — HTTPS-only validation (was blocking): resolved
✅ #2 — Display target domain: resolvedThe consent dialog now renders ✅ #3 —
|
|
Thanks for the round-2 pass! 🙏 Agreed on all three notes — no code changes needed:
Will let a maintainer take it from here for merge. |
Summary
formandurlelicitation capabilities during client initialization (elicitation: { form: {}, url: {} })notifications/elicitation/completenotifications in the Inspector's notification panelChanges
ElicitationRequestDatawith a discriminated union (ElicitationFormRequestData|ElicitationUrlRequestData)onElicitationRequesthandler to branch onrequest.params.modeand build the appropriate request data shape{ action: "accept" }(nocontentfield, per spec), and Decline/Cancel buttons; existing form-mode code untouchedelicitation: { form: {}, url: {} }capability; imported and registeredElicitationCompleteNotificationSchemain the notification handler arrayElicitationRequest.test.tsx(8 tests) andElicitationTab.test.tsx(1 test); updated capability assertion inuseConnection.test.tsxHow Has This Been Tested?
Against Everything Server PR 3334
Url Elicitation Tool Entry
Url Elicitation Tool
Url Elicitation Request
Url Elicitation Open URL Dialog
Url Elicitation Tool Success
Url Elicitation Tool Error Path
Test plan
npm run build— no type errorscd client && npm run lint— no lint issuescd client && npx jest— 494 tests passnpm run dev, connect to an MCP server, verify form elicitation still works🤖 Generated with Claude Code