X402 Trinity logo

X402 Trinity

MCP tools for checking prices, paying for x402 resources, and monitoring a capped Base USDC wallet.

Install X402 Trinity

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": [
        "-y",
        "x402-trinity-whoami"
      ],
      "env": {
        "X402_PRIVATE_KEY": "YOUR_VALUE_HERE",
        "X402_MAX_PER_REQUEST": "YOUR_VALUE_HERE",
        "X402_TOTAL_BUDGET": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env X402_PRIVATE_KEY=YOUR_VALUE_HERE --env X402_MAX_PER_REQUEST=YOUR_VALUE_HERE --env X402_TOTAL_BUDGET=YOUR_VALUE_HERE --transport stdio x402-trinity -- npx -y x402-trinity-whoami

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

The install command didn't complete successfully in our automated test.

npx -y x402-trinity-whoami

error 404 'x402-trinity-whoami@*' is not in this registry. npm error 404 npm error 404 Note that you can also install from a npm error 404 tarball, folder, http url, or git url. npm notice npm notice New major version of npm available! 10.9.9 -> 12.2.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.2.2 npm notice To update run: npm install -g npm@12.2.2 npm notice npm error A complete log of this run can be found in: /home/user/.npm/_logs/2026-11-11T14_15_32_211Z-debug-0.log

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The x402 Trinity MCP server gives an AI agent tools to inspect x402 prices, pay for eligible HTTP resources, and check wallet usage. It runs locally through npx, signs payments with a configured wallet, and enforces spending caps and host restrictions from environment variables. Base mainnet and USDC are the shipped defaults, while other EVM networks can be configured in the underlying library. Use it when an agent needs controlled access to paywalled APIs, files, datasets, or agent services.

Use cases

  • Check the price of a paywalled API before payment
  • Fetch x402-protected datasets within a fixed budget
  • Restrict agent payments to approved hosts
  • Monitor wallet balance and remaining spend
  • Pay for another agent’s HTTP service

Key features

  • Price checks without payment
  • Automatic x402 payment and fetch
  • Wallet balance and budget status
  • Mandatory per-request and total limits
  • Host and network restrictions
  • Local signing with Base USDC support

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · x402-trinity-whoami (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Install checkInconclusiveInstall command did not finish in our automated test.

How X402 Trinity works

What the x402 Trinity MCP server does

The x402 Trinity MCP server exposes three MCP tools for agents that need to use HTTP resources requiring x402 payments:

  • check_price inspects what a resource requests without sending payment.
  • pay_and_fetch retrieves a resource and pays when the challenge satisfies the configured policy.
  • wallet_status reports the wallet address, balance, amount spent, and remaining budget.

The MCP package is a buyer interface. It does not provide seller functionality, hold funds, broadcast transactions, or act as a hosted signing service. The payment flow is intended for resources that answer with HTTP 402, including paid APIs, datasets, files, and services offered by other agents.

How it works

Run the MCP server with npx -y x402-trinity-mcp and provide its wallet and policy through the client configuration. When a tool requests a paid resource, the server reads the x402 challenge, checks the amount and destination against its limits, signs locally, and retries the request. Base mainnet with USDC is the default release configuration.

The x402 Trinity MCP server supports x402 protocol versions 1 and 2 and declines unknown versions rather than guessing how to handle them. Its payment model uses EIP-3009, allowing a facilitator to submit the transfer while the payer wallet only needs USDC rather than gas. The private key remains in the server process unless a separate signing arrangement is used by the underlying library.

Setup and configuration

Add an MCP entry similar to the following to a compatible client:

config.json
{
  "mcpServers": {
    "x402-trinity": {
      "command": "npx",
      "args": ["-y", "x402-trinity-mcp"],
      "env": {
        "X402_PRIVATE_KEY": "0x...",
        "X402_MAX_PER_REQUEST": "50000",
        "X402_TOTAL_BUDGET": "1000000"
      }
    }
  }
}

X402_PRIVATE_KEY, X402_MAX_PER_REQUEST, and X402_TOTAL_BUDGET are required; the process refuses to start without them. X402_BUDGET_FILE can persist spending across restarts, and X402_ALLOW_HOSTS restricts payment to named hosts. X402_NETWORKS selects permitted networks, with base shown in the supplied configuration.

Tools and capabilities

The x402 Trinity MCP server separates price inspection from payment, so an agent can check a charge before committing funds. Its payment tool applies a maximum amount per request and a total budget supplied outside the model. Host restrictions provide another boundary when the wallet is used with external URLs.

The broader x402-trinity package supports Node, Bun, Deno, and Cloudflare Workers, but the supplied MCP setup is launched as a command-line process. The library also offers Python buyer support and a TypeScript seller interface; those are separate from the MCP tool surface.

Limitations and notes

The total budget is otherwise an in-memory, per-instance counter. On restart, or across Cloudflare Worker isolates, it resets unless a durable budget store is configured. The README recommends using a budget file for mainnet or explicitly acknowledging an ephemeral budget.

The wallet key is present in the process, so it should be dedicated and funded only with an amount acceptable to lose. Spending caps are mandatory, but they do not make the key safe if it is exposed elsewhere. The server does not pay without limits, and it does not support protocols it does not recognize. Base plus USDC is the shipped default; other EVM networks require custom configuration in the underlying library.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about X402 Trinity

x402 Trinity is an MCP server that connects an AI agent to x402-protected HTTP resources using a local wallet. Its main tools are check_price for unpaid price inspection, pay_and_fetch for policy-controlled payment and retrieval, and wallet_status for address, balance, spending, and remaining-budget details. Base USDC is the shipped default.

Install it through an MCP client by configuring the command npx with arguments -y and x402-trinity-mcp. Set X402_PRIVATE_KEY, X402_MAX_PER_REQUEST, and X402_TOTAL_BUDGET in the server environment; the process refuses to start when any required variable is missing.

Set X402_ALLOW_HOSTS to the approved host names. The MCP server then limits payment to those hosts, so a resource’s x402 challenge cannot expand the permitted destination beyond the environment-defined allowlist.

Set X402_BUDGET_FILE to a durable file path. Without a budget store, the total budget is an in-memory per-instance counter that resets on restart; the README recommends a durable budget for mainnet use.

Yes, the underlying library supports other EVM networks through custom configuration, while Base mainnet with USDC is the shipped default. The MCP example uses X402_NETWORKS=base; other network entries require configuration supported by the library.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewX402 Trinity AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/x402-trinity?style=directory)](https://allmcps.com/mcp/x402-trinity)
HTML Embed
<a href="https://allmcps.com/mcp/x402-trinity"><img src="https://allmcps.com/api/badge/x402-trinity?style=directory" alt="X402 Trinity on AllMCPs" /></a>