Add a read-only MCP Apps triage panel #88

Merged
svc-agent-writer merged 2 commits from feat/triage-panel into main 2026-11-01 04:39:01 +00:00

Closes #76.

Summary

mail_triage(account)                      read scope, model + app, _meta.ui.resourceUri
  text: inbox counts per class, unread, untriaged, "assess: off"
  host renders MCP Apps → ui://mailmind/triage.html (panel.html, in the package)
    ui/initialize            (any protocol version the host answers)
    tools/call mail_triage_rows   read scope, visibility=["app"] → JSON rows
    tools/call mail_read          on a click → plain text
 SearchParams
+  role                 the row's own mailbox role, as the assessor reads it
 Store
+  triage_counts()      class → (messages, unread)

The panel is read-only. It sets every server value through textContent, declares no CSP domains, and answers its parent frame only.

Evidence

  • Before: no tool carries _meta.ui, and the server serves no ui:// resource.
    After: tests/test_panel.py (13 tests) checks:

    • the tool and resource metadata, and the MIME type and absent CSP on resources/read;
    • the mail_triage counts over the inbox role;
    • the mail_triage_rows fields, filters and paging;
    • the refusal of the evidence token;
    • that the panel's inbox equals the assessor's;
    • that the panel file has no HTML sink, no outside loader or URL, only the handshake methods, and only the two read tools.

    make check: 312 passed, mypy and ruff clean, no known vulnerabilities.

  • Render path: the #76 render probe showed a panel rendering on grok.com (host=grok-web 1.0.0), with the tool result and an app-only tools/call working. Grok Bot shows text only.

  • Not yet seen: this panel in a live host. The brief's last criterion is an eyes-on check on grok.com after deploy.

Merge Danger

Door: two-way

No schema change, no write path and no change to existing tool output. Reverting removes two tools and one resource.

Blast Radius: additive

A client's tool list gains mail_triage and the app-only mail_triage_rows. A host that renders MCP Apps shows the panel when mail_triage runs.

🤖 Generated with Claude Code

Closes #76. ## Summary ```text mail_triage(account) read scope, model + app, _meta.ui.resourceUri text: inbox counts per class, unread, untriaged, "assess: off" host renders MCP Apps → ui://mailmind/triage.html (panel.html, in the package) ui/initialize (any protocol version the host answers) tools/call mail_triage_rows read scope, visibility=["app"] → JSON rows tools/call mail_read on a click → plain text ``` ```diff SearchParams + role the row's own mailbox role, as the assessor reads it Store + triage_counts() class → (messages, unread) ``` The panel is read-only. It sets every server value through `textContent`, declares no CSP domains, and answers its parent frame only. ## Evidence - **Before:** no tool carries `_meta.ui`, and the server serves no `ui://` resource. **After:** `tests/test_panel.py` (13 tests) checks: - the tool and resource metadata, and the MIME type and absent CSP on `resources/read`; - the `mail_triage` counts over the inbox role; - the `mail_triage_rows` fields, filters and paging; - the refusal of the evidence token; - that the panel's inbox equals the assessor's; - that the panel file has no HTML sink, no outside loader or URL, only the handshake methods, and only the two read tools. `make check`: 312 passed, mypy and ruff clean, no known vulnerabilities. - **Render path:** the #76 render probe showed a panel rendering on grok.com (`host=grok-web 1.0.0`), with the tool result and an app-only `tools/call` working. Grok Bot shows text only. - **Not yet seen:** this panel in a live host. The brief's last criterion is an eyes-on check on grok.com after deploy. ## Merge Danger **Door:** two-way No schema change, no write path and no change to existing tool output. Reverting removes two tools and one resource. **Blast Radius:** additive A client's tool list gains `mail_triage` and the app-only `mail_triage_rows`. A host that renders MCP Apps shows the panel when `mail_triage` runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mail_triage returns inbox counts by triage class and links the panel at
ui://mailmind/triage.html, so a host that renders MCP Apps shows it and
any other host shows the text. The panel reads rows through
mail_triage_rows, an app-only tool, and opens a message through
mail_read. It starts no write, sets data through textContent only, and
declares no CSP domains. SearchParams gains a mailbox role filter.

Closes #76

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The role filter now reads a row's own mailbox only, so the panel's inbox
is the inbox the assessor classes; a stable-id row's other mailboxes no
longer count. mail_triage_rows turns every BladeError into the MCP error.
Both row formats share one set of cuts, the unread predicate is one
constant, and the mail_triage hint says mail_search covers every mailbox.
The panel tests now pin the handshake methods, the tools it calls and
every way it could load from outside, and check the CSP on the read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.