Skip to content

Revive the swap MCP tools: PR #69 merged to the wrong base and never reached main #205

Description

@hellno

Part of #23. References #26 (stays closed) and PR #69.

Corrected 2026-07-10 (codebase re-verified): the "cherry-pick ecfe2ac / ~1,770 LOC absent" framing was wrong. The daemon + core + wire + GUI swap path already landed on main via #24/#25. What is actually missing is only the MCP-sidecar layer + the demo stub + the e2e harness. Re-scoped below.

What actually happened

PR #69 — "Swap v1 agent + demo: 3 MCP tools, fork-demo stub, swap-e2e" — merged onto branch hellno/test-merged-prs-gui, not main, so its work never reached trunk. But most of what it delivered has since arrived on main independently, so this is NOT a clean cherry-pick.

Already on main (do NOT rebuild — verified 2026-07-10)

  • Full CoW orderbook client cow_client.rs with the cow-client feature default-on.
  • SwapOrder + ProposeOrder / SignOrder / CancelOrder wire, dispatched by the daemon (daemon.rs:363/369/375, sign_order at :940) including the shaped GPv2 relayer-approve (daemon.rs:541-563).
  • evaluate_order policy admission (policy.rs:807; always NeedsApproval, receiver==wallet, token allowlist).
  • The Swap GUI (swap.rs / swap_view.rs) and app swap_quote plumbing.
  • Swap parity tests (signerd/tests/swap_parity.rs).

So the trust-critical, test-covered swap engine is present.

What is actually missing (the real scope of this issue)

Verified absent from main:

  • 3 MCP tool wrappers in deckard-mcp/src/server.rs (deckard_swap_quote, deckard_swap, deckard_submit_order) — the sidecar today has 8 tools and none are swap tools.
  • The sidecar.rs wire-call methods for orders (today only a "swap" log string exists there).
  • DECKARD_DEMO_SWAP_STUB in env.rs (deterministic fixture quote + simulated fill via anvil setStorageAt, every stubbed response marked simulated:true) — not on main.
  • swap_e2e.rs (~339 LOC) and the env-gated just swap-e2e live-Sepolia harness — not on main.
  • Doc reconciliation: tool count everywhere goes 8 → 11 (server.rs self-description, README, docs/build/30-mcp-shape.md, 31-agent-quickstart.md, STATUS). deckard_execute stays tx-only.

Because server.rs went 5 → 8 tools and env.rs/sidecar.rs were reorganized since June 16, ecfe2ac cherry-picks with conflicts in server.rs, sidecar.rs, env.rs, tests/common/mod.rs — treat this as a re-implementation onto today's main, not a cherry-pick. No new deps (cow-client already default-on).

Sizing & priority

More than "~1 day" (the demo stub + e2e harness + docs are net-new), but still an M-sized focused PR since the hard part is done. Not on the critical path to either flagship demo (browser connect→approve→revoke, or x402 $5/day) — it is an agent-does-real-DeFi capability expansion. Do it after both flagship demos rehearse.

Scope checklist

Acceptance

  1. 11 tools documented consistently; deckard_execute stays tx-only.
  2. just demo swap flow completes with the simulated fill + visible "simulated" banner.
  3. just swap-e2e produces an accepted+open order on live Sepolia (output pasted in the PR).
  4. DoD green; codex adversarial pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions