MCP Server#

PayWatcher is available as a public Model Context Protocol (MCP) server. AI agents can call PayWatcher tools directly from their workflow — no API key, no account. Authentication is handled via x402 ($0.05 USDC per tool call).

Quick Start#

1. Add to your MCP config#

json
{
  "mcpServers": {
    "paywatcher": {
      "url": "https://api.paywatcher.dev/mcp"
    }
  }
}

This works with Claude Desktop, Cursor, VS Code, and any MCP-compatible client.

2. Make your first tool call#

typescript
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"

const client = new Client({ name: "my-agent", version: "1.0.0" })
await client.connect(
  new StreamableHTTPClientTransport(
    new URL("https://api.paywatcher.dev/mcp")
  )
)

const result = await client.callTool({
  name: "verify_payment",
  arguments: {
    tx_hash: "0xabc123...",
    amount: "1.00",
    network: "base",
    to: "0xYourWallet...",
  },
})

The first call returns HTTP 402 with a payment descriptor. Your agent pays $0.05 USDC on-chain, then the tool executes and returns the result.

x402 Authentication#

Every tool call is authenticated via x402 — the HTTP 402 payment protocol. No API key needed, no account registration.

How it works:

  1. Agent calls a tool → server responds with HTTP 402 + Payment Descriptor
  2. Agent sends $0.05 USDC to the payTo address on any supported network
  3. Agent retries the tool call with the X-PAYMENT header containing the tx proof
  4. Server verifies payment → executes tool → returns result

Cost: $0.05 USDC per tool call (read and write tools).

Tool Reference#

create_payment#

Creates a new payment intent. Returns a deposit address and unique amount for the customer to pay.

ParameterTypeRequiredDescription
amountstringYesAmount in USDC (e.g. "49.99")
currencystringYesCurrency — always "USDC"
networkstringNoNetwork — defaults to "base"
metadataobjectNoCustom metadata (e.g. order ID)
webhook_urlstringNoWebhook URL for payment events
expires_innumberNoExpiration in seconds (default: 3600)
typescript
const result = await client.callTool({
  name: "create_payment",
  arguments: {
    amount: "49.99",
    currency: "USDC",
    network: "base",
  },
})

verify_payment#

Verifies an on-chain USDC transaction. Returns verification result with confirmation count.

ParameterTypeRequiredDescription
tx_hashstringYesTransaction hash (0x...)
networkstringYesNetwork: base, ethereum, arbitrum, optimism, polygon
amountstringYesExpected amount in USDC
tostringYesExpected recipient wallet address
tolerance_secondsnumberNoTime tolerance (default: 300)
typescript
const result = await client.callTool({
  name: "verify_payment",
  arguments: {
    tx_hash: "0xabc123...",
    amount: "1.00",
    network: "base",
    to: "0xYourWallet...",
  },
})

get_payment#

Retrieves payment details by ID, including current status and confirmation count.

ParameterTypeRequiredDescription
payment_idstringYesPayment ID (e.g. "pay_2x7k...")
typescript
const result = await client.callTool({
  name: "get_payment",
  arguments: {
    payment_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  },
})

list_verifications#

Lists recent verification results for the authenticated wallet.

ParameterTypeRequiredDescription
limitnumberNoMax results (default: 20, max: 50)
offsetnumberNoPagination offset
typescript
const result = await client.callTool({
  name: "list_verifications",
  arguments: { limit: 10 },
})

Supported Networks#

The MCP server supports USDC on all PayWatcher networks:

NetworkChain ID
Base8453
Ethereum1
Arbitrum42161
Optimism10
Polygon137

x402 payments (the $0.05 per-call fee) can be sent on any of these networks.

Next Steps#