Files
crank/_bmad-output/implementation-artifacts/1-16-mcp-tool-call.md
T

361 lines
32 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
story_id: "1.16"
story_key: "1-16-mcp-tool-call"
requirements: ["FR-1", "FR-4", "FR-33"]
status: "done"
baseline_commit: "767428436d3a54e60809a727044dfcec48e1f1dd"
created: "2026-08-23T11:20:00+03:00"
---
# Story 1.16: Провести нового администратора к первому MCP Tool call
Status: done
## Story
As a новый self-hosted администратор,
I want пройти понятный возобновляемый путь от первого входа до вызова Tool,
so that получаю первую ценность без разработки и поиска последовательности по документации.
## Operational Brief
Story 1.16 завершает Epic 1 и собирает реализованный hardened core в один честный activation journey:
`Operation → test → publish → Agent → MCP key → connection → public tools/call`.
Onboarding не создаёт вторую упрощённую модель. Он показывает серверную проекцию состояния уже существующих Operations, Published Versions, Agent catalog, key lifecycle и Invocation History, а действия выполняются существующими полными flows. Успех засчитывается только после реального authenticated MCP вызова через public endpoint.
Главный недостающий контракт: текущая Invocation History знает Agent/Operation/version, но не exact MCP key. Story должна протянуть безопасный typed key identity из machine credential verification в успешный invocation record и ProductEvent; raw secret при этом раскрывается только ответом create-key и никогда не попадает в persistent onboarding state.
## Requirement / Architecture Trace
- **Direct requirements:** FR-1, FR-4, FR-33; SM-11, SM-12, SM-13.
- **Primary architecture:** AD-1 immutable publication, AD-2 Agent snapshot, AD-11 correlation, AD-13 local ProductEvents, AD-19 UI/error contract, AD-22 identity/security.
- **Supporting architecture:** AD-4 bounded resources, AD-9 authorization scope, AD-15 startup/readiness, AD-16 migration authority, AD-20 release evidence, AD-21 unified execution.
- **Applicable NFR:** NFR-P3, NFR-P5, NFR-R1, NFR-S1, NFR-S2, NFR-S4, NFR-S6, NFR-S8, NFR-O1, NFR-O4, NFR-O5, NFR-C4.
## Scope
In scope:
- optional collapsible/dismissible Getting Started checklist on protected Admin UI;
- one bounded workspace-scoped onboarding snapshot computed from authoritative server facts;
- deep links into existing manual REST Operation, test/publish, Agent and key flows;
- exact Operation/Agent revision guards and honest regression after archive/revoke/change;
- one-time MCP key connection guidance for representative clients without persistent raw secret; <!-- community-scope: allow=one-time-token -->
- exact Agent/key-scoped first successful public MCP `tools/call` evidence;
- typed immutable idempotent local ProductEvents for eligible/start/complete/abandon milestones;
- RU/EN, loading/empty/error/retry/stale states, keyboard/focus/ARIA/reduced-motion behavior;
- registry/Admin API/MCP/Playwright tests, docs, capability inventory and manual usability protocol.
Out of scope:
- OpenAPI-guided onboarding (Story 2.9);
- Resources, Prompts and Tasks onboarding (Epics 3–4);
- ecosystem telemetry or any default external product analytics;
- redesigning Operation, Agent, key or MCP domain models;
- storing/restoring a lost raw MCP key;
- claiming a measured ≤15-minute usability result without the manual participant run; this story creates the executable protocol and product instrumentation, while release evidence records the real run.
## Acceptance Criteria
1. **Optional authoritative checklist.** Given first bootstrap/login in a workspace, when protected Admin UI opens, then a Getting Started checklist shows `Operation → test → publish → Agent → key → MCP connection → first call`; collapse/resume/dismiss never blocks normal navigation, while completion state comes only from server facts.
2. **Honest state regression.** Given a completed step, when its Operation/Agent is archived or changed, binding becomes stale, or key is revoked/deleted, then snapshot returns that step to an actionable state without trusting a browser completion flag.
3. **Existing Operation flow.** Given the Operation step, when manual REST is chosen, then onboarding deep-links into the existing full wizard with a safe minimal example/hints; it creates no hidden Draft, bypass or alternate validation/publish path.
4. **Exact publication/binding.** Given a successful test and Published Operation, when Agent is created/published, then exact Tool Version and catalog revision are visible; stale Operation/Agent revision requires explicit refresh/reselection, never silent binding.
5. **One-time key and connection.** Given a Published Agent, when its first MCP key is created, then raw key appears once with copy-safe endpoint/config for supported representative clients; it is absent from local/session storage, URLs, telemetry, ProductEvents, logs and repeat reads, with a clipboard responsibility warning. <!-- community-scope: allow=one-time-token -->
6. **Lost/revoked key recovery.** Given a lost or revoked key, when connection step resumes, then no raw value is reconstructed; old configuration is explicitly invalid and the UI offers deliberate create/rotate recovery without automatic duplicate key creation.
7. **Real first-call evidence.** Given authenticated MCP discovery and `tools/call`, when call succeeds through the public endpoint, then completion requires exact workspace/Agent/key scope and shows Tool, timestamp, Request ID, Trace ID and safe links to Invocation History/trace without payload.
8. **Actionable failures.** Given validation, upstream, auth, compatibility or connection failure, when progress stops, then the failed step shows bounded localized message, stable error code, Request ID/Trace ID where available and recovery action; retry resumes after the last authoritative step without duplicate publication/key creation.
9. **Resume and accessibility.** Given refresh, reconnect, workspace/language change, parallel tab, URL/back navigation or reduced-motion preference, when onboarding restores, then identity/revision/request-generation guards reject stale completion and keyboard/focus/screen-reader status follows the shared UI contract.
10. **Local ProductEvents.** Given onboarding eligibility/start/complete/abandon, when a milestone is recorded, then an immutable versioned idempotent bounded local ProductEvent records an explicit eligible denominator for SM-11–SM-13; raw user/object identifiers, key material, payload and usage never leave the installation without opt-in.
11. **Real-stack verification.** Given the fresh manual REST path, when Playwright and MCP integration suites run, then success uses the public MCP endpoint without test bypass and covers refresh/resume, stale revision, lost key, failure recovery, RU/EN and accessibility; manual protocol measures first UI render to authoritative first call, counts non-completers, and targets median ≤15 minutes.
12. **Repository quality.** Given implementation complete, when targeted suites, UI build/Playwright, SQLx/capability/scope gates and `just verify` run, then all pass and story/sprint status move to review only after evidence exists.
## Tasks / Subtasks
- [x] Task 1 — Freeze onboarding oracle and RED evidence (AC: 1–12)
- [x] Characterize existing Operation/test/publish, Agent/version, key and public MCP flows; preserve their contracts.
- [x] Add RED registry/Admin/MCP tests for authoritative projection, exact key-scoped success, state regression, idempotent events and cross-workspace denial.
- [x] Add RED Playwright flow for success, resume, stale revision, lost key, recovery, RU/EN and accessibility without mocked completion.
- [x] Task 2 — Typed ProductEvent and exact invocation credential evidence (AC: 2, 7, 10)
- [x] Add closed core ProductEvent/onboarding milestone types with schema version, occurred-at, eligible cohort timestamp and bounded idempotency key.
- [x] Add append-only V11 migration, schema guard/checksum/owned relations and indexed immutable ProductEvent persistence with unique workspace idempotency.
- [x] Propagate optional typed PlatformApiKeyId from verified Community credential into Invocation History and successful MCP event; external verifier paths may remain unscoped and cannot complete exact-key onboarding.
- [x] Prove secret canaries are absent from DB events/history, logs, metrics and boundary responses.
- [x] Task 3 — Server-authoritative onboarding projection (AC: 1–4, 6–10)
- [x] Implement one bounded workspace snapshot over published Operation/test evidence, Published Agent exact binding/catalog revision, active MCP key metadata and exact scoped successful tools/call.
- [x] Make deleted/archived/revoked/stale facts regress steps; never accept client-provided completion state.
- [x] Record eligible/start/complete/abandon milestones idempotently with explicit local denominator and UTC timing.
- [x] Avoid N+1/history materialization; add query/index evidence and cross-workspace non-disclosure tests.
- [x] Task 4 — Admin API and safe connection contract (AC: 1, 4–10)
- [x] Add authenticated workspace-scoped onboarding GET projection and bounded UX-event mutation; mutation cannot mark domain steps complete.
- [x] Return stable step/status/recovery/error/support-ID DTOs and server-built canonical MCP endpoint; enforce revision/identity guards.
- [x] Extend create-key response with ephemeral representative-client configuration derived from canonical endpoint and raw secret, while all later reads remain metadata-only.
- [x] Add route metrics registry entry, HTTP integration tests, CSRF/authz/cross-workspace negatives and no-secret response/log evidence.
- [x] Task 5 — Getting Started UI over existing flows (AC: 1, 3–6, 8–9)
- [x] Add protected shared onboarding component/bundle integration and render it without blocking existing pages/navigation.
- [x] Deep-link to existing manual REST wizard, test/publish, Agents, keys and Logs; carry only non-secret selection/revision hints in URL.
- [x] Show one-time key/config only in the create response view, never persist/reconstruct it; make ambiguous create failure non-auto-retry and explain rotation. <!-- community-scope: allow=one-time-token -->
- [x] Implement loading/error/retry/collapse/dismiss/resume, workspace/session/language/visibility refresh and generation guards.
- [x] Task 6 — Accessibility, localization and real-stack E2E (AC: 7–11)
- [x] Add all RU/EN strings together, safe DOM rendering, bounded failure copy and support IDs.
- [x] Add keyboard order, focus restoration, `aria-live` status, semantic progress and reduced-motion CSS.
- [x] Run real public MCP initialize → tools/list → tools/call with a one-time key and assert exact Agent/key/Operation version plus Request ID/Trace ID/history link. <!-- community-scope: allow=one-time-token -->
- [x] Cover refresh/parallel tabs, workspace/language change, stale response/revision, revoked/lost key and validation/upstream/auth/compatibility recovery.
- [x] Task 7 — Docs, usability protocol, gates and handoff (AC: 10–12)
- [x] Update Admin API/data model/MCP/manual regression docs, capability inventory and baseline evidence only after tests pass.
- [x] Document a five-participant fresh-install usability protocol: no docs/code assistance, timer from first authenticated render to authoritative success, median ≤15m, non-completers/censoring and eligible denominator recorded separately.
- [x] Run targeted Rust suites, UI build/Playwright, migration/SQLx/capability/community-scope checks, secret scan and final `just verify`.
- [x] Update Dev Agent Record, File List, Change Log and story/sprint status to review only after all gates pass.
### Review Findings
- [x] [Review][Patch] [High] Persist exact completed lineage and add explicit server-side Reset/Reselect; never silently replace it with another Operation/Agent/key path — decision: exact lineage with deliberate administrator recovery [crates/crank-registry/src/postgres/onboarding.rs:81]
- [x] [Review][Patch] [High] Default onboarding MCP key lacks `write`, so generated credentials cannot execute `tools/call` [apps/ui/js/api-keys.js:684]
- [x] [Review][Patch] [High] Representative desktop-client configs contain a relative MCP URL instead of the validated absolute public URL [apps/admin-api/src/service.rs:1069]
- [x] [Review][Patch] [High] Approval credentials are incorrectly embedded into MCP/LLM client configs [apps/admin-api/src/service/api_keys.rs:167]
- [x] [Review][Patch] [High] Fallible workspace/Agent reads after key persistence can lose the only raw secret and invite duplicate creation [apps/admin-api/src/service/api_keys.rs:167]
- [x] [Review][Patch] [High] Ambiguous key-create failures immediately re-enable Create without mandatory metadata reconciliation [apps/ui/js/api-keys.js:725]
- [x] [Review][Patch] [High] Raw key/config is wiped before asynchronous clipboard write is known to have succeeded [apps/ui/js/api-keys.js:287]
- [x] [Review][Patch] [High] Client-controlled idempotency keys can occupy the reserved server completion namespace; duplicate conflicts do not verify semantic equality [crates/crank-registry/src/postgres/product_event.rs:34]
- [x] [Review][Patch] [High] `expected_revision` check and ProductEvent append are separate transactions rather than an atomic CAS [crates/crank-registry/src/postgres/onboarding.rs:335]
- [x] [Review][Patch] [High] Completion ProductEvent is emitted only on a later Admin GET and timestamps UI revisit instead of the first MCP call [apps/admin-api/src/service/onboarding.rs:28]
- [x] [Review][Patch] [High] Normal UI never emits `onboarding_started` or `onboarding_abandoned`, leaving funnel metrics incomplete [apps/ui/js/onboarding.js:279]
- [x] [Review][Patch] [Medium] Completion view omits required Tool and timestamp and does not require the full support-identifier presentation [apps/ui/js/onboarding.js:162]
- [x] [Review][Patch] [Medium] First eligible protected render keeps the checklist closed instead of showing it once until collapse/dismiss [apps/ui/js/onboarding.js:306]
- [x] [Review][Patch] [Medium] Stale Operation/Agent revision deep links fail silently without explicit refresh/reselection recovery [apps/ui/js/api-keys.js:246]
- [x] [Review][Patch] [Medium] Real-stack Playwright provisions the journey through direct API calls and mocks recovery, so the actual checklist/wizard/Agent/key UX remains unproved [apps/ui/tests/e2e/onboarding.spec.js:397]
- [x] [Review][Patch] [Medium] Natural key expiry changes progress without changing the opaque projection revision [crates/crank-registry/src/postgres/onboarding.rs:197]
- [x] [Review][Patch] [Medium] Idempotent replay lookup scans only the latest 1000 ProductEvents instead of the unique key [apps/admin-api/src/service/onboarding.rs:69]
- [x] [Review][Patch] [Medium] Invocation History retention deletes the only exact onboarding evidence and reopens completed onboarding after the retention horizon [crates/crank-registry/src/postgres/observability.rs:70]
- [x] [Review][Patch] [Medium] V11 schema guard checks names/presence but not all ProductEvent constraints, index definitions and function contract [crates/crank-registry/src/migrations/schema_guard_v11.rs:25]
- [x] [Review][Patch] [Medium] A completed GET recomputes the correlated projection three times and performs duplicate write transactions; browser refresh signals are not coalesced [apps/admin-api/src/service/onboarding.rs:24]
- [x] [Review][Patch] [Low] Workspace `ON DELETE CASCADE` conflicts with the unconditional ProductEvent append-only delete trigger [crates/crank-registry/src/migrations/onboarding_product_events_v11.sql:20]
## Dev Notes
### Current State / Reuse Map
- Operations: reuse `PostgresRegistry::{list_operations,get_operation_summary,get_operation_version}` and `AdminService::{list_operations,get_operation}`; existing routes own create/test/publish semantics.
- Agents: reuse `list_agents/get_agent_summary/get_agent_version`; `AgentSummary` already exposes published version and `catalog_revision`; route ETag/CAS guards remain mandatory.
- Keys: reuse `create_agent_platform_api_key`, list/revoke/delete. `CreatedPlatformApiKeyResponse` is the only raw-secret boundary; list records contain metadata/status/last-used only.
- MCP endpoint: reuse `AdminService::agent_mcp_endpoint` and canonical `/mcp/v1/{workspace_slug}/{agent_slug}` contract from `docs/mcp-interface.md`; do not assemble it from browser localStorage.
- First call: Invocation History already stores workspace, Agent, Operation/version, Tool, outcome, request_id/trace_id/time, but lacks key ID. `VerifiedMachineCredential` currently drops key identity; extend this narrow path rather than creating synthetic success.
- ProductEvents: architecture requires a typed core event and idempotent registry fold, but no implementation/table exists yet. Story 1.16 introduces the minimal reusable foundation; Epic 5 may extend event kinds/rollups later.
- UI is multi-page vanilla JS/Alpine with shared `protected-core`. Prefer an IIFE `window.CrankOnboarding` loaded by protected-core and a reusable DOM host injected by build/templates; avoid duplicate page-specific state machines.
### Architecture and Security Guardrails
- PostgreSQL is source of truth. V11 must be append-only, checksummed, applied only by migration authority and covered by fresh/N-1 schema guards.
- Domain completion is derived server-side. Client event endpoint may record presentation milestones only; it cannot submit `step=complete` as truth.
- ProductEvents are immutable, versioned and idempotent. Event names/versions are closed enums; payload/cardinality/length are bounded. IDs never become metric labels.
- Every query/mutation includes workspace scope. Foreign IDs use indistinguishable empty/not-found behavior.
- Raw key is forbidden in storage, ProductEvents, local/session storage, URL, telemetry, snapshots, diagnostics, clipboard readback and repeat API reads.
- Key creation is not automatically retried after an ambiguous response because that may mint duplicate secrets. Recovery requires refresh/list metadata and deliberate new key/rotation.
- Operation/Agent mutations keep existing CAS/revision semantics. Onboarding may recommend an action but cannot weaken preconditions.
- External verifier credentials without a local typed key reference cannot satisfy exact-key completion.
- Request ID and Trace ID are support identifiers, not metric labels. UI shows/copies them without payload.
- No new dependency, framework, MSRV/toolchain change or frontend state model.
### Likely File Map
Likely NEW:
- `crates/crank-core/src/product_event.rs`
- `crates/crank-registry/src/migrations/onboarding_product_events_v11.rs`
- `crates/crank-registry/src/migrations/onboarding_product_events_v11.sql`
- `crates/crank-registry/src/migrations/schema_guard_v11.rs`
- `crates/crank-registry/src/postgres/onboarding.rs`
- `crates/crank-registry/tests/integration/onboarding.rs`
- `apps/admin-api/src/routes/onboarding.rs`
- `apps/admin-api/src/service/onboarding.rs`
- `apps/admin-api/tests/integration/onboarding.rs`
- `apps/mcp-server/tests/onboarding.rs` or integration module under existing harness
- `apps/ui/js/onboarding.js`
- `apps/ui/css/onboarding.css`
- `apps/ui/tests/e2e/onboarding.spec.js`
Likely UPDATE:
- `crates/crank-core/src/lib.rs`, credential and observability types
- `crates/crank-registry/src/{lib.rs,model.rs,postgres/mod.rs,migrations.rs}` and migration authority/owned relations/schema guard
- MCP verifier/app/invocation-history path and associated tests
- `apps/admin-api/src/{app.rs,dto.rs,error.rs,service.rs}` and metrics route schema
- `apps/ui/js/{api.js,i18n.js}`, `apps/ui/scripts/build.js`, protected HTML templates/shared CSS
- `docs/{admin-api.md,data-model.md,mcp-interface.md,manual-regression-checklist.md,capability-inventory.json,migrations.md}` and baseline manifest/results.
### Required Test Matrix
- Snapshot: no objects; draft only; tested unpublished Operation; Published Operation; stale exact version; Published Agent; active/revoked/deleted/lost key; success exact key; foreign/unscoped success rejected.
- Regressions: archive/delete/revoke/re-publish/rebind and stale catalog revision return steps to actionable state.
- Events: eligible/start/complete/abandon are idempotent across refresh/parallel tabs; explicit denominator and UTC duration; unknown client completion is impossible; retention preserves denominators.
- Security: raw-key canary absent from DB, logs, history preview, ProductEvents, metrics, URLs/storage and test artifacts; cross-workspace cannot infer counts/state.
- MCP: public initialize, discovery and tools/call with real bearer and upstream; exact key/Agent/Operation/version/request_id/trace_id asserted; auth/compatibility/upstream/validation failures recover.
- UI: optional collapse/dismiss/resume; loading/empty/error/retry; reordered responses; workspace/session/language/visibility changes; back navigation and deep links; no duplicate publication/key creation.
- Accessibility: keyboard-only flow, focus after errors/actions, semantic checklist and live announcements, RU/EN, reduced motion.
### Verification Commands
```bash
cargo test -p crank-core product_event -- --test-threads=1
cargo test -p crank-registry --test integration onboarding -- --test-threads=1
cargo test -p admin-api --test integration onboarding -- --test-threads=1
cargo test -p mcp-server --test onboarding -- --test-threads=1
just ui-build
cd apps/ui && npx playwright test tests/e2e/onboarding.spec.js --project=chromium
just migration-check
just sqlx-check
just capability-inventory-check
python3 scripts/check-community-scope.py --root . --files <Story 1.16 files>
git diff --check
just verify
```
### References
- `_bmad-output/planning-artifacts/epics.md` — Epic 1, Story 1.16.
- `_bmad-output/planning-artifacts/prds/prd-crank-2026-08-03/prd.md` — FR-1, FR-3, FR-4, FR-33, SM-11–SM-13.
- `_bmad-output/planning-artifacts/architecture/architecture-crank-2026-08-03/ARCHITECTURE-SPINE.md` — AD-1, AD-2, AD-11, AD-13, AD-16, AD-19, AD-22.
- `_bmad-output/project-context.md` — Rust/JS boundaries, testing, security and UI stale-response rules.
- `_bmad-output/implementation-artifacts/1-15-invocation-history-usage.md` — previous-story invocation/history/usage contracts.
- `docs/mcp-interface.md` — canonical public endpoint and JSON-RPC flow.
## Dev Agent Record
### Agent Model Used
GPT-5.6 Codex (Sol) с маршрутизированными Luna/Terra subagents
### Debug Log References
- 2026-08-23T11:20:00+03:00 — Created Story 1.16 context from Epic 1, PRD/architecture, Story 1.15 lessons and current Operation/Agent/key/MCP/UI implementation.
- 2026-08-23T11:24:00+03:00 — Story context validated; baseline captured; implementation started with RED registry/Admin/MCP/UI evidence.
- 2026-08-24T00:07:00+03:00 — Task 1 RED complete: registry tests fail on missing V11/ProductEvents/key identity, Admin tests on missing onboarding routes, MCP test on absent exact-key invocation evidence, Playwright on absent checklist UI.
- 2026-08-24T00:31:00+03:00 — Task 2 GREEN complete: typed ProductEvents with eligible cohort time, V11 append-only persistence/rollups, exact MCP key identity in Invocation History and raw-bearer non-persistence evidence.
- 2026-08-24T00:51:00+03:00 — Task 3 GREEN complete: bounded seven-step registry projection, terminal-success oracle, honest revoke/stale regression and idempotent revision-guarded milestones; fixed RFC3339 cohort persistence found by Docker test.
- 2026-08-24T01:04:00+03:00 — Task 4 GREEN complete: authenticated onboarding GET/events API, stable CAS/error contract, sanitized first-call evidence and ephemeral three-client key connection configs; corrected measured metrics budget.
- 2026-08-24T01:24:00+03:00 — Task 5 GREEN complete: shared protected Getting Started UI, safe deep links, stale guards and one-time connection reveal/lost-key recovery; focused Playwright 3/3 passes after fixing test synchronization. <!-- community-scope: allow=one-time-token -->
- 2026-08-24T03:00:00+03:00 — Task 6 GREEN complete: RU/EN и accessibility contracts, persisted dismiss/resume, exact public MCP identity/version evidence и отдельные validation/upstream/auth/compatibility recovery scenarios; focused Playwright 8/8.
- 2026-08-24T03:22:00+03:00 — Adversarial review closed: archived exact lineage no longer silently switches to an alternative path; republish/key-expiry/revoke boundaries and full regression evidence revalidated.
- 2026-08-24T03:22:35+03:00 — Task 7 GREEN complete: docs/baselines/protocol updated, full UI 43/43 and final `just verify` pass; story and sprint moved to review.
- 2026-08-24T10:52:28+03:00 — Review PATCH complete: all 21 adversarial findings resolved; targeted backend 51/51, related UI 25/25, UI build, code-health, migration, SQLx, dependency, clippy and full `just verify` gates passed.
### Completion Notes List
- Ultimate context engine analysis completed — comprehensive developer guide created.
- Task 1 closed with compiling RED contracts across registry, Admin API, public MCP and real-stack Playwright; observed failures are feature gaps, not syntax or fixture failures.
- Task 2 closed: core ProductEvent tests 2/2, registry onboarding tests 4/4, public MCP exact-key/no-secret test 1/1 and MCP regression 35/35 pass.
- Task 3 closed: registry onboarding projection suite 6/6 passes against PostgreSQL, including completion/regression, cross-workspace FK, ProductEvent idempotency and stale revision.
- Task 4 closed: Admin onboarding tests 2/2, credential lifecycle 8/8 and metrics schema 8/8 pass; canonical metrics contract regenerated and validated.
- Task 5 closed: UI Docker build passes; checklist/resume/stale-response/one-time-key focused Playwright scenarios pass 3/3 with raw secret absent after navigation. <!-- community-scope: allow=one-time-token -->
- Task 6 closed: focused Playwright 8/8 and full UI regression 43/43 pass. The real-stack scenario performs initialize → notifications/initialized → tools/list → tools/call through the public endpoint and asserts exact Agent/key/Operation/version plus Request ID, Trace ID and Invocation History link.
- Review correction closed: historical successful lineage remains selected across archive while current Operation/Agent/key flags regress independently; an alternative Published path can no longer hide invalidation of the completed path.
- Review correction closed: dismiss is persisted per workspace, survives reload and exposes an explicit localized Resume action; 422 validation, 502 upstream, 426 compatibility and 401 authentication recovery remain incomplete until authoritative server evidence exists.
- Task 7 closed: ProductEvent/V11, Admin/MCP/UI and documentation contracts are synchronized. The five-participant usability protocol is executable but intentionally recorded as `not_run`; no measured ≤15-minute claim is made.
- Final evidence: core ProductEvent 2/2, registry onboarding 10/10, Admin onboarding 3/3, MCP onboarding 1/1, migration suite 23/23, focused UI 8/8, full UI 43/43, SQLx offline check and `just verify` pass. Dependency audit reports 0 vulnerabilities; the million-row production-size query-plan test remains explicitly ignored for dedicated release hardware.
- Capability baseline `2026.08.24.1` validates 35 flows. Onboarding release flows remain honestly `blocked` until a clean committed source revision and collector report exist; this is release evidence debt, not an implementation blocker.
- Code review closed 21/21 findings: exact lineage/reset, executable default MCP key, absolute safe client configuration, one-time-secret recovery, atomic/idempotent events, call-time completion, complete funnel/UI evidence, expiry/retention/schema integrity and coalesced reads are all covered. Story 1.16 is `done`; no unresolved High or Medium findings remain.
### File List
- `_bmad-output/implementation-artifacts/1-16-mcp-tool-call.md`
- `_bmad-output/implementation-artifacts/sprint-status.yaml`
- `apps/admin-api/src/app.rs`
- `apps/admin-api/src/dto.rs`
- `apps/admin-api/src/error.rs`
- `apps/admin-api/src/routes.rs`
- `apps/admin-api/src/routes/onboarding.rs`
- `apps/admin-api/src/service.rs`
- `apps/admin-api/src/service/api_keys.rs`
- `apps/admin-api/src/service/onboarding.rs`
- `apps/admin-api/tests/integration.rs`
- `apps/admin-api/tests/integration/onboarding.rs`
- `apps/admin-api/tests/migration_command.rs`
- `apps/mcp-server/tests/onboarding.rs`
- `apps/ui/css/onboarding.css`
- `apps/ui/html/api-keys.html`
- `apps/ui/js/agents.js`
- `apps/ui/js/api-keys.js`
- `apps/ui/js/api.js`
- `apps/ui/js/i18n.js`
- `apps/ui/js/onboarding.js`
- `apps/ui/js/wizard-live.js`
- `apps/ui/js/wizard-model.js`
- `apps/ui/js/wizard.js`
- `apps/ui/scripts/build.js`
- `apps/ui/scripts/playwright-http-fixture.js`
- `apps/ui/scripts/playwright-stack.sh`
- `apps/ui/scripts/playwright-ui-server.js`
- `apps/ui/tests/e2e/helpers.js`
- `apps/ui/tests/e2e/onboarding.spec.js`
- `apps/ui/tests/e2e/api-keys.spec.js`
- `apps/ui/tests/e2e/operations.spec.js`
- `apps/ui/tests/e2e/wizard.spec.js`
- `crates/crank-community-mcp/src/access.rs`
- `crates/crank-community-mcp/src/app.rs`
- `crates/crank-community-mcp/src/app/approval_policy.rs`
- `crates/crank-community-mcp/src/app/invocation_history.rs`
- `crates/crank-core/src/ext/auth.rs`
- `crates/crank-core/src/ids.rs`
- `crates/crank-core/src/lib.rs`
- `crates/crank-core/src/observability.rs`
- `crates/crank-core/src/onboarding.rs`
- `crates/crank-core/src/product_event.rs`
- `crates/crank-metrics/src/schema.rs`
- `crates/crank-metrics/tests/schema_v1.rs`
- `crates/crank-registry/src/error.rs`
- `crates/crank-registry/src/lib.rs`
- `crates/crank-registry/src/migrations.rs`
- `crates/crank-registry/src/migrations/authority.rs`
- `crates/crank-registry/src/migrations/authority_tests.rs`
- `crates/crank-registry/src/migrations/onboarding_product_events_v11.rs`
- `crates/crank-registry/src/migrations/onboarding_product_events_v11.sql`
- `crates/crank-registry/src/migrations/owned_relations.rs`
- `crates/crank-registry/src/migrations/schema_guard.rs`
- `crates/crank-registry/src/migrations/schema_guard_v11.rs`
- `crates/crank-registry/src/model.rs`
- `crates/crank-registry/src/postgres/mod.rs`
- `crates/crank-registry/src/postgres/observability.rs`
- `crates/crank-registry/src/postgres/onboarding.rs`
- `crates/crank-registry/src/postgres/product_event.rs`
- `crates/crank-registry/tests/integration.rs`
- `crates/crank-registry/tests/integration/common.rs`
- `crates/crank-registry/tests/integration/migrations.rs`
- `crates/crank-registry/tests/integration/migrations/rollback.rs`
- `crates/crank-registry/tests/integration/onboarding.rs`
- `crates/crank-registry/tests/integration/onboarding_lifecycle.rs`
- `docs/admin-api.md`
- `docs/capability-baseline/manifest.json`
- `docs/capability-baseline/manual-checklist.md`
- `docs/capability-baseline/outcome-taxonomy.json`
- `docs/capability-baseline/required-surfaces.json`
- `docs/capability-baseline/results.json`
- `docs/capability-inventory.json`
- `docs/data-model.md`
- `docs/database-schema.md`
- `docs/en/migrations.md`
- `docs/manual-regression-checklist.md`
- `docs/mcp-interface.md`
- `docs/migrations.md`
- `docs/schemas/metrics-registry-v1.json`
- `docs/schemas/migration-sequence.json`
## Change Log
- 2026-08-23 — Created Story 1.16 with server-authoritative onboarding, exact key-scoped MCP success and local ProductEvent context.
- 2026-08-24 — Implemented ProductEvent/V11 persistence, authoritative seven-step projection, safe Admin API, Getting Started UI and real public MCP acceptance flow.
- 2026-08-24 — Closed adversarial review findings for archive-lineage regression, persisted dismiss/resume, exact identity/version assertions and typed failure recovery; moved story to review after full gates passed.
- 2026-08-24 — Froze RED registry/Admin/MCP/Playwright contracts for Story 1.16.
- 2026-08-24 — Added typed ProductEvents, V11 persistence and exact key-scoped MCP invocation evidence.
- 2026-08-24 — Added and verified server-authoritative onboarding projection and milestone state.
- 2026-08-24 — Added Admin onboarding API, ephemeral connection guidance and fixed-route metrics contract.
- 2026-08-24 — Added protected Getting Started UI, existing-flow deep links and secure one-time connection UX. <!-- community-scope: allow=one-time-token -->
- 2026-08-24 — Resolved all 21 adversarial review findings and closed Story 1.16 after the complete repository verification passed.