From e3c3ac47a03a6b0c76ba9fa5228318e8634e031c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 21:12:20 +0000 Subject: [PATCH] fix(mcp): initialize points at the served SKILL.md; run_action names the no_confirmation_service next step Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr --- .../35778-mcp-skill-pointer-refusal-hint.md | 8 ++++++ .../initialize-selection-rule-34686.test.ts | 25 +++++++++++++++++++ ...-action-confirmation-handoff-33690.test.ts | 16 ++++++++++++ packages/mcp/src/mcp-http-tools.ts | 4 +++ packages/mcp/src/mcp-server-runtime.ts | 10 +++++++- 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .changeset/35778-mcp-skill-pointer-refusal-hint.md diff --git a/.changeset/35778-mcp-skill-pointer-refusal-hint.md b/.changeset/35778-mcp-skill-pointer-refusal-hint.md new file mode 100644 index 00000000000..07b44294997 --- /dev/null +++ b/.changeset/35778-mcp-skill-pointer-refusal-hint.md @@ -0,0 +1,8 @@ +--- +'@objectstack/mcp': patch +--- + +Clause-②: no +Metadata-protocol: none + +The open MCP door's default `initialize` instructions now say where the usage guide is served: a `GET` on the MCP endpoint's path plus `/skill` (by default `/api/v1/mcp/skill`) returns the `SKILL.md` that carries the teaching text the tool descriptions no longer hold. A host's own instructions and a configured `instructions` text are unchanged. `run_action`'s description again says what a `no_confirmation_service` refusal leaves the caller: a person performs the action in the app, and the agent does not make the same change with another tool. diff --git a/packages/mcp/src/initialize-selection-rule-34686.test.ts b/packages/mcp/src/initialize-selection-rule-34686.test.ts index d38125e3c5a..7014476cf94 100644 --- a/packages/mcp/src/initialize-selection-rule-34686.test.ts +++ b/packages/mcp/src/initialize-selection-rule-34686.test.ts @@ -304,3 +304,28 @@ describe('[#34774] initialize instructions — the authoring contract line, and expect(text.length).toBeLessThan(4096); }); }); + +/** + * [#35778] The default text says where the usage guide is served: the teaching + * prose moved out of the tool descriptions into the served SKILL.md, so a + * client that never fetches it is pointed there. The route is anonymous and + * mounted beside the MCP endpoint, so the sentence rides every grant's default + * answer; a host's or the configured text stays whole (pinned above). + */ +describe('[#35778] initialize instructions — the default text points at the served SKILL.md', () => { + const POINTER = 'Usage guide (SKILL.md): GET this endpoint\'s path plus /skill (by default /api/v1/mcp/skill).'; + const runtime = new MCPServerRuntime({ name: 't', version: '0.0.1-operator' }); + + it('is in the first paragraph for every grant, with and without an authoring registry', async () => { + for (const o of [ + {}, + { grantedScopes: [MCP_OAUTH_SCOPE_DATA_READ] }, + { grantedScopes: [MCP_OAUTH_SCOPE_DATA_WRITE] }, + { grantedScopes: [MCP_OAUTH_SCOPE_METADATA_WRITE], authoring: {} }, + { grantedScopes: [MCP_OAUTH_SCOPE_DATA_READ], authoring: {} }, + ] as Opts[]) { + const text = await instructionsOf(runtime, makeBridge(), o); + expect(text.split('\n\n')[0], JSON.stringify(o)).toContain(POINTER); + } + }); +}); diff --git a/packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts b/packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts index 54e43da4e61..ab724ce1b2a 100644 --- a/packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts +++ b/packages/mcp/src/mcp-action-confirmation-handoff-33690.test.ts @@ -511,3 +511,19 @@ describe('[#33712] Streamable HTTP: initialize batched with a tool call', () => expect(bridge.calls).toEqual([]); }); }); + +/** + * [#35778] run_action's description says what the no-service refusal leaves + * the caller: a person performs the action in the app, and the agent does not + * make the same change through another tool. Door-neutral: it reads true on + * the stdio door and on Streamable HTTP. + */ +describe('[#35778] run_action names the next step on a no_confirmation_service refusal', () => { + it('its tools/list description carries the in-app clause', async () => { + const json = await call(makeBridge('none'), { jsonrpc: '2.0', id: 1, method: 'tools/list' }); + const runAction = (json.result.tools as Array<{ name: string; description: string }>).find((t) => t.name === 'run_action'); + expect(runAction?.description).toContain( + 'On details.reason "no_confirmation_service" a person performs it in the app: do not make the same change with another tool.', + ); + }); +}); diff --git a/packages/mcp/src/mcp-http-tools.ts b/packages/mcp/src/mcp-http-tools.ts index 21c8f3a0d28..4a867dae7a8 100644 --- a/packages/mcp/src/mcp-http-tools.ts +++ b/packages/mcp/src/mcp-http-tools.ts @@ -4977,6 +4977,10 @@ export function registerActionTools( 'you are answered status "pending_confirmation" with a pendingId: do not retry, tell the user to approve ' + 'it. A refusal ACTION_CONFIRMATION_REQUIRED (declined, cancelled, timed out, or no confirmation service) ' + 'means nothing ran; do not retry unless the user asks. ' + + // [#35778] The no-service reason's next step, door-neutral: true + // whether or not the client could have confirmed in place. + 'On details.reason "no_confirmation_service" a person performs it in the app: do not make the same change ' + + 'with another tool. ' + // [ADR-0151 D3 rule 3] An AI service account is refused, never handed off. 'Under an AI service account\'s own key the call is refused whatever it sends: hand the action to a ' + 'person, or its author declares ai.requiresConfirmation: false when it is safe unattended. ' + diff --git a/packages/mcp/src/mcp-server-runtime.ts b/packages/mcp/src/mcp-server-runtime.ts index c9a5caf38fe..49cfccdfc04 100644 --- a/packages/mcp/src/mcp-server-runtime.ts +++ b/packages/mcp/src/mcp-server-runtime.ts @@ -1794,9 +1794,17 @@ function hostInstructions( * every grant (a `metadata:write`-only or `actions:execute`-only token lists * no data tool) and with or without a build door mounted, so it never * promises building to a deployment that has none. + * [#35778] It also says where the usage guide is: the teaching prose lives in + * the served SKILL.md, not in the tool descriptions, so a client that never + * fetches it is told where it went. The runtime dispatcher mounts the public + * `GET /mcp/skill` beside `/mcp`, from the same domain list, + * behind the same enable switch and for every grant (it is anonymous), so the + * sentence names it relative to this endpoint and gives the default prefix. + * The stdio default names no URL: a stdio server has no HTTP endpoint. */ const DEFAULT_HTTP_INSTRUCTIONS = - 'ObjectStack MCP Server. The tools this connection lists depend on what its credential was granted.'; + 'ObjectStack MCP Server. The tools this connection lists depend on what its credential was granted. ' + + 'Usage guide (SKILL.md): GET this endpoint\'s path plus /skill (by default /api/v1/mcp/skill).'; /** * [#34774] The authoring contract line (#34659 ruling D4 = A): the