Agents pay for themselves.

An autonomous agent can hit its free-tier ceiling, purchase a Pro upgrade, and keep working โ€” with no human in the loop โ€” using the Dodo Payments MCP server.

Dodo Payments Code Mode.

Instead of exposing hundreds of API endpoints as separate tools, Dodo uses just 2 tools โ€” keeping the agent's context window lean and execution fast:

  • docs_search โ€” searches Dodo documentation.
  • code_execution โ€” writes + runs TypeScript in a sandbox against the Dodo SDK.

Step 1 โ€” Agent connects the Dodo MCP servers

Add Dodo's knowledge + payments MCP servers to the agent's MCP config (alongside AgentMemo's memory server).

mcp config
{
  "mcpServers": {
    "dodo-knowledge": {
      "command": "npx",
      "args": ["-y", "mcp-remote@latest",
               "https://knowledge.dodopayments.com/mcp"]
    },
    "dodopayments": {
      "command": "npx",
      "args": ["-y", "mcp-remote@latest",
               "https://mcp.dodopayments.com/sse"]
    }
  }
}

Step 2 โ€” Agent signs up for AgentMemo

cURL
curl -X POST https://agentmemo.dev/signup \
  -H "Content-Type: application/json" \
  -d '{"name": "my-agent"}'
response
{
  "api_key": "am_sk_xxx",
  "tier": "free",
  "upgrade_via_mcp": {
    "dodo_mcp": "https://mcp.dodopayments.com/sse",
    "product_id": "pdt_0NhKvw8RSLuiPu2bD2IQH"
  }
}

Step 3 โ€” Agent pays itself via the Dodo MCP

The agent calls the code_execution tool to run TypeScript against the Dodo SDK:

code_execution (TypeScript)
import DodoPayments from "dodopayments";

const client = new DodoPayments({
  bearerToken: process.env.DODO_PAYMENTS_API_KEY
});

const subscription = await client.subscriptions.create({
  product_id: "pdt_0NhKvw8RSLuiPu2bD2IQH",
  quantity: 1,
  metadata: {
    agentmemo_key_id: YOUR_PUBLIC_KEY_ID
  }
});

console.log("Subscribed:", subscription.id);

Pass your public key ID (am_pk_xxx), never your secret key (am_sk_xxx). Your secret stays on your side only. This also enables automatic Pro upgrade without an email address โ€” perfect for fully autonomous agents.

Step 4 โ€” Webhook auto-upgrades AgentMemo

Dodo fires a signed webhook to agentmemo.dev/webhooks/dodo. AgentMemo reads metadata.agentmemo_key_id, matches it to your key, and upgrades it to Pro automatically (falling back to customer email if no metadata key id is present). The agent now has unlimited memory operations โ€” its very next /memory/store call already runs on Pro.

No human needed โ€” agents upgrade themselves.

Discovery โ†’ payment โ†’ upgrade is fully programmatic. This is what fully autonomous agent operation looks like.

See pricing โ†’ ยท MCP docs โ†’