Skip to content

mcp: take send_draft's confirmation from the toolkit - #664

Merged
jeremy merged 1 commit into
mainfrom
adopt-toolkit-confirm
Nov 19, 2026
Merged

jeremy merged 1 commit into
mainfrom
adopt-toolkit-confirm

Conversation

@jeremy

@jeremy jeremy commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

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/confirm for send_draft, replacing the duplicated confirmation primitives (signed state, keys, form elicitation, claims, and client capability checks) with the toolkit's implementations.

  • The request state shape on the wire changes to the toolkit's fields plus a key id; old-shape state never outlives a process because keys are still ephemeral.
  • The draft id binds 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 still compared separately.
  • A confirmation is now refused after its expiry second rather than at it, and claims are forgotten by a 24-hour timer instead of only on the next send sweep.
  • Pins github.com/basecamp/mcp to v0.0.0-20261119020105-1a6d02c5380a; the Nix vendorHash follows go.sum.

Refactors

  • send_draft keeps its own check order, refusal wording, draft fingerprint, and prompt; the toolkit supplies the signed state, keys, form and answer, tools/list filter, and per-process claims.

Written for commit 0b88a57. Summary will update on new commits.

View guided diff Turn on auto-fix

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.
@jeremy
jeremy requested a review from a team as a code owner November 19, 2026 02:08
Copilot AI balanced review requested due to automatic review settings November 19, 2026 02:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to 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

@jeremy

jeremy commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

On the review's note that the two-round flow wasn't exercised: the send tests in internal/mcpserver/send_test.go drive both rounds over an in-memory MCP session against the pinned toolkit (ask, then retry with the signed state: approved, declined, replayed, two confirmations of one draft, forged, expired, another process's key, a changed draft), and they pass in CI on this head. No open threads.

@jeremy
jeremy merged commit 5075f8c into main Nov 19, 2026
37 checks passed
@jeremy
jeremy deleted the adopt-toolkit-confirm branch November 19, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants