# x402-stacks-agents [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/lakkadapugopi-art/x402-stacks-agents  
**GitHub Stars:** 0  
**npm Downloads (last month):** 782  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/x402-stacks-agents

## Description
Zero-dependency Stacks x402 payment tools, Cloudflare Agents scaffolding, CLI, and MCP server

## Tools
Capabilities this server exposes over MCP:

- **x402_payment_requirements** — Create a payment-required document and HTTP header
- **x402_payment_encode** — Create and encode an x402 payment payload
- **x402_payment_verify** — Match and verify an encoded payment
- **x402_stacks_transaction_verify** — Verify a confirmed STX or SIP-010 transfer
- **x402_stacks_address_validate** — Validate c32check checksum, type, and network
- **x402_stacks_address_from_public_key** — Derive an address from secp256k1 public key
- **x402_stacks_wallet_generate** — Generate a wallet; private key export is opt-in
- **x402_project_init** — Create a Cloudflare Agents x402 project

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "x402-stacks-agents": {
    "command": "npx",
    "args": ["-y","x402-stacks-agents"]
  }
}
```

## Documentation

## 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.

_Full upstream README: https://allmcps.com/mcp/x402-stacks-agents/readme_

