Repository navigation
Description
domain:devx#1 · os-warren · session_01JQwxbWBtYWqaV8NhvUrShB
Filed by the dispatching PM seat session for the W4-MCP runner session_01JQwxbWWuY7DoeEEbb5fxS6, whose own write was refused by its session permissions (RUNNER rule 2: staged text, posted verbatim through the same door).
立卡门类别:① 已复现产品缺陷(reach: HTTP /api/v1/mcp 实测,六种授权组合见下表)
业务理由:平台管理员用 MCP 客户端(如 Claude)连接本应用、只授予「构建元数据」(metadata:write),想把外部数据源的表导入为对象。客户端能看到 list_remote_tables / import_object,但每次调用都被 403 拒绝;唯一能用的办法是再授予与此无关的「代你执行动作」(actions:execute)。不修的话,联邦导入在按最小授权连接时不可用,或者迫使用户多授权。
Reader: domain:server 车道,packages/runtime/src/domains/mcp.ts 的 federationService() 与 packages/spec/src/ai/mcp.zod.ts 的 scopesToAgentPermissionSets(改哪一侧由 owner 定)。
Dedupe(均含已关闭): repo:objectstack-ai/objectstack is:issue list_remote_tables total=2(#27745 引入该工具、#27261 联邦决策,均已关,不同题);import_object manage_platform_settings total=0;federation mcp metadata:write total=1(#6015 分诊席位贴,不相关)。
QA-source: #28937 · ai.mcp-http-surface · observed beside the clauses
What happens
On a stock showcase boot, an OAuth token minted on the embedded authorization server for the platform admin (admin@objectos.ai) is served the two federation tools #27745 registered behind metadata:write, list_remote_tables and import_object. Whether a call of them runs depends on whether the grant also names actions:execute, a scope that has nothing to do with federation:
| granted scopes | tools/list carries the pair | list_remote_tables {datasource:'showcase_external'} |
|---|---|---|
| metadata:write | yes | 403 PERMISSION_DENIED 'Introspecting an external datasource requires the manage_platform_settings capability.' |
| data:read metadata:write | yes | same 403 |
| data:write metadata:write | yes | same 403 |
| data:read data:write metadata:write | yes | same 403 |
| actions:execute metadata:write | yes | 200, tables customers (7 columns), orders (7 columns) |
| all four MCP scopes | yes | 200, same two tables |
An osk_ key and a session bearer are served neither tool (correct per #26464).
Why it matters
The consent screen tells the person that metadata:write lets the client "Build and change this app's metadata as drafts, within your own permissions". The person here holds manage_platform_settings, consents to exactly that, and the agent is then listed two build tools it can never call — the "listed but nothing serves it" shape. The only working grant asks the person to also hand over "Run actions on your behalf".
Mechanism (read from the code at 7fa9873, not changed)
federationService() in packages/runtime/src/domains/mcp.ts checks ec.systemPermissions for FEDERATION_READ_CAPABILITY / FEDERATION_WRITE_CAPABILITY (manage_platform_settings). The agent execution context's systemPermissions evidently keep that capability only when the grant names actions:execute; scopesToAgentPermissionSets (packages/spec/src/ai/mcp.zod.ts) maps metadata:write alone to the restricted set. Which side should move (the capability the bridge reads for a metadata:write grant, or the scope that registers the pair) is a contract question for the owner.
Reproduction
- Boot the showcase:
OS_PORT=41520 pnpm -C examples/app-showcase exec objectstack dev --ui --seed-admin -p 41520 -d file:/tmp/run/data.db. - Mint a token for admin@objectos.ai with scope
metadata:write:POST /api/v1/auth/oauth2/register{application_type:'native', token_endpoint_auth_method:'none', redirect_uris:['http://127.0.0.1:9/cb'], scope}, sign in,GET /api/v1/auth/oauth2/authorize?…&resource=http://localhost:41520/api/v1/mcp&code_challenge_method=S256,POST /api/v1/auth/oauth2/consent{accept:true, oauth_query},POST /api/v1/auth/oauth2/token. POST /api/v1/mcpinitialize, then tools/calllist_remote_tables{datasource:'showcase_external'} → 403 as above.- Repeat with scope
actions:execute metadata:write→ 200 with the two tables.
Expected: a grant that is served the pair can call it for a caller who holds the capability (or the pair is not listed to a grant that can never use it). Actual: the table above.
Full evidence chain: #28937 (Part 2, build).
Activity
objectstack-fleet commentedon Nov 2, 2026
triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U
Path: none
Triage:
pm:queue(p2 kept) · 2026-11-02T07:56Z⛔ Not a claim.
domain:serverbut has no pm state (H13). Ametadata:writeMCP grant is offeredlist_remote_tables/import_object, but every call is refused unless the grant also namesactions:execute. A concrete defect at a named location (packages/runtime/src/domains/mcp.tsfederationService(),scopesToAgentPerm…inpackages/spec/src/ai/mcp.zod.ts):pm:queue.Generated by Claude Code
objectstack-fleet commentedon Nov 2, 2026
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt
Claim: PM loop round 1 · card thread · 2026-11-02T08:28Z
Session:
session_01ADHkmQxwoGb5fSnrFkpxmt(the seat); the card thread issession_01ADHkmR3xfgrGdYxj32A5PZAccount:
os-steve(the seat's linked user; the card's assignee)Branch:
claude/project-thread-59tlth(the card thread's harness-pinned branch; it names no issue, so this claim is the identity record)Worktree: the card thread's own container checkout
Domain:
domain:serverSeat:
domain:server#2Ruling-ref: the maintainer, verbatim: 「开 server 2、3、5 号席位, 前任已经下班,接手所有开发,包括跟进之前未完成的开发落地。」 Card: none from the maintainer on this card; triage graded p2 (6572021071).
File surface:
federationService()and the federation tool registration inpackages/runtime/src/domains/mcp.ts; their tests; a dogfood case if the MCP dogfood suite covers federation; changeset. ⛔ Nopackages/spec/**without needs_decision first (the scope→set mapscopesToAgentPermissionSetsis the spec lane's).Container & model:
M,mode:thread,model: opus(TIER_DEFAULT;--tiernames no path mandate: PM's call),effort: highClause-②: no (expected: a listed tool that always refused becomes callable within the principal's own capability, or is no longer listed; the dev measures and declares; a grant doing more than today is the maintainer's floor → needs_decision)
Metadata-protocol: none (expected)
Responsibility: the code is the MCP federation bridge of
@objectstack/runtime· the platform path is a metadata:write grant listedlist_remote_tables/import_objectthat every call refuses 403 for a principal who holdsmanage_platform_settings· reached by every MCP client connected with least-privilege metadata:writeThread-read: 6572021071
Premise: holds (the named seam read on
origin/mainby the seat this act; the dev re-measures red first)Serial constraints cleared: none — no open claim on a
domain:serverpm:dispatchedcard names these files (read this act)Resume-from: none — fresh from
origin/mainState:
pm:queue→pm:dispatched, assigned toos-steve, recorded by this claim.objectstack-fleet commentedon Nov 2, 2026
domain:server#2 · os-steve · session_01ADHkmR3xfgrGdYxj32A5PZ
os-dev-report
{ "issue": 28938, "status": "done", "branch": "claude/project-thread-59tlth", "pr": "https://github.com/objectstack-ai/objectstack/pull/29232", "session": "session_01ADHkmR3xfgrGdYxj32A5PZ", "premise_still_valid": true, "summary": "Route (b). Measured mechanism: the /mcp door hands an OAuth agent the user's systemPermissions only when the grant names actions:execute (core assembleExecutionContext delegatesActions), not via a permission set: metadata:write and actions:execute both map to mcp_agent_restricted. So a metadata:write-only grant holds [] and both federation calls always 403, even for an administrator. buildMcpBridge now carries listRemoteTables/importObject only when the envelope holds manage_platform_settings or manage_metadata, read through one helper (heldFederationCapabilities) that the per-call gate also reads. Route (a) was not taken: the metadata:write consent copy promises drafts within the user's permissions, and import_object saves a live object, so (a) would widen past the published text (open_questions).", "tests": "Red first on main code (test commit bf746d06): 2 failed | 6 passed, AssertionError expected 'function' to be 'undefined'. One-off probe on main (deleted): metadata:write-only admin gets list PERMISSION_DENIED 403 | import PERMISSION_DENIED 403. Green: mcp-federation-bridge.test.ts 8/8. pnpm --filter @objectstack/runtime test on 7de225bd+changeset: Test Files 514 passed (514), Tests 8322 passed | 19 skipped, VERDICT command-exit 0. Post-merge head 2a88bf5b9: bridge + resolve-execution-context tests 48/48, runtime typecheck VERDICT command-exit 0. Ablations via scripts/ablation-replace.mjs (anchor 1->0, restore blob == HEAD, git diff HEAD empty each time): (1) listing predicate -> true: cases 1 and 4 red, 2 failed | 6 passed; (2) per-call gate -> if (false): partial-holder 403 pin and existing 403 pin red, 2 failed | 6 passed; (3) grantsAuthoringTools serves undefined scopes (keys/sessions, packages/mcp src): key/session pin and skill-parity pin red, 2 failed | 7 passed. Test source imported relatively from src, so no dist rebuild involved in the ablation legs.", "gates": "Head 2a88bf5b9: dispatch-gates --commands (no paths) derived 60 families; all 60 exit 0; --ran with exit codes recorded: 60 derived, 60 run, 0 NOT-MEASURED, 0 UNRUN. Pre-merge run: check:dual-build-cjs-loads and check-plugin-teardown-shape --self-test first exited 3 (missing dist / shallow fixture commit), both 0 on the merged head. eslint --no-inline-config on the two touched source files exit 0 (runtime has no per-package lint script). CI check-runs: in_progress at report time, not waited on.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "files_changed": [ "packages/runtime/src/domains/mcp.ts", "packages/runtime/src/domains/mcp-federation-bridge.test.ts", ".changeset/28938-federation-pair-listed-only-when-callable.md" ], "line_budget": "+158 / -6 across 3 files (dispatch-gates count vs merge base), under the 3000 human-merge threshold", "deviations": [ "Clause-② declared `no` (measured): no call that passed is refused and none refused passes; for a grant holding neither capability, tools/call on the pair now gets the SDK unknown-tool answer instead of the 403 envelope.", "No dogfood case: the MCP dogfood suite has no federation case.", "The key/session negative pin lives in packages/mcp and is unchanged by this diff; it was ablated because the delta asked." ], "mcp_calls": "2 — mcp__github__issue_read (get_comments on #28938), mcp__github__pull_request_read (get on #29232); no write tools", "api_writes": "2 — relay pr_create (objectstack-ai/objectstack#29232, 7853 bytes sent = stored, assignees none, no labels), relay post-stamped issue comment (this report on #28938)", "open_questions": [ { "question": "Should a metadata:write-only grant be able to call list_remote_tables / import_object within the user's own manage_platform_settings / manage_metadata (route a)? The consent copy for metadata:write (MCP_OAUTH_SCOPE_CONSENT_COPY in packages/spec/src/ai/mcp.zod.ts) reads 'Build and change this app's metadata as drafts, within your own permissions — a person publishes them', while import_object saves a live object at once. Today the pair is usable only under metadata:write + actions:execute, whose copy is 'Run actions on your behalf, within your own permissions'.", "options": [ "A. Keep this PR's behaviour: the pair needs actions:execute to carry the user's capabilities. Zero further work; the consent texts stay as they are.", "B. Route (a): under metadata:write the federation bridge judges the delegating user's own capability, and the metadata:write consent copy is reworded to name live federated imports. This is a permission-boundary widening plus a packages/spec consent-copy change: maintainer floor, spec lane, about 1 card.", "C. Narrow import_object to a draft-landing import so it fits the existing metadata:write copy, then do B for the listing only. Larger: service-datasource import path plus spec, 2+ cards." ], "recommendation": "A for now, because it fixes the listed-but-never-callable shape without widening any grant. B or C only if the product wants least-privilege metadata:write clients to federate, which is a boundary decision for the maintainer." } ], "out_of_scope_findings": [] }Stamped 2026-11-02T10:00Z.
Generated by Claude Code