Before You Start

This is the MoltPe developer quickstart. No concept primer, no architecture tour, no vendor comparison. Pick a path, run the snippets in order, and watch a transaction hash land on-chain. The whole thing fits in one coffee.

Here is what you need before the clock starts:

Export your key once so every snippet in this post works:

export MOLTPE_API_KEY="mp_test_7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e"

Path A — The REST API Path (Node.js)

The REST path is the most direct. Four HTTP calls, roughly 4 minutes end-to-end. If you only read one section, read this one.

Step 1: Create an agent wallet

This creates an isolated wallet on Polygon Amoy testnet. MoltPe custodies the key, exposes the wallet through an agent ID, and returns the on-chain address.

curl -X POST https://api.moltpe.com/v1/agents/create \
  -H "Authorization: Bearer $MOLTPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "research-agent-01",
    "network": "polygon-amoy"
  }'

Response:

{
  "agent_id": "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
  "name": "research-agent-01",
  "network": "polygon-amoy",
  "wallet_address": "0x7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e4d2b6a90",
  "status": "active",
  "created_at": "2026-04-18T10:22:41Z"
}

Same thing from Node:

// Create an isolated agent wallet on Polygon Amoy testnet.
const res = await fetch("https://api.moltpe.com/v1/agents/create", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "research-agent-01",
    network: "polygon-amoy",
  }),
});

const agent = await res.json();
console.log(agent.agent_id, agent.wallet_address);

Step 2: Fund the wallet

On testnet, the dashboard has a Fund button that drops test USDC instantly. If you prefer to stay in code, call the fund endpoint. On mainnet, send USDC from your own wallet to wallet_address.

// Top up the testnet wallet with 10 test USDC.
await fetch(`https://api.moltpe.com/v1/agents/${agent.agent_id}/fund`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ amount: "10.00" }),
});

Step 3: Set a spending policy

This is the step that makes a MoltPe wallet different from a raw EOA. The policy is evaluated before every signature, so even a prompt-injected agent cannot blow the cap.

// daily_cap and per_tx_cap are in USDC. allowlist restricts recipients.
await fetch(`https://api.moltpe.com/v1/agents/${agent.agent_id}/policy`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    daily_cap: "5.00",
    per_tx_cap: "0.50",
    allowlist: [
      "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
      "0xA3b5C7e9F1d3B5a7C9e1F3b5A7c9E1f3B5a7C9e1"
    ]
  }),
});

Step 4: Send a test payment

This is the payoff. One call, returns a real on-chain transaction hash.

// Send 0.25 USDC from the agent to a recipient on the allowlist.
const payRes = await fetch("https://api.moltpe.com/v1/payments/send", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.MOLTPE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    agent_id: agent.agent_id,
    amount: "0.25",
    recipient: "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
    reference: "invoice-1042",
  }),
});

console.log(await payRes.json());

Response:

{
  "payment_id": "pay_01HKQF9T5XAB3N7V2R6WZKDE8C",
  "agent_id": "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
  "amount": "0.25",
  "token": "USDC",
  "network": "polygon-amoy",
  "recipient": "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
  "tx_hash": "0x7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e4d2b6a90c3e5d7f9a1b3c5d7e9f1a3b5",
  "status": "confirmed",
  "gas_sponsored": true,
  "confirmed_at": "2026-04-18T10:23:04Z"
}

Open the tx hash in a block explorer and you will see a real USDC transfer, gas paid by MoltPe. Total time so far: about 4 minutes. Four HTTP calls, one wallet, one policy, one signed transaction.

Path B — The MCP Path (Claude Desktop, Cursor, Windsurf)

If you want Claude to drive the wallet directly instead of writing code, use the MCP server. You will not write any payment code; you will configure one JSON block and talk to Claude.

Step 1: Configure the MoltPe MCP server

Open your client's MCP config file and add the MoltPe entry. For Claude Desktop, the file lives at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.

{
  "mcpServers": {
    "moltpe": {
      "command": "npx",
      "args": ["-y", "@moltpe/mcp-server"],
      "env": {
        "MOLTPE_API_KEY": "mp_test_7f3a9c2e8b1d4f6a0c5e9d3b7a1f5c8e"
      }
    }
  }
}

Cursor and Windsurf use the same JSON shape in their MCP settings panels.

Step 2: Restart the client

Fully quit and relaunch Claude Desktop (or Cursor or Windsurf). When it comes back, open the tool picker. You should see these tools listed under moltpe:

Step 3: Ask Claude to create a wallet

Type this into Claude:

"Create a test agent wallet on polygon-amoy called demo-agent and show me the address."

Claude will call create_agent_wallet and reply with something like:

"I created the wallet. Agent ID is ag_01HKQFA9P2RBC4V7X3ZJDM5KEW and the address is 0xA3b5C7e9F1d3B5a7C9e1F3b5A7c9E1f3B5a7C9e1 on polygon-amoy. It has a zero balance right now — fund it from the dashboard or ask me to set a spending policy first."

Step 4: Ask Claude to send a payment

Once funded, try:

"Send 0.10 USDC from demo-agent to 0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2 with reference 'mcp-test'."

Claude calls send_payment and returns the same confirmation payload you saw in Path A, including the transaction hash. Claude itself never sees the private key — MoltPe signs and Claude just reads the result.

Path C — The x402 Path (monetize an API)

Now the other direction: collect payments instead of sending them. This is the x402 protocol — an HTTP endpoint that returns 402 Payment Required until the client pays.

Server: an Express endpoint that charges per request

// Minimal x402 endpoint. Charges 0.01 USDC for each data read.
import express from "express";
import { moltpeX402 } from "@moltpe/x402-express";

const app = express();

app.get(
  "/api/premium-data",
  moltpeX402({
    price: "0.01",
    token: "USDC",
    network: "polygon",
    recipient: "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
    apiKey: process.env.MOLTPE_API_KEY,
  }),
  (req, res) => {
    res.json({ data: "premium content only paid callers see" });
  }
);

app.listen(3000);

The middleware returns a 402 with MoltPe-formatted payment headers on the first hit and verifies the payment proof on the retry.

Client: catch 402, pay, retry

// Use a MoltPe agent to pay automatically when a server returns 402.
import { createX402Client } from "@moltpe/x402-client";

const client = createX402Client({
  apiKey: process.env.MOLTPE_API_KEY,
  agentId: "ag_01HKQF8M3YNBW2V9X7ZJPD4RCT",
  maxPaymentUsd: "0.05",
});

const res = await client.fetch("https://api.example.com/api/premium-data");
const data = await res.json();
console.log(data);
// { data: "premium content only paid callers see" }

The client library transparently handles the 402 response, constructs the payment against the agent's spending policy, and retries. Your code sees one call and one JSON response.

Path D — The Python Path

Same four endpoints from Path A, in Python, using httpx.

Create a wallet and set a policy

import os
import httpx

API = "https://api.moltpe.com/v1"
headers = {"Authorization": f"Bearer {os.environ['MOLTPE_API_KEY']}"}

# Create an isolated agent wallet on Polygon Amoy testnet.
agent = httpx.post(
    f"{API}/agents/create",
    headers=headers,
    json={"name": "python-agent-01", "network": "polygon-amoy"},
).json()

# Lock it down: $5/day, $0.50/tx, two approved recipients.
httpx.post(
    f"{API}/agents/{agent['agent_id']}/policy",
    headers=headers,
    json={
        "daily_cap": "5.00",
        "per_tx_cap": "0.50",
        "allowlist": [
            "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
        ],
    },
)

print(agent["agent_id"], agent["wallet_address"])

Send a payment

# Send 0.25 USDC. MoltPe signs, pays gas, returns the tx hash.
payment = httpx.post(
    f"{API}/payments/send",
    headers=headers,
    json={
        "agent_id": agent["agent_id"],
        "amount": "0.25",
        "recipient": "0x8f2e4bD7B0A1E8c5F6d9A3b2C7e0D4f8A1B5c9E2",
        "reference": "python-quickstart",
    },
).json()

print(payment["tx_hash"], payment["status"])
# 0x7f3a9c2e8b1d4f...  confirmed

Troubleshooting

Four things cause 95% of first-run failures. One-line fixes for each.

What's Next

You have a live wallet, a policy, and a confirmed transaction. From here the paths diverge depending on what you are building: