Skip to content

test(dogfood): strengthen MCP HTTP e2e + prove serve-side self-connection (#3167)#3269

Merged
os-zhuang merged 1 commit into
mainfrom
claude/mcp-server-default-wiring-ydcj2n
Jul 19, 2026
Merged

test(dogfood): strengthen MCP HTTP e2e + prove serve-side self-connection (#3167)#3269
os-zhuang merged 1 commit into
mainfrom
claude/mcp-server-default-wiring-ydcj2n

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What & why

两个 dogfood 增强,收尾 #3167 serve 侧 MCP 的证明面。纯测试改动(私有 @objectstack/dogfood 门包,无 changeset)。

P3 — 强化 HTTP 身份准入 e2e(showcase-mcp-http-identity.dogfood.test.ts)

mcp-http-identity 的证明补两条此前缺失的断言:

  • MCP == REST 同一准入:同一 principal 下 MCP query_records 的 id 集合 == REST GET /data 的 id 集合(不是"各自被裁剪",而是"可证等价");非空校验(只含自己的行、不含另一 owner 的)。
  • by-id get_record 也被 RLS 裁剪:member 取另一 owner 的私有行 → 被拒(tool error),取自己的 → 正常。补上了此前只覆盖 list 查询、未覆盖 by-id 读路径的缺口。

P2 — serve 侧自连接(showcase-mcp-self-connection.dogfood.test.ts,新增)

#3167 的 optional extension「平台连自己」,在一个进程内证明 serve↔consume 全链路:

  • mint 一个 osk_ key → 用 connector-mcp 通过真实 HTTP 连到 app 自己的 /api/v1/mcp → 发现并调用 app 自己的工具(list_objects/query_records/…)round-trip;
  • 未认证的自连接被拒(ADR-0101 的身份准入对"自己"也成立)。

为什么是 hand-wired、不是声明式 boot 时自连接:#3167 明确要求 dogfood gate 不能变 timing-sensitive。声明式 provider:'mcp' 在 boot 时自连接会撞 boot 顺序(automation start() 早于 HTTP listen),只能靠 #3049 degrade+retry 几秒后自愈——这正是时序脆弱的来源。本测试在 boot 后、服务已 listen、key 已存在时才连接,完全绕开该竞态,非 flaky。声明式-at-boot 形态(带 #3049 自愈)仍作为单独、谨慎 gating 的 follow-up。

可行性关键:bootStackHonoServerPlugin({ port: 0 }) 绑定真实 ephemeral socket,自 fetch 可达;端口经 stack.kernel.getServiceAsync('http-server').getPort() 取得——无需改 harness。

验证(本地)

  • MCP dogfood 11/11:showcase-mcp-http-identity(6,含 2 新)+ showcase-mcp-self-connection(3,新)+ showcase-declarative-mcp(2,回归)。
  • eslint 干净。

Refs #3167、ADR-0096、ADR-0101。

🤖 Generated with Claude Code

https://claude.ai/code/session_0115eg8dAaCfWaDYYAm3ma36


Generated by Claude Code

…tion (#3167)

P3 — showcase-mcp-http-identity.dogfood.test.ts: add two assertions the
mcp-http-identity proof lacked:
- MCP query_records id-set == REST /data id-set for the same principal (the two
  surfaces are ONE admission, not two independently-scoped ones);
- by-id get_record is RLS-scoped too — a member cannot fetch another owner's row.

P2 — showcase-mcp-self-connection.dogfood.test.ts (new): the #3167 optional
extension, "the platform connecting to itself". Hand-wired post-boot (not the
declarative-at-boot form, which #3167 says must not make the dogfood gate
timing-sensitive): mint an osk_ key, point connector-mcp at the app's own
/api/v1/mcp over real HTTP, and prove it discovers + calls its own tools —
while an unauthenticated self-connection is refused (ADR-0101 holds even to
itself).

Test-only (private @objectstack/dogfood gate). mcp dogfood 11/11.

Refs #3167, ADR-0096, ADR-0101.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0115eg8dAaCfWaDYYAm3ma36
@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Error Error Jul 19, 2026 10:58am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): packages/qa.

2 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/permissions/authorization.mdx (via packages/qa)
  • content/docs/permissions/delegated-administration.mdx (via packages/qa)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang marked this pull request as ready for review July 19, 2026 13:47
@os-zhuang
os-zhuang merged commit a59ba05 into main Jul 19, 2026
16 of 17 checks passed
@os-zhuang
os-zhuang deleted the claude/mcp-server-default-wiring-ydcj2n branch July 19, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants