# Platform — implementation spec (`stub/` + `spa/`)

"Notre Plateforme" in the POC is **an Angular SPA** carrying every screen, plus a **tiny Node
stub** for the handful of endpoints a real downstream process (the PDS) genuinely calls. No
real backend, no database, no real itsme. Rationale: [architecture.md §6/§7](../architecture.md).
Shared wire formats: [`../contracts.md`](../contracts.md).

```
platform/
  stub/     Node + Express + jose, in-memory state        ← global build step 1
  spa/      Angular, standalone components + state services ← global build step 7
```

One spec, two parts: the stub exists only to serve the SPA's downstream, so splitting them
would be constant cross-reference.

---

## Part A — `stub/`

### A1. Scope & build order

Global **step 1** ([contracts §0](../contracts.md)) — nothing else can sign or verify a token
until it exists. Depends only on [contracts §1](../contracts.md) (JWT), [§3](../contracts.md)
(signing key), [§4](../contracts.md) (seed), [§5](../contracts.md) (its own API).

Build it **before** the SPA (step 7), **before** the Outil Local runtime (step 5), **before**
the PDS isolated filter (step 6).

### A2. Tech

| Concern | Choice |
|---|---|
| Runtime | Node 20 LTS, TypeScript, Express |
| JWT | `jose` (`SignJWT`, `exportJWK`) |
| State | in-memory `Map`s — no DB. Restart ⇒ re-run registration + mandate ([contracts §7](../contracts.md) S13) |
| Signing key | read `deploy/keys/platform-signing.jwk.json` (RSA, `kid platform-poc-1`) at boot; `/jwks.json` serves its public half. Generated by `deploy/gen-keys.sh` |
| Port | `3000` |
| Config | env: `PLATFORM_ISSUER`, `PDS_MCP_URI`, `PDS_DISCOVERY_URI`, `SIGNING_KEY_PATH`, **`PDS_ASSERT_URI`**, **`PDS_ASSERTION_JWKS_URI`**, **`PDS_ASSERT_DEV_SECRET`** ([contracts §6](../contracts.md)) |

### A3. In-memory state (shapes, not tables)

```ts
providers: Map<providerId, {
  providerId: string;               // UUIDv4, the mandate-link id
  mcpEndpoint: string;              // as declared at registration
  confirmedTools: ToolDef[];        // frozen tools/list result at "J'accepte"
  schemaSha256: string;             // fingerprint of the confirmed tools/list
  confirmedAt: string;
}>

mandates: Map<jti, {
  jti: string;
  sub: string;                     // itsme:be:...
  aud: string;                     // == PDS_MCP_URI
  agentLabel: string;
  providerAccountRefValue: string; // from the link session (= verified assertion.sub)
  allowedTools: string[];
  purpose: string;
  iat: number; exp: number;
  status: "VALID" | "REVOKED";
  revokedAt?: number;
}>

audit: Map<jti, Array<{ ts: string; event: "MANDATE_ISSUED"|"INTROSPECT_CALLED"|"MANDATE_REVOKED"|"ACCOUNT_LINK_VERIFIED"|"SETUP_CODE_REDEEMED"; detail: object }>>

// account-linking (contracts §8) — replaces the old SEED_ACCOUNT_LINK map
linkSessions: Map<linkSessionId, {
  providerId: string;
  providerAccountRefValue: string; // assertion.sub, after verification
  providerJkt: string;             // thumbprint of the PDS JWKS key that verified the assertion
  assertedAt: number;              // assertion.iat
  rawAssertion: string;            // compact JWS — embedded verbatim into the mandate token
  expiresAt: number;               // now + 600 (contracts §4)
}>
usedAssertionJti: Set<string>      // single-use guard for assertion jti (in-memory, lost on restart)
```

### A4. HTTP API

Full request/response bodies and status codes: **[contracts §5](../contracts.md)** (single
source — do not restate here). Summary + side effects:

| Endpoint | Caller | Side effect |
|---|---|---|
| `GET /jwks.json` | PDS filter | — |
| `POST /discover` | SPA registration | server-side JSON-RPC `initialize` + `tools/list` to `mcp_endpoint`; dodges browser CORS |
| `POST /providers` | SPA registration finalize | create `providers` entry, generate `providerId` (or use the fixed one from [contracts §4](../contracts.md)), store `confirmedTools` + `schemaSha256` + the step 1 identity fields (`company_name`/`registration_number`/`contact_email` → `companyName`/`registrationNumber`/`contactEmail`, all optional at the wire level, not verified against any registry) |
| `GET /providers/:id` | SPA mandate form (B5) | — (returns the stored provider record; `404 unknown_provider`) |
| `POST /account-link/initiate` | SPA espace-client (B3) | call `PDS_ASSERT_URI` (+ `X-Poc-Dev-Auth`); verify the returned assertion per [contracts §8.4](../contracts.md) (sig via `PDS_ASSERTION_JWKS_URI`, `aud`, `iss`, `exp`, `jti` unseen → add to `usedAssertionJti`); create a `linkSessions` entry; audit `ACCOUNT_LINK_VERIFIED` |
| `POST /mandates` | SPA mandate form | load + validate the `linkSessions` entry by `link_session_id` (exists, not expired, `providerId` matches → else the `link_session_*` errors); take `providerAccountRefValue` / `providerJkt` / `assertedAt` / `rawAssertion` from it; mint JWT ([contracts §1](../contracts.md)) with the full `provider_account_ref` object; **consume the link session**; store; also mint a one-time setup code bound to the `jti` ([contracts §9](../contracts.md)); audit `MANDATE_ISSUED` |
| `POST /setup-codes/:code/redeem` | `mcp-server setup` (outil-local, not the SPA) | validate + **burn** the code (single-use); return `{AGENT_DELEGATION_TOKEN, PROVIDER_API_ENDPOINT}`; `404 unknown_code` / `410 code_expired`; audit `SETUP_CODE_REDEEMED` — full shape [contracts §9](../contracts.md) |
| `GET /introspect/:jti` | PDS filter, every call | audit `INTROSPECT_CALLED {caller_ip, result}`; compute `active` = `status==VALID && now<exp` |
| `POST /mandates/:jti/revoke` | SPA dashboard, and the mandate form's pre-submit "Replace" flow (§B5, [contracts §9.4](../contracts.md)) | `status=REVOKED`, `revokedAt=now`; audit `MANDATE_REVOKED` |
| `GET /mandates?itsme_sub=` | SPA dashboard, and the mandate form's pre-submit collision check (§B5) | requires `itsme_sub` → else `400 missing_itsme_sub` (never "all", never silent `[]` — [contracts §5.6](../contracts.md)); list view survives a page reload; rows now include `provider_id`/`agent_label` (added 2026-09-19, [contracts §5.6](../contracts.md)) |
| `GET /audit/:jti` | SPA dashboard + demo step 8 | — (returns the Trace Plateforme; the dashboard fetches the PDS's own `GET /mcp-audit/:jti`, contracts §8.6, directly and separately for the Trace Prestataire — not through this endpoint or the stub at all) |

> `POST /providers` is a small addition beyond [architecture.md §5](../architecture.md)'s list,
> matching the `GET /mandates` addition — both keep SPA state honest across reloads instead of
> living only in Angular services.

### A5. JWT minting

- Header `{ alg:"RS256", typ:"at+jwt", kid:"platform-poc-1" }`.
- Claims exactly per [contracts §1](../contracts.md). `iat = now`, `exp = iat + ttl_seconds`
  (default 3600), `jti = randomUUID()`.
- `provider_account_ref` = `{ value: linkSession.providerAccountRefValue,
  source:"signed_assertion", asserted_at: linkSession.assertedAt,
  provider_jkt: linkSession.providerJkt, assertion: linkSession.rawAssertion }` — the value +
  jkt + raw JWS all come from the verified link session ([contracts §8](../contracts.md)),
  never from `sub`.
- `aud` = `PDS_MCP_URI` (identifier, not the provider UUID).
- `transparency.audit_log` / `revocation_check` = the canonical `PLATFORM_ISSUER/...` URLs
  (unreachable by design; the SPA reads audit from `http://localhost:3000/audit/:jti`).

### A6. Scenarios

| # | Case | Expected |
|---|---|---|
| A-1 | sign happy path | valid RS256 JWS, verifiable against `/jwks.json`, all claims incl. `provider_account_ref.assertion` present |
| A-2 | `POST /mandates` with unknown / expired / cross-provider `link_session_id` | `400 unknown_link_session` / `link_session_expired` / `link_session_provider_mismatch`, nothing stored |
| A-2b | `/account-link/initiate` happy path | `200` with `link_session_id`; a `linkSessions` entry exists; audit `ACCOUNT_LINK_VERIFIED` |
| A-2c | `/account-link/initiate`, assertion signature bad / `aud` wrong / `jti` reused | `422 assertion_invalid` with matching `detail`; no link session |
| A-2d | `/account-link/initiate`, `PDS_ASSERT_URI` unreachable | `502 assertion_fetch_failed` |
| A-3 | introspect a VALID, unexpired `jti` | `200 active:true`, audit row added |
| A-4 | introspect after revoke | `200 active:false reason:revoked` |
| A-5 | introspect past `exp` | `200 active:false reason:expired` |
| A-6 | introspect unknown `jti` | `404 unknown_jti` |
| A-7 | `/discover` to an unreachable endpoint | `502 discovery_failed`, SPA shows the error, no provider created |
| A-8 | stub restarted | `mandates`/`providers`/`audit`/`linkSessions`/`usedAssertionJti` empty → prior `jti` introspects `404` → PDS fail-closes |

---

## Part B — `spa/`

### B1. Scope & build order

Global **step 7**. Depends on the stub (step 1). Can start right after step 1; use a canned
`tools/list` fixture for the registration screen until the PDS MCP route (step 4) is reachable
through `/discover`.

### B2. Tech & state

| Concern | Choice |
|---|---|
| Framework | Angular (standalone components, `provideRouter`) |
| Serving | `ng serve` on the host, port `4200` — **not** containerised ([architecture.md §5.1](../architecture.md)) |
| Downstream | one `ApiService` → the stub at `http://localhost:3000` |
| State | in-memory Angular services (below). No `json-server`, no persistence. The **mandate list and audit come from the stub**, not local state, so a reload is fine ([architecture.md §10](../architecture.md) open point resolved: stub-backed for those two, service-backed for ephemeral UI only) |

| Service | Holds | Backed by |
|---|---|---|
| `SessionService` | current fake itsme identity (`sub`, display name); current PDS-admin flag | memory (cleared on reload — acceptable) |
| `RegistrationService` | in-progress registration (endpoint, discovered tools, review model) | memory + `POST /providers` on accept |
| `LinkService` | `initiate(providerId, pdsCustomerId)` → `POST /account-link/initiate`; holds the returned `{ link_session_id, provider_account_ref, expires_at }` for the mandate form | memory + stub (cleared on reload — the espace-client step is re-done) |
| `MandateService` | `list(itsmeSub)` → `GET /mandates`; `revoke(jti)` → `POST …/revoke`; `create(...)` → `POST /mandates` (sends `link_session_id` from `LinkService`) | stub |
| `AuditService` | `get(jti)` → `GET /audit/:jti` | stub |

### B3. Screens / routes

Two entry-point routes sit in front of everything below — added 2026-09-14 so nobody lands
cold on an admin login screen, and so the persistent nav never shows both personas' controls
regardless of who's connected (both were previously true and Raul correctly flagged them as
bad UX):

| Route | Persona | Purpose | Calls |
|---|---|---|---|
| `/` | anyone | public landing page — explains the concept in plain language, one CTA ("Se connecter") | — |
| `/connexion` | anyone | persona chooser, plain-language labels instead of internal jargon: **Particulier** (the human mandator) vs **Professionnel** (the provider/PDS admin) — routes to `/itsme` or `/admin/login` respectively | — |

| Route | Persona | Purpose | Calls |
|---|---|---|---|
| `/admin/login` | Professionnel | fake login, `admin@bqt.example` / `demo` checked in-SPA (no IdP). Sets admin flag | — |
| `/admin/register` | Professionnel | **Guarded** (`adminGuard`: needs the admin flag, else → `/admin/login`). **2 steps**, `RegistrationService.step`, with a step indicator: **1 — Identité du prestataire** (raison sociale, numéro d'entreprise BCE/KBO, contact technique — declarative, not registry-verified, gates "Continuer" on all 3 non-empty) → **2 — Intégration technique**, unchanged Phase 0: MCP endpoint → **Discover** → deterministic review screen → **J'accepte** → show `provider_id` + mandate link. "← Retour à l'identité" goes back to step 1 without losing step 2's in-progress state | `POST /discover`, `POST /providers` |
| `/pds-space?provider=<uuid>` | Particulier | **Fake "Banque Test — Espace client"** (Phase 2.0ter). The human "arrives already logged into their bank". Pick which BQT customer you are (Pieter/Sofie/Noah → `cust-00x`, [contracts §4](../contracts.md)); click **"Configurer un agent IA"** → obtains a signed account-link assertion | `POST /account-link/initiate` |
| `/itsme` | Particulier | fake "Sign in with itsme": pick one of 3 identities ([contracts §4](../contracts.md)). Sets `SessionService` | — |
| `/mandate/new?provider=<uuid>` | Particulier | **Guarded** (`mandateFormGuard`, chain below). Phase 2 form (below). Needs a `LinkService` session + an itsme identity. On submit → show `ready_to_use_config` (copy button) | `POST /mandates` |
| `/dashboard` | Particulier | **Guarded** (`itsmeGuard`: needs an itsme identity, else → `/itsme`). Phase 5: list this identity's mandates (jti, purpose, tools, exp, status); **Revoke**; expand → Trace Plateforme **and** Trace Prestataire side by side (step 9b, 2026-10-09) | `GET /mandates`, `POST …/revoke`, `GET /audit/:jti`, + the PDS's `GET /mcp-audit/:jti` fetched directly, not through the stub |

Entry for the human via a shared mandate link still skips straight to
**`/pds-space?provider=<uuid>`** (unchanged) — the landing/connexion pair is the *front door*
for someone arriving with no context, not a mandatory hop for every flow. Guarded flow —
`/mandate/new?provider=<uuid>` opened directly:
- no `LinkService` session → redirect to `/pds-space?provider=<uuid>`;
- link session but no itsme identity → redirect to `/itsme`, then back;
- both present → the form.
All redirects carry `provider` (and resume to `/mandate/new`).

**Visual persona distinction:** the top-bar shows only the controls for whoever is actually
connected (nothing at all when logged out, beyond a "Se connecter" button) instead of always
showing both personas' links; it also carries a persona-colored accent (`--accent` blue for
Particulier, a separate `--accent-pro` purple for Professionnel) reused as an "Espace
particulier"/"Espace professionnel" eyebrow tag on every page belonging to that persona, so a
screenshot alone tells you which space you're in. A **Se déconnecter** button (new
`SessionService.logout()`, clears both `identity` and `isPdsAdmin`) is now reachable from the
header whenever either persona is active — there was previously no logout affordance in the UI
at all.

### B4. Deterministic parse (registration review screen) — no AI

Given the `tools` array from `POST /discover`, for **each** tool build a review row:

| Read from the tool | Show |
|---|---|
| `name`, `description` | tool name + description |
| `annotations.readOnlyHint === true` | a "read-only" badge |
| `annotations.title` | friendly label if present |
| for each `inputSchema.properties[p]`: `type`, and keywords `maximum` / `minimum` / `enum` / `pattern` if present | one line per parameter with the detected constraint |
| `type: number` \| `integer` | an **optional** governance-ceiling field, upper-bounded by `maximum` if declared |
| `type: string` + `enum` | an optional "restrict to a subset" control |
| no `inputSchema.properties` (e.g. `get_balance`) | **no** parameter rows, **no** ceiling field — just the read-only badge |

For the POC's `get_balance`: one row, read-only badge, zero fields. **J'accepte** →
`POST /providers` → display `provider_id` and
`http://localhost:4200/mandate/new?provider=<provider_id>`.

Governance ceilings are captured in the UI but, for the read-only POC provider, none appear —
keep the code path so a future provider with a `number` param renders correctly. Note: those
ceiling/subset inputs are display-only today — `RegistrationService.accept()` sends only
`{ mcpEndpoint, tools }` to `POST /providers`, so nothing typed into them is actually captured
even on first registration.

**Known gap — no update flow.** `/admin/register` is create-only and stateless across visits:
there is no "this admin already has a provider" check, no way to look up or edit an existing
`provider_id`'s governance rules, and the stub has no `PUT`/`PATCH /providers/:id` (only
`POST /providers` to create and `GET /providers/:id` to read). Logging in again and re-running
Découvrir → J'accepte mints a **second**, independent `provider_id` rather than updating the
first. Not discussed in `analysis/base-project-analysis.md` either — this wasn't scoped out on
purpose, it just wasn't designed. Deliberately left as a POC limitation rather than built.

### B5-pre. Step 1 — install Outil Local (`/mandate/new`, before the form)

Added 2026-10-10. `/mandate/new` is now a 2-step wizard behind a local `step` signal (same
`step-indicator` pattern as `/admin/register`'s B4/B3 split), not a single form — this is the
screen a first-time end user actually needs before they can get as far as pasting a public key
into B5 below, and it was previously missing entirely (the demo script silently pre-staged
`outil-local init` in pre-flight instead of ever showing this step).

- **Step 1 card:** explains the one-time, once-per-machine `outil-local init` install
  (`npx @veritia/mcp-server init`), shows the command with a copy button, and a note
  that an already-installed user can skip straight ahead. One **Continuer** button moves to
  step 2 — there is deliberately no separate "skip" control; the copy itself says skipping is
  fine, since there's nothing to actually gate on.
- **Not a real completion check, and not trying to look like one.** The platform has no way to
  observe what's installed on the end user's machine, so step 1 is shown on **every** visit —
  there is no "remember this browser already did it" flag. (Revision 2026-10-11: an earlier
  version of this used a `localStorage` flag to skip step 1 on a returning visit; dropped — the
  right gate is server-side, "does this human already have at least one mandate," which is out
  of scope for the demo, so the honest POC behavior is to always show it rather than fake a
  check with client state that doesn't mean anything.) Going back from step 2 to step 1 is done
  by clicking the step-indicator's **"1"** tab itself (`[class.clickable]` once `step() > 1`,
  mandate-new.html) — no separate back-button.
- **Scope decision (same session, 2026-10-10):** a `/dashboard` "Nouveau mandat" button for
  manual (no-provider-link) mandate creation was considered and explicitly dropped — it would
  need a `GET /providers` list endpoint that doesn't exist (the stub only has
  `GET /providers/:id`), and most real mandates are created via the provider's link anyway, not
  manually. The provider-link flow (`pds-space` → `itsme` → `/mandate/new?provider=`) is
  unchanged by this step — step 1 simply now sits between arriving here and seeing the B5 form.
- **Gap fixed same day:** step 1 originally only showed the install *command*, not what
  `init` actually prints — nothing told the human which line of the output is the public key
  they're about to paste into B5. Added a second block showing the real `init` output
  (`outil-local §3`) with the JWK line highlighted and an explicit "copy only this line" note.
- **Second gap fixed same day:** going back to step 1 only works while `step()` is in play —
  the **success screen** (which renders off `mandate.lastCreated()`, independently of the
  `step` signal, once a mandate is actually minted) had no way back to the install
  instructions at all. Added a small collapsed disclosure, "Besoin de revoir comment installer
  l'outil local ?", directly on the success screen instead of trying to route back through the
  step signal (which would risk clobbering the just-issued setup command).

### B5. Mandate form (`/mandate/new`)

| Field | Type | Becomes |
|---|---|---|
| Provider | read-only, from `?provider=` → look up name via `GET` on the provider (or show the UUID) | request `provider_id` |
| Linked account | **read-only** line: "Lié à votre compte Banque Test (liaison signée par le prestataire)" + the `provider_account_ref` prefix from `LinkService` | request `link_session_id` (not shown) |
| Agent public key | textarea; paste the JWK one-liner from `outil-local init` ([outil-local §init](../outil-local/spec.md)) | `agent_jwk` (parsed + validated: `kty:OKP`, `crv:Ed25519`, `x` present) |
| Agent label | text, default `<provider-name>-<firstname>` (changed 2026-09-19 from `claude-desktop-<firstname>` — see below) | `agent_label` → `act.sub` |
| Purpose | text, default `consultation de solde` | `purpose` |
| Expiry | select: 1 h (default) / 8 h / 24 h | `ttl_seconds` |
| Allowed tools | checkbox list from the provider's `confirmedTools` (deterministic parse, `buildReviewRows` — same as `/admin/register` §B4: friendly title, description, read-only badge); `get_balance` ticked. For a checked tool with numeric/enum params (e.g. `list_transactions`), a nested "Ma limite pour `<param>`" ceiling/chip control appears — bounded above by the tool's schema `maximum` where declared | `allowed_tools`, `tool_constraints` (contracts §1.1, wired 2026-10-14) |

**Per-tool limits are now actually sent (contracts §1.1, added 2026-10-12, wired into the SPA
2026-10-14) — previously captured in component state only and dropped at submit, since the
frozen contracts.md §1 JWT had no field for it.** Each numeric param (`max_results`) gets a
plain `<input type="number">` bound to `numericLimits` (keyed `toolName:paramName`); each
enum-string param (`period`) gets the same chip-toggle control as before, but **re-purposed as
a single-select ceiling, not a multi-select subset** — only one chip can be selected per param,
representing "the largest value I'll allow," matching the PDS enforcement this feeds
(`pds/spec.md §8`'s `ListTransactionsTool.checkToolConstraints` compares "effective value ≤
cap," which has no way to express an arbitrary non-contiguous subset like "7j and 90j but not
30j"). Clicking an already-selected chip clears it back to "no limit," mirroring the numeric
field's empty-input behaviour. `MandateNewPage.buildToolConstraints()` merges both maps into
`CreateMandateRequest.tool_constraints` — `undefined` (the key omitted entirely, not `{}`) when
the human set no limits, which the stub also now honors when signing (`mandate.ts`): the key
only appears in `disclosed_scope` when there's actually something to cap.

`sub` is taken from `SessionService` (the fake itsme pick), `link_session_id` from
`LinkService`; neither is a form field.

**Default label changed 2026-09-19** from `claude-desktop-<firstname>` to
`<provider-name>-<firstname>` — two reasons. First, which AI client the human will actually use
isn't known yet at this point in the flow (that's picked *after* minting, in the §B5bis
accordion), so hardcoding "claude-desktop" into the default was already a small mismatch.
Second, and more importantly: `agent_label` is now required to be unique per human **across
every provider**, not just within one (§9.4 — this is what fixed a real bug where two mandates
for different providers under the same label would have silently overwritten each other's
`config.json` on disk, since the mandate folder is named from the label alone). If the default
label were the same regardless of which provider's form the human is on, adding a *second*
bank under an *already-used* default would collide immediately — naming the provider into the
default heads that off without asking the human to think about it.

**Before submit** ([contracts §9.4](../contracts.md), added 2026-09-19): once the human has
typed/kept an `agent_label`, the form checks `GET /mandates?itsme_sub=<sub>` for an existing
row with the same `agent_label` (any provider) + `status:"VALID"` + not expired. If found:
```
You already have an active mandate for "banque-test-sofie",
issued 2026-09-18 14:02, expires 15:02, for Banque Test. Replace it?
   [ Replace ]  [ Change label ]  [ Cancel ]
```
"Replace" calls `POST /mandates/:jti/revoke` on the old `jti` first, then proceeds normally.
There is deliberately **no** "keep both under this label" option — since the mandate folder on
disk is named from the label alone, two live mandates sharing one label would silently
overwrite each other the moment `setup` runs for either. A human who genuinely wants two
independent, coexisting mandates needs two distinct labels — "Change label" just returns focus
to the field instead of submitting.

Submit → `POST /mandates` → show **two** onboarding paths, not mutually exclusive (design
rationale: [contracts §9](../contracts.md)):

1. **One-line setup command** (copy button), for anyone comfortable with a terminal:
   ```
   npx @veritia/mcp-server setup <setup_redeem_url>
   ```
   Caption: "Valid for 10 minutes, works once. Requires `mcp-server init` to have already run
   — once per machine, not once per client."
2. **Raw config block** (copy button), for hand-pasting into
   `~/.veritia/<agent_label>/config.json` with a text editor — no terminal required:
   ```
   AGENT_DELEGATION_TOKEN=<jws>
   PROVIDER_API_ENDPOINT=http://localhost:8081/mcp
   ```
   Caption names the exact folder (`<agent_label>`, slugified) so the manual path also lands
   in the right place — no flat default folder exists to fall back to ([contracts §9](../contracts.md)).

Below both: the **client recipes accordion** (§B5bis) — how to point an AI client at the
outil-local install that now has (or will have) this mandate.

### B5bis. Client recipes (accordion)

Not a client picker (a single-select would wrongly imply "choose one"). An accordion of
panels, each independently expandable, so a human planning to use more than one client can
read every recipe without committing to one first. **None of these recipes ever contain the
raw token** — by the time a human is reading one, `config.json` already holds it (§B5), so
every recipe below is just "how does this client find outil-local."

V1 panels (chosen 2026-09-18 for investor-demo relevance): **Claude Desktop**, **Claude Code**,
**GitHub Copilot CLI**. Facts below checked against each vendor's official docs on 2026-09-18,
not carried over from memory — re-verify before reusing if this section goes stale.

| Client | Config file | Root key | CLI helper | OS notes |
|---|---|---|---|---|
| Claude Desktop | **Recommended**: in-app, Claude menu → Settings… → Developer tab → "Edit Config" button (official MCP docs flow) — opens/creates whichever file the running app actually reads. **Manual fallback**: Mac `~/Library/Application Support/Claude/claude_desktop_config.json` (reliable); Windows `%APPDATA%\Claude\claude_desktop_config.json` (documented, but **not reliable** — see note) | `mcpServers` | none — hand-edit | **Windows**: the documented `%APPDATA%` path does not match the file the app actually reads on at least some Windows installs (confirmed live by Raul 2026-10-12, and matches several open upstream reports of MSIX-packaging path virtualization, e.g. [anthropics/claude-code#26073](https://github.com/anthropics/claude-code/issues/26073)/#25579/#38830) — on Windows, use the in-app "Edit Config" button, not the hand-typed path; the panel reflects this (Edit Config as the primary instruction, manual path only as a fallback with this caveat) |
| Claude Code | `~/.claude.json` (user scope, cross-platform) or `.mcp.json` (project scope, meant to be git-committed) | `mcpServers` | `claude mcp add <name> -- <command> <args>` | no OS-specific path — home directory on every OS |
| GitHub Copilot CLI | `~/.copilot/mcp-config.json` (cross-platform) | `mcpServers` | `copilot mcp add <name> -- <command> <args>` | no OS-specific path. Distinct from the VS Code Copilot Chat *extension*, which uses `.vscode/mcp.json` with a **different** root key (`servers`) — not in V1, noted here so nobody conflates the two "Copilot"s later |

Each panel's recipe is a copy-paste block using the CLI helper where one exists (Claude Code,
GitHub Copilot CLI), or the JSON snippet to paste where it doesn't (Claude Desktop) —
`command`/`args` point at the outil-local install; the only `env` entry needed is
`NP_MANDATE=<agent_label>` (§9.5, [outil-local §4.1](../outil-local/spec.md)) telling outil-local
which mandate folder to load — **never the raw token**, which `config.json` already carries.
The platform fills `<agent_label>` in from the form field the human already typed, so this is
still nothing new to type. POC-specific gap, not solved here: the platform can't know the
human's local clone path, so the POC recipe leaves a placeholder (`/path/to/outil-local`) for
the human to fill in; the real product's `npx @veritia/mcp-server` (already the
package's `bin` name) removes this once published to npm.

### B6. Scenarios

| # ([contracts §7](../contracts.md)) | Case | Expected |
|---|---|---|
| S11 | register the read-only PDS | review shows 1 tool, read-only badge, **no** amount fields |
| S12 | register an unreachable endpoint | `discovery_failed` banner, stay on the form, no `provider_id` |
| B-0 | open `/pds-space?provider=…`, pick a customer, click "Configurer un agent IA" | `POST /account-link/initiate` OK → routed to `/itsme` → `/mandate/new`; the form shows the linked-account line |
| B-1 | open `/mandate/new?provider=…` with no link session | redirect to `/pds-space?provider=…`; after linking + itsme, land back on the form with params intact |
| B-2 | paste a malformed agent key | inline validation error, submit disabled |
| S4 | dashboard → Revoke → agent call fails | row flips to `REVOKED`; audit gains `MANDATE_REVOKED` |
| B-3 | reload `/dashboard` | list still there (comes from `GET /mandates`) |
| B-4 | expand a mandate row | Trace Plateforme from `GET /audit/:jti` **and** Trace Prestataire from the PDS's `GET /mcp-audit/:jti` (contracts §8.6, step 9b, 2026-10-09 — fetched directly by the browser, bypassing the stub), same `jti`, side by side |
| B-5 | `/account-link/initiate` returns `502` / `422` | error banner on `/pds-space`, stay there, no navigation |
| B-6 | `mcp-server setup <url>` run twice with the same URL | first writes `config.json`; second → `404 unknown_code` on the CLI side ([contracts §9](../contracts.md)) |
| B-7 | `mcp-server setup <url>` run after the code's 10 min TTL | `410 code_expired` on the CLI side, readable stderr message |
| B-8 | fill the mandate form with an `agent_label` that already has an active mandate, for this provider or any other | replace/change-label/cancel prompt ([contracts §9.4](../contracts.md)) before submit is allowed to proceed |

### B7. Attention points

- **No real OIDC** — the itsme screen is a picker; the presenter says so out loud
  ([architecture.md §10](../architecture.md)).
- **`/pds-space` is a mock of the PDS's authenticated customer area** — the customer picker
  stands in for a real bank login ([contracts §8.5](../contracts.md)). Say it on stage. The
  only real thing it produces is the PDS-signed assertion (fetched stub→PDS, verified by the
  stub, re-verified by the PDS at call time). It's a full-viewport takeover with its own
  "Banque Test" branding (2026-09-16, `pds-space.css`, same technique as `itsme.css`) — no
  platform topbar — precisely so the mandate link reads as "you're still on your bank's site",
  not as a second login to our own platform; the presenter's narration ("this button would live
  inside Banque Test's real online banking, behind their own login — I'm now navigating to what
  clicking it produces") carries the rest of the honesty this screen can't get from CSS alone.
- All cross-origin calls go to the stub only (`/discover` proxies `tools/list`,
  `/account-link/initiate` proxies the assert call) — with **one deliberate exception** since step
  9b (2026-10-09): the dashboard fetches the PDS's read-only `GET /mcp-audit/:jti` directly, so the
  Trace Prestataire never transits the platform ([contracts §8.6](../contracts.md)).
- `SessionService` clears on reload — fine for a demo; the two views that must survive
  (dashboard list, audit) are stub-backed.
- Keep the deterministic-parse code generic (driven by JSON Schema keywords), not special-cased
  to `get_balance` — the "third parties can add tools with no change on our side" claim.
