Skip to content
MCP server

x402 Trinity

Give an agent a wallet. Pays for x402 resources within hard limits. Base + USDC, gasless.

Runs locallyStatus and history
Install
Pricing
Open source
Runs
Locally
Version
0.2.4
Listing updated
5 days ago

About x402 Trinity

x402 Trinity is an open-source MCP server. It runs locally on your machine and is started by your AI client.

Install

Run in a terminal

claude mcp add x402-trinity --env X402_PRIVATE_KEY='<X402_PRIVATE_KEY>' --env X402_MAX_PER_REQUEST='<X402_MAX_PER_REQUEST>' --env X402_TOTAL_BUDGET='<X402_TOTAL_BUDGET>' -- npx -y x402-trinity

Add to claude_desktop_config.json

{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity"
      ],
      "env": {
        "X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>",
        "X402_MAX_PER_REQUEST": "<X402_MAX_PER_REQUEST>",
        "X402_TOTAL_BUDGET": "<X402_TOTAL_BUDGET>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity"
      ],
      "env": {
        "X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>",
        "X402_MAX_PER_REQUEST": "<X402_MAX_PER_REQUEST>",
        "X402_TOTAL_BUDGET": "<X402_TOTAL_BUDGET>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "x402-trinity": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity"
      ],
      "env": {
        "X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>",
        "X402_MAX_PER_REQUEST": "<X402_MAX_PER_REQUEST>",
        "X402_TOTAL_BUDGET": "<X402_TOTAL_BUDGET>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity"
      ],
      "env": {
        "X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>",
        "X402_MAX_PER_REQUEST": "<X402_MAX_PER_REQUEST>",
        "X402_TOTAL_BUDGET": "<X402_TOTAL_BUDGET>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity"
      ],
      "env": {
        "X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>",
        "X402_MAX_PER_REQUEST": "<X402_MAX_PER_REQUEST>",
        "X402_TOTAL_BUDGET": "<X402_TOTAL_BUDGET>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • X402_PRIVATE_KEYPrivate key of the wallet that pays. Use a dedicated wallet holding only what you would accept losing. The server refuses to start without it.Required
  • X402_MAX_PER_REQUESTHard ceiling for a single payment, in atomic units (USDC has 6 decimals, so 50000 is $0.05). Required: a model decides when payments happen, so the cap cannot come from the model.Required
  • X402_TOTAL_BUDGETLifetime ceiling across all payments, in atomic units. Required for the same reason as the per-request cap.Required
  • X402_BUDGET_FILEPath to a file that makes the lifetime budget survive restarts. Without it the total resets every time the server starts.
  • X402_ALLOW_HOSTSComma-separated hosts that may be paid. Anything else is refused however convincing the challenge looks.
  • X402_NETWORKSNetworks to accept. Defaults to base.

Pricing

Open source

x402 Trinity FAQ

Is x402 Trinity free?

Yes. x402 Trinity is open source, so you can use and self-host it for free.

How do I add x402 Trinity to Claude Code?

Run this command in your terminal: claude mcp add x402-trinity --env X402_PRIVATE_KEY='<X402_PRIVATE_KEY>' --env X402_MAX_PER_REQUEST='<X402_MAX_PER_REQUEST>' --env X402_TOTAL_BUDGET='<X402_TOTAL_BUDGET>' -- npx -y x402-trinity

Where this comes from

  • Description: from the official MCP Registry entry.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers