DEV Community

Cover image for Test Before You Trade: MCP Transaction Simulation Tools for Claude Desktop
Wallet Guy
Wallet Guy

Posted on

Test Before You Trade: MCP Transaction Simulation Tools for Claude Desktop

Test Before You Trade: MCP Transaction Simulation Tools for Claude Desktop

MCP transaction simulation is the safety net that every developer should set up before letting Claude Desktop touch real funds onchain. If you're building with Claude's Model Context Protocol and you want your agent to execute DeFi actions — swaps, transfers, lending — you need a way to test those actions without burning gas on mistakes. WAIaaS ships a simulate-transaction MCP tool that lets Claude dry-run any transaction before it executes, and this post shows you exactly how to set it up.

Why Simulation Matters Before Going Live

Here's the uncomfortable truth about agentic finance: AI agents make mistakes. They misparse amounts, confuse token decimals, pick the wrong recipient address. When a human does this in a UI, they catch it before clicking "confirm." When an agent does it autonomously, the transaction is already broadcast.

The stakes are higher than they look. A misconfigured DeFi action — say, supplying the wrong asset to Aave, or swapping with a bad slippage parameter — can result in immediate, irreversible loss. This isn't theoretical. It's the exact class of bug that makes developers hesitant to give agents real spending power in the first place.

The solution isn't to avoid giving agents wallets. It's to give them the ability to check their own work before committing. That's what simulation is for.

How WAIaaS Plugs Into Claude Desktop

WAIaaS is a self-hosted Wallet-as-a-Service that exposes a Model Context Protocol server. It provides 45 MCP tools covering wallet management, transactions, DeFi protocols, NFTs, and more. Claude Desktop treats each of these tools as a callable function — your agent can ask "what's my balance?" or "simulate a Jupiter swap" the same way it calls any other MCP tool.

The whole integration is one entry in your claude_desktop_config.json:

{
  "mcpServers": {
    "waiaas": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_SESSION_TOKEN": "wai_sess_<your-token>",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

After a Claude Desktop restart, your agent has access to all 45 tools, including simulate-transaction. No additional setup, no custom code.

The simulate-transaction Tool

Among the 45 MCP tools WAIaaS provides, simulate-transaction is the one that makes the rest of them safe to use in production. It runs the full transaction validation pipeline — checking policy rules, verifying token addresses, calculating gas — without broadcasting anything to the network.

Under the hood, this maps directly to the dryRun flag on the WAIaaS REST API. Here's what that looks like at the HTTP level:

curl -X POST http://127.0.0.1:3100/v1/transactions/send \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer wai_sess_<token>" \
  -d '{
    "type": "TRANSFER",
    "to": "recipient-address",
    "amount": "0.1",
    "dryRun": true
  }'
Enter fullscreen mode Exit fullscreen mode

The response tells you whether the transaction would succeed, which policy rules would apply, and what security tier it would be assigned — all without touching the blockchain.

What Claude Actually Sees

Once WAIaaS is connected via MCP, the conversation flow becomes natural. You don't have to tell Claude to use the dry-run tool explicitly in every message — you can build a system prompt that instructs your agent to always simulate before executing. Here's how it plays out:

You: "Send 0.5 SOL to address abc123..."

Claude → calls simulate-transaction tool first
Claude: "Simulation result: this transfer would succeed.
         It falls under the NOTIFY tier (above your $10 INSTANT
         threshold). Want me to proceed?"

You: "Yes, go ahead."

Claude → calls send-token tool
Claude: "Sent. Transaction ID: tx_abc..."
Enter fullscreen mode Exit fullscreen mode

The agent is doing the safety check itself, not relying on you to remember to ask for one. That's the pattern you want for autonomous operation.

Setting Up the Full Stack

If you haven't installed WAIaaS yet, here's the minimal path to having everything running locally.

Step 1: Install the CLI and start the daemon

npm install -g @waiaas/cli
waiaas init
waiaas start
Enter fullscreen mode Exit fullscreen mode

Step 2: Provision a wallet and create a session

waiaas quickset --mode mainnet
Enter fullscreen mode Exit fullscreen mode

This creates your wallets and MCP sessions in a single command. It will print a config JSON block — that's what goes in your Claude Desktop config.

Step 3: Or auto-register everything

waiaas mcp setup --all
Enter fullscreen mode Exit fullscreen mode

This writes the Claude Desktop config automatically. After restarting Claude Desktop, the WAIaaS MCP server is live.

Step 4: Verify with a balance check

In Claude Desktop, just ask: "What's my wallet balance?" Claude will call the get-balance MCP tool and return the result. If that works, your connection is good.

Step 5: Test simulation before anything else

Before running any real transaction, ask Claude to simulate one:

"Simulate sending 0.01 SOL to [any address] — don't actually send it."

If the simulation returns a clean result, you know the pipeline is working correctly.

Policy Engine as a Second Safety Layer

Simulation catches execution errors. The WAIaaS policy engine catches intent errors — cases where the transaction would technically succeed but violates rules you've set.

WAIaaS ships a policy engine with 21 policy types and 4 security tiers: INSTANT, NOTIFY, DELAY, and APPROVAL. The default behavior is deny — if you haven't explicitly allowed a token or contract, transactions involving it are blocked.

Here's what a sensible policy setup looks like for a Claude agent you're testing with:

curl -X POST http://127.0.0.1:3100/v1/policies \
  -H "Content-Type: application/json" \
  -H "X-Master-Password: my-secret-password" \
  -d '{
    "walletId": "<wallet-uuid>",
    "type": "SPENDING_LIMIT",
    "rules": {
      "instant_max_usd": 100,
      "notify_max_usd": 500,
      "delay_max_usd": 2000,
      "delay_seconds": 900,
      "daily_limit_usd": 5000
    }
  }'
Enter fullscreen mode Exit fullscreen mode

With this in place, any transaction Claude tries to execute gets classified:

  • Under $100 → executes immediately
  • $100–$500 → executes, you get a notification
  • $500–$2000 → queued for 15 minutes (cancellable)
  • Over $2000 → requires your explicit approval

When Claude runs simulate-transaction, it sees this tier assignment in the response before committing. That means the agent can inform you: "This swap would require your approval because it exceeds your $500 notify threshold." It's not just error prevention — it's transparency about what's about to happen.

Multi-Wallet Setups for Isolated Testing

One practical pattern for testing: run two MCP servers in parallel — one connected to a wallet with tiny balances for testing, one connected to your real trading wallet. Claude Desktop supports multiple MCP servers with different names:

{
  "mcpServers": {
    "waiaas-trading": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_AGENT_ID": "019c47d6-51ef-7f43-a76b-d50e875d95f4",
        "WAIAAS_AGENT_NAME": "trading-agent",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    },
    "waiaas-solana": {
      "command": "npx",
      "args": ["-y", "@waiaas/mcp"],
      "env": {
        "WAIAAS_BASE_URL": "http://127.0.0.1:3100",
        "WAIAAS_AGENT_ID": "019c4cd2-86e8-758f-a61e-9c560307c788",
        "WAIAAS_AGENT_NAME": "solana-wallet",
        "WAIAAS_DATA_DIR": "~/.waiaas"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

You can develop and simulate against the test wallet, then promote the same agent logic to the production wallet once you've verified the behavior.

The 45 Tools Behind the Scenes

Simulation is one tool in a broader set of 45 MCP tools WAIaaS exposes. The full list includes tools for every major onchain operation Claude might need:

  • Wallet: get-wallet-info, get-address, get-balance, get-assets
  • Transactions: send-token, send-batch, sign-transaction, simulate-transaction, list-transactions, get-transaction
  • DeFi: action-provider, get-defi-positions, get-health-factor, hyperliquid, polymarket
  • NFTs: list-nfts, get-nft-metadata, transfer-nft
  • Security: get-policies, list-sessions, wc-connect, wc-disconnect, wc-status
  • Utilities: encode-calldata, call-contract, resolve-asset, x402-fetch, sign-message

The simulate-transaction tool sits in the transaction group, but the pattern extends across DeFi too. Before Claude executes a Jupiter swap or supplies assets to Aave via the action-provider tool, it can run a simulation pass to validate parameters.

WAIaaS integrates 15 DeFi protocol providers including Jupiter swap, Aave v3, Lido staking, Jito staking, Hyperliquid, Across bridging, LI.FI bridging, and Polymarket, all accessible through the same MCP interface. Simulation gives you a consistent pre-flight check across all of them.

What the Error Response Tells You

When a simulation fails — policy denied, insufficient balance, invalid token — the response follows a consistent structure:

{
  "error": {
    "code": "POLICY_DENIED",
    "message": "Transaction denied by SPENDING_LIMIT policy",
    "domain": "POLICY",
    "retryable": false
  }
}
Enter fullscreen mode Exit fullscreen mode

The code field is machine-readable, which means Claude can act on it. If the error is INSUFFICIENT_BALANCE, Claude can tell you to fund the wallet. If it's POLICY_DENIED, Claude can explain which rule blocked it and suggest adjusting parameters. If it's retryable: true, Claude knows it can try again after a delay. This structured error format is what makes simulation genuinely useful for autonomous agents rather than just a manual debugging step.

The Broader Safety Picture

Simulation is one layer. WAIaaS also ships:

  • 3-layer security: session auth → time delay and approval → monitoring and kill switch
  • 3 auth methods: masterAuth with Argon2id hashing, ownerAuth via cryptographic signature (SIWS/SIWE), sessionAuth via JWT
  • WalletConnect integration: approve agent transactions from your phone wallet
  • Incoming transaction monitoring: real-time notifications for deposits
  • Per-session limits: TTL, max renewals, absolute lifetime configurable per session

The goal is that even if Claude constructs a bad transaction — wrong amount, wrong address, bad slippage — there are multiple checkpoints between intent and execution. Simulation is the first checkpoint. Policies are the second. Human approval for high-value actions is the third.

Quick Start Summary

  1. npm install -g @waiaas/cli && waiaas init && waiaas start
  2. waiaas quickset --mode mainnet — creates wallets and sessions
  3. waiaas mcp setup --all — writes Claude Desktop config
  4. Restart Claude Desktop
  5. Ask Claude: "Simulate sending 0.01 SOL to [address] — dry run only"

That's it. From zero to simulation-enabled Claude agent in under five minutes.

What's Next

From here, the natural next step is configuring policies to match your actual risk tolerance — spending limits, token whitelists, network restrictions — so that real transactions have guardrails that match your use case. You can also explore multi-wallet configurations for separating test and production environments, or look into WalletConnect integration if you want mobile approval prompts for high-value actions.

The WAIaaS codebase is fully open source and self-hosted — you own the keys, you own the data, you control the policy rules. Browse the source and contribute at https://github.com/waiaas/WAIaaS, or learn more about the project at https://waiaas.ai.

Top comments (0)