X402 Stacks Agents logo

X402 Stacks Agents

Creates, encodes, and verifies Stacks x402 payments, validates wallets, checks transactions, and scaffolds Cloudflare Agents projects.

Install X402 Stacks Agents

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-stacks-agents": {
      "command": "npx",
      "args": [
        "-y",
        "x402-stacks-agents"
      ]
    }
  }
}

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

Claude Code command
claude mcp add --transport stdio x402-stacks-agents -- npx -y x402-stacks-agents

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

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y x402-stacks-agents

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

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-stacks-agents MCP server exposes Stacks x402 payment workflows through eight JSON-schema MCP tools, including payment requirement creation, payload encoding, payment verification, transaction checks, address validation, wallet generation, and Cloudflare Agents project initialization. It supports STX, sBTC, and USDCx mappings across mainnet and testnet, with offline payment verification or on-chain checks through the Hiro API. Reach for it when an agent needs to handle HTTP 402 payment data or validate Stacks transfers without adding runtime dependencies. It creates and verifies payment data but does not sign Stacks transactions.

Use cases

  • Create HTTP 402 payment requirements for paid agent endpoints
  • Verify STX, sBTC, or SIP-010 payment transactions
  • Encode x402 payment payloads for retry requests
  • Validate Stacks addresses and derive them from public keys
  • Initialize Cloudflare Agents projects with x402 routes

Key features

  • x402 v2 payment requirement and payload handling
  • Stacks STX, sBTC, and USDCx support
  • Offline payment and on-chain transaction verification
  • c32check address validation and secp256k1 wallet generation
  • Cloudflare Agents project scaffolding
  • MCP stdio server with eight closed-schema tools

Tools8

What X402 Stacks Agents lets your agent do. Expand a tool for its parameters.

Self-reported~136 tokens of context

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.

5/5 checks healthy over the last 20d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 2d ago via OSV.dev · x402-stacks-agents (npm)

Adoption & maintenance

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

npm downloads782Package downloads in the last 30 days.
Last commit1mo agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed8Callable tools this server registers over MCP.

How X402 Stacks Agents works

What x402-stacks-agents does

x402-stacks-agents provides Node.js and MCP tooling for the x402 v2 payment flow on Stacks. It can build payment requirements for HTTP 402 responses, encode payment payloads, and compare submitted payments with expected scheme, network, recipient, asset, amount, and optional memo values.

The package covers STX, sBTC, and USDCx asset mappings on Stacks mainnet and testnet. It also validates c32check addresses, derives addresses from secp256k1 public keys, generates Stacks wallets, and verifies confirmed STX or SIP-010 transfers. Wallet generation uses Node.js cryptography, and private-key output requires an explicit full-generation operation.

A project generator creates a Cloudflare Agents and Wrangler scaffold containing configuration, source files, environment-variable examples, and a paid Durable Object route. The CLI also supports configuration management, receipts in JSON or Markdown, and a local payments ledger.

How it works

The MCP interface uses closed JSON Schemas and JSON-RPC 2.0 notifications. Payment requirements can contain multiple accepted tokens in preference order. The resulting requirement can be represented as an HTTP 402 response with a JSON body and a base64 payment-required header.

Payment verification is deterministic when given the payment data and requirements. Transaction verification can instead inspect a local transaction object or query the configured Hiro API. Checks include transaction status, confirmation count, network, recipient, amount, token contract, and optional SIP-010 memo. Pending transactions can be polled with bounded timeouts.

The package does not sign Stacks transactions. A raw signed transaction can be sent to an x402 facilitator through httpFacilitator, while a transaction ID can be checked directly against chain data.

Setup and configuration

The package requires Node.js 22.5 or newer and has no runtime dependencies or install scripts. Install it with npm, then run the offline test suite with npm test; npm run test:packed checks the packed npm archive and generated CLI project.

The CLI can initialize a project and write its configuration under .x402-stacks/config.json. Configuration fields include network, recipient, token, amount, apiUrl, maxTimeoutSeconds, and minConfirmations. Amounts use token-specific atomic units: satoshis for sBTC, microSTX for STX, and micro-USDCx for USDCx.

On-chain lookups use a Stacks API endpoint. A Hiro API key is optional and can provide higher rate limits. For containerized use, build the included Docker image and run the MCP process interactively.

Generated projects do not install packages or deploy automatically. Initialization rejects a nonempty directory unless forced, and overwriting generated files requires explicit confirmation. Generated private keys should be protected and kept out of source control.

Tools and capabilities

The MCP tool set includes:

  • x402_payment_requirements for payment-required documents and headers.
  • x402_payment_encode for creating and encoding payment payloads.
  • x402_payment_verify for matching and verifying encoded payments.
  • x402_stacks_transaction_verify for confirmed STX or SIP-010 transfer checks.
  • x402_stacks_address_validate for c32check, address type, and network validation.
  • x402_stacks_address_from_public_key for deriving a Stacks address from a secp256k1 public key.
  • x402_stacks_wallet_generate for generating a wallet with opt-in private-key export.
  • x402_project_init for creating a Cloudflare Agents x402 project.

The related CLI supports payment-required generation, payment encoding and verification, transaction lookup, address operations, configuration commands, pending-transaction polling, receipt export, and ledger recording.

Limitations and notes

Payment verification can be performed offline, but transaction lookups require access to a configured Stacks API unless a transaction object is supplied. Verification rejects unsuccessful transactions, incorrect networks, recipients, amounts, token contracts, or insufficient confirmations.

The MCP server is suitable for payment preparation and verification, not transaction signing. The generated wallet functionality produces key material, so operators must handle private keys securely.

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 Stacks Agents

x402-stacks-agents is an MCP server that connects AI agents to Stacks x402 payment workflows and exposes tools for creating payment requirements, encoding and verifying payments, checking STX or SIP-010 transactions, validating addresses, generating wallets, and scaffolding Cloudflare Agents projects. It supports offline payment checks and Hiro API lookups.

Install it with npm using `npm install x402-stacks-agents`, then configure an MCP client to launch its stdio server. The package requires Node.js 22.5 or newer and has no runtime dependencies.

Yes, x402-stacks-agents works with Cursor. It also works with Claude Desktop, Windsurf, and other MCP clients through its stdio MCP server.

No, a Hiro API key is optional. Payment verification is offline and deterministic; transaction lookups can use a configured Stacks API endpoint, with a Hiro key available for higher rate limits.

No, x402-stacks-agents does not sign Stacks transactions. It creates and verifies payment data, while a raw signed transaction can be sent to an x402 facilitator or checked by transaction ID.

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 Stacks Agents AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/x402-stacks-agents?style=directory)](https://allmcps.com/mcp/x402-stacks-agents)
HTML Embed
<a href="https://allmcps.com/mcp/x402-stacks-agents"><img src="https://allmcps.com/api/badge/x402-stacks-agents?style=directory" alt="X402 Stacks Agents on AllMCPs" /></a>