Skip to content

mcp: require prepared send intents#1027

Open
darioAnongba wants to merge 2 commits into
mainfrom
agent/mcp-send-intents
Open

mcp: require prepared send intents#1027
darioAnongba wants to merge 2 commits into
mainfrom
agent/mcp-send-intents

Conversation

@darioAnongba

@darioAnongba darioAnongba commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Addresses P0-5 from #997.

Before:

  • one MCP send call accepted payment parameters, prepared the payment, and immediately dispatched it
  • an agent had no tool boundary at which to inspect the resolved amount, rail, fees, destination, or warnings before funds could move

After:

  • send.prepare accepts payment parameters, validates them, and returns the daemon's exact preview plus a short-lived single-use send_intent_id
  • send accepts only send_intent_id, consumes the already prepared intent, and may move funds
  • tool schemas and tests pin that prepare cannot dispatch and dispatch cannot reconstruct or change reviewed parameters
  • the runtime registry exposes send.prepare as MCP-only and advertises the distinct MCP parameters for send
  • disabled wallet clients return the normal wallet-RPC-disabled error instead of risking a nil dereference
  • operator documentation explains the two calls

Concrete consequence: MCP agents must observe the resolved transaction before authorizing dispatch, and the final call cannot silently substitute a different destination, amount, rail, or fee limit.

This reuses the daemon's existing send-intent mechanism; it adds no new persistence or approval subsystem.

Validation:

  • make unit pkg=./cmd/wavecli/...
  • go test ./cmd/wavecli/... -race
  • make lint-changed-local
  • make commitmsg-lint range="origin/main..HEAD"

This PR is independent from the other #997 slices and targets main.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the MCP wallet payment process into a two-phase flow by splitting the single send tool into send.prepare (which validates and returns a send_intent_id) and send (which dispatches the payment using the intent ID). This change is documented across several markdown files and is supported by new unit tests. The review feedback suggests adding nil checks for the client interface in both prepareMCPWalletSend and dispatchMCPWalletSend to prevent potential nil pointer dereference panics, especially during testing.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread cmd/wavecli/waveclicommands/mcp_wallet.go
Comment thread cmd/wavecli/waveclicommands/mcp_wallet.go
@darioAnongba
darioAnongba marked this pull request as ready for review July 21, 2026 17:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd314a0942

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/wavecli/waveclicommands/mcp_wallet.go
Advertise the two-phase send schemas explicitly. Reject disabled wallet
clients instead of allowing handler-time nil dereferences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant