Repository navigation
Commit 80da086
fix(mcp): initialize points at the served SKILL.md; run_action names the no_confirmation_service next step (#37355)
Fixes #35778
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:连接开放 MCP 入口的 AI
客户端,初始化时会被告知使用指南在哪里下载;执行需人工确认的业务动作被拒时,工具说明会告诉它由人在应用里完成。
- 为什么做:上一轮把教学文字从工具说明挪进了使用指南,不读指南的客户端失去了指引,这里补回两句提示(属于"让自带 AI
的客户端在开放入口拿到受治理答案"这条主线)。
- 出错会怎样:只是给 AI 读的提示文字,说错了 AI 可能找错地址或多问一句,不会改数据;可直接撤回。
- 要你做什么:无。
## What changes
Items 1 and 2 of #35778. **Item 3 (optional slimming of list_datasets /
query_dataset, the spec `QueryDatasetInputSchema` and the
validate_expression variable descriptions) is not taken**: the card
marks it optional and measure-first, and it stays open on the card.
1. `packages/mcp/src/mcp-server-runtime.ts`: the open door's default
`initialize` text (`DEFAULT_HTTP_INSTRUCTIONS`) gains one sentence:
`Usage guide (SKILL.md): GET this endpoint's path plus /skill (by
default /api/v1/mcp/skill).`
- Where it is true: the runtime dispatcher mounts `GET PREFIX/mcp/skill`
beside `PREFIX/mcp` from the same domain list
(`packages/runtime/src/domains/mcp.ts` `createMcpDomains`, mounted in
`dispatcher-plugin.ts` with the same `prefix`, default `/api/v1`),
behind the same `isMcpServerEnabled()` switch, answered by the same
`mcp` service (`renderSkill`), and anonymous, so it holds for every
grant. `handleHttpRequest`'s only caller in this repo is that domain.
The sentence is relative to the endpoint because the prefix is
configurable.
- Where it is not added: a host's per-request texts and a configured
`instructions` stay whole (existing pins), and the stdio default names
no URL, since a stdio server has no HTTP endpoint.
2. `packages/mcp/src/mcp-http-tools.ts`: `run_action`'s description
gains one clause after the ACTION_CONFIRMATION_REQUIRED sentence:
`On details.reason "no_confirmation_service" a person performs it in the
app: do not make the same change with another tool.`
- It restores the pre-#35682 in-app hint, and adds the "not through
another tool" half the qa record on #34325 (6966146204) asks the refusal
wording to carry. It is door-neutral: true on stdio and on Streamable
HTTP. It does not anticipate #34325's stdio-only sentence (use a client
that supports confirmation), which belongs to the refusal text on that
card, and stays consistent with ruling 6909391261 (HTTP keeps the
hand-off path; cancel/timeout refused).
Byte deltas:
- tools/list on the API-key surface (`tools-list-weight-34689.test.ts`):
36,613 to 36,739 bytes (+126); `run_action` description 1,228 to 1,352
(+124). The ceiling of 38,000 is unchanged and still holds.
- Default `initialize` text: +93 bytes (a bare bridge answers 533
characters). The 4,096-character bound pin on the longest default text
still passes.
## Tests
- New top-level describes in the existing harness files:
- `initialize-selection-rule-34686.test.ts`: the pointer is in the first
paragraph for five grants (no scope, data:read, data:write,
metadata:write with an authoring injection, data:read with one).
- `mcp-action-confirmation-handoff-33690.test.ts`: `run_action`'s
tools/list description carries the clause.
- Ablations, one-off, via `scripts/ablation-replace.mjs` (anchor hit 1
to 0, restored blob equal to HEAD, `git diff HEAD` empty). The tests
import the source, so no dist rebuild sits in the path:
- pointer removed: the new initialize pin fails (1 failed, 14 passed);
- clause removed: the new run_action pin fails (1 failed, 28 passed).
## Acceptance notes
- Not verified: a cloud host that calls `handleHttpRequest` from its own
code and mounts the MCP endpoint without the runtime dispatcher. Such a
host gets this default only when it injects no instructions of its own.
If it serves no sibling `/skill` path, the sentence would not hold
there; nothing in this repo is such a caller.
## Verification
Two-minute check: `pnpm --filter @objectstack/mcp exec vitest run
src/initialize-selection-rule-34686.test.ts
src/mcp-action-confirmation-handoff-33690.test.ts
src/tools-list-weight-34689.test.ts`. Expect 3 files passing, and a
tools/list table line `| run_action | 1352 | 884 | 2236 |`.
Readings at e3c3ac4:
<details><summary>mcp build, typecheck, vitest (under
os-verify-lock)</summary>
- `@objectstack/mcp...` build: VERDICT command-exit 0.
- `pnpm --filter @objectstack/mcp typecheck`, then the full `vitest run
--maxWorkers=2`: VERDICT command-exit 0. Test Files 85 passed (85),
Tests 1509 passed (1509). check:test-typecheck OK.
</details>
<details><summary>derived gate families</summary>
- `dispatch-gates --commands --repo objectstack-ai/objectstack`: 68
families.
- Results: 67 exit 0. `check:dual-build-cjs-loads` exit 3 (PREREQUISITE
NOT MET: no whole-repo dist), so it is NOT MEASURED locally and left to
CI.
- `--ran` with exit codes: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.
- `overlap-check`: clean against origin/main.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYo86w1wqy2z2fMrryr -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent 84a27e7 commit 80da086
5 files changed
Lines changed: 62 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4977 | 4977 | | |
4978 | 4978 | | |
4979 | 4979 | | |
| 4980 | + | |
| 4981 | + | |
| 4982 | + | |
| 4983 | + | |
4980 | 4984 | | |
4981 | 4985 | | |
4982 | 4986 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1794 | 1794 | | |
1795 | 1795 | | |
1796 | 1796 | | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1797 | 1804 | | |
1798 | 1805 | | |
1799 | | - | |
| 1806 | + | |
| 1807 | + | |
1800 | 1808 | | |
1801 | 1809 | | |
1802 | 1810 | | |
| |||
0 commit comments