Skip to content

feat(mcp): run Peer Cash tools on @zkp2p/sdk peer.sell - #48

Merged
ADWilkinson merged 2 commits into
mainfrom
kohai/peer-sdk-migration
Nov 23, 2026
Merged

ADWilkinson merged 2 commits into
mainfrom
kohai/peer-sdk-migration

Conversation

@kohai-peer

@kohai-peer kohai-peer commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Created by @kohai-peer at the request of @ADWilkinson.

Summary

The peer_cash_* MCP tools now run on peer.sell from @zkp2p/sdk 0.16.0-rc.1 (exact pin, dist-tag rc). Before this PR they ran on createCashClient() from @zkp2p/cash 0.7.0. Every tool name and the custody boundary are unchanged.

  • src/mcp/cash.ts:
    • Reads and unsigned plans go through createPeer(...).sell, and finalize now calls finalizePrepared. The SDK client gets the same options as before: environment, rpcUrl, apiKey, referralCode and referrer.
    • peer_cash_source_capabilities, peer_cash_quote_source, peer_cash_relay_status and peer_cash_prepare_access_policy stay on @zkp2p/cash. They need Relay source routing or the access policy, and the SDK has neither. They use a separate client. @zkp2p/cash stays at 0.7.0 for these tools only.
    • PeerCashMcpConfig.client is now a PeerSell. A new optional cashOnlyClient (PeerCashOnlyClient, exported) injects the client for the Cash-only tools.
  • Tool surface:
    • peer_cash_prepare_access_policy is kept unchanged on @zkp2p/cash, so no agent loses a tool. The README and skill still tell agents to skip that legacy step.
    • Removed the includeRelaySources argument from peer_cash_capabilities. The SDK's capabilities() has no source / destination. The same Relay data stays available through peer_cash_source_capabilities.
    • Tool counts are unchanged (cash 14, full 160). The regenerated agents/runtime-manifest.json and agents/tool-catalog.json differ from main only by the new --amount option on intent release.
  • package.json / package-lock.json: @zkp2p/sdk 0.14.5 becomes 0.16.0-rc.1, regenerated with npm install. @zkp2p/cash 0.7.0 keeps its own nested @zkp2p/sdk@0.14.5. Both are already bundled through tsup noExternal, so tsup.config.ts is unchanged.
  • Monobank stays out of SUPPORTED_PLATFORMS: its only currency, UAH, has no oracle feed. SDK 0.16 lists it in the catalog, so the test that keeps the CLI aligned with the SDK catalog now names Monobank as a deliberate exclusion.
  • SDK 0.15 breaking changes in the generic commands (the CLI jumps from SDK 0.14.5). I checked every CLI write method against the 0.15/0.16 changelog:
    • peer intent release: releaseFundsToPayer now requires releaseAmount, which OrchestratorV4 releases exactly. The command sends the full on-chain intent amount by default (a depositor must release all of it), or --amount in USDC for an arbitrator's partial release. Two tests cover both paths.
    • No other write method has a parameter break. signalIntent gains the O4 payerCommitment and groupId fields with defaults, and the CLI never passed the removed data field.
    • Behaviour notes, unchanged by this PR:
      • stake release-matured / release-matured-batch (releaseMaturedDisputeProtectionIntent(s)) now serve only the August dispute-protection policy. SDK 0.15 releases V2 deferred payouts with release({ intentHashes }), which the CLI does not expose yet.
      • intent create needs a Peer session for Curator's signature, which the CLI does not send. That has been true on 0.14.5 since Curator's identity gate, so it is not caused by this bump.
  • Docs: README.md, llms.txt, skills/peer-cash/SKILL.md, AGENTS.md and an Unreleased CHANGELOG entry. The docs still describe the published 0.4.1, so the notes are scoped to "after 0.4.1". No version bump.

Behavior differences users may notice

  • A payee handle that does not exist on its platform fails with PAYEE_NOT_FOUND (retryable: false). Cash returned PAYEE_REGISTRATION_FAILED (retryable: true).
  • Every corridor binds the oracle rate when a buyer signals an intent. With Cash 0.7.0, Alipay/CNY and UPI/INR fixed the rate at deposit creation.
  • An invalid deposit id is still INVALID_DEPOSIT_ID, but the message now says "Peer sell deposit id".

Verification

  • npm run check (lint, tsc --noEmit, vitest with coverage thresholds: 260 tests, then build): passes.
  • Live read-only smoke test of the migrated tools against production, without signing or preparing anything. It called registerPeerCashTools with the real clients:
    • peer_cash_capabilities, peer_cash_estimate (25 USDC, EUR/wise), peer_cash_fill_stats and peer_cash_source_capabilities (through Cash) returned data.
    • peer_cash_order on an unknown deposit returned the structured ORDER_NOT_FOUND error.
  • Not exercised live: peer_cash_prepare, which registers a payee, and finalize, withdraw and top-up plans. Those are covered by unit tests only.

The generic CLI commands now also run on SDK 0.16.0-rc.1. They typecheck and pass the existing suite, but I did not check them live.

🤖 Generated with Claude Code

kohai-peer and others added 2 commits November 23, 2026 11:40
The peer_cash_* MCP tools now call peer.sell from @zkp2p/sdk
0.16.0-rc.1. The SDK has no source routing, so the three Relay source
tools keep a @zkp2p/cash client. peer_cash_prepare_access_policy and
the capabilities includeRelaySources argument are removed. The SDK
bump also adds Monobank to the active platform catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… amount, leave Monobank out

- peer_cash_prepare_access_policy stays registered and runs on @zkp2p/cash
  next to the Relay source tools, so no agent loses a tool. The injectable
  client for those tools is cashOnlyClient (PeerCashOnlyClient).
- peer intent release sends the releaseAmount @zkp2p/sdk 0.15+ requires:
  the full on-chain intent amount by default, or --amount in USDC.
- Monobank stays out of the supported platforms: its only currency, UAH, has
  no oracle feed. The catalog alignment test names that exclusion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ADWilkinson
ADWilkinson marked this pull request as ready for review November 23, 2026 12:48

@ADWilkinson ADWilkinson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved at 4182ffd on Davy's re-review.

@ADWilkinson
ADWilkinson merged commit e60e107 into main Nov 23, 2026
1 check passed
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.

2 participants