Repository navigation
mcp: take send_draft's confirmation from the toolkit - #664
Conversation
The confirmation's primitives were the same design here and in the hosted HEY MCP server, whose copy was the superset, and they now live once in github.com/basecamp/mcp/confirm: the signed state and its keys, the form and its answer, which clients can be asked, the tools/list filter, and the per-process claims. send_draft keeps what is its own: the order of its checks, its refusals and their wording, the draft's fingerprint, and the prompt. What changes on the wire is the request state's shape: the toolkit's fields and a key id. A key still lives only as long as the process, so no state of the old shape outlives a build. send_draft binds the draft id as the argument hash, the HEY origin as the identity and the sign-in as the grant; the fingerprint rides as the digest and is compared on its own, so a changed draft is still told apart from a different one. A confirmation is now refused after its expiry second rather than at it, and a claim is also forgotten by a timer at 24 hours, not only when the next send sweeps. Pins github.com/basecamp/mcp to v0.0.0-20261119020105-1a6d02c5380a; the Nix vendorHash follows go.sum.
There was a problem hiding this comment.
🔵 Needs a closer look
Mail-send confirmation and replay protection now depend on a newly pinned toolkit whose implementation was inspected, but whose two-round MCP integration and live send-confirmation flow could not be exercised in the dependency-free review environment.
No open issues 🎉
What changed in this PR
Refactors MCP send_draft to use the shared github.com/basecamp/mcp/confirm toolkit while retaining HEY-specific safety checks, refusal messages, draft fingerprints, and prompts.
Changes:
- Replaces local confirmation signing, forms, client capability checks, tool filtering, and claims with toolkit implementations.
- Adopts the toolkit’s signed-state format, expiry boundary, and timer-based claim cleanup.
- Updates confirmation tests, the MCP dependency pin, and the Nix vendor hash.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
nix/package.nix |
Updates the vendor hash for the dependency change. |
internal/mcpserver/server.go |
Uses toolkit tool filtering and separates sendability context handling. |
internal/mcpserver/send.go |
Adopts shared confirmation primitives while preserving send-specific checks. |
internal/mcpserver/send_test.go |
Updates tests to use toolkit keys, state, expiry, and claims. |
go.sum |
Records checksums for the updated MCP toolkit. |
go.mod |
Pins the MCP toolkit version containing confirm. |
Review effort: Balanced
|
On the review's note that the two-round flow wasn't exercised: the send tests in |
The confirmation's primitives were the same design here and in the hosted
HEY MCP server, whose copy was the superset, and they now live once in
github.com/basecamp/mcp/confirm: the signed state and its keys, the form
and its answer, which clients can be asked, the tools/list filter, and the
per-process claims. send_draft keeps what is its own: the order of its
checks, its refusals and their wording, the draft's fingerprint, and the
prompt.
What changes on the wire is the request state's shape: the toolkit's
fields and a key id. A key still lives only as long as the process, so no
state of the old shape outlives a build. send_draft binds the draft id as
the argument hash, the HEY origin as the identity and the sign-in as the
grant; the fingerprint rides as the digest and is compared on its own, so
a changed draft is still told apart from a different one. A confirmation
is now refused after its expiry second rather than at it, and a claim is
also forgotten by a timer at 24 hours, not only when the next send sweeps.
Pins github.com/basecamp/mcp to v0.0.0-20261119020105-1a6d02c5380a; the
Nix vendorHash follows go.sum.
Summary by cubic
Adopts the shared confirmation toolkit from
github.com/basecamp/mcp/confirmforsend_draft, replacing the duplicated confirmation primitives (signed state, keys, form elicitation, claims, and client capability checks) with the toolkit's implementations.github.com/basecamp/mcptov0.0.0-20261119020105-1a6d02c5380a; the NixvendorHashfollowsgo.sum.Refactors
send_draftkeeps its own check order, refusal wording, draft fingerprint, and prompt; the toolkit supplies the signed state, keys, form and answer,tools/listfilter, and per-process claims.Written for commit 0b88a57. Summary will update on new commits.