SuperAPI AI Directory

agenticpay

x402 micropayments stack for MCP: pay-per-tool-call USDC settlement on Solana via a self-hostable facilitator, with SDK, CLI and paywall middleware.

Open website

About this tool

Purpose

agenticpay provides pay-per-tool-call micropayment infrastructure for the MCP (Model Context Protocol) ecosystem. The current AI agent stack defaults to humans holding credit cards, and this model breaks down once agents autonomously call APIs, hire sub-agents, or pay for compute. The project advocates solving this with HTTP-based stablecoin micropayments: any MCP tool can declare a price, any agent can pay autonomously, and settlement completes on Solana in about 1.5 seconds.

Main Capabilities

  • Declare a price for any MCP tool; agents pay in USDC via the x402 protocol, settling on Solana.
  • Provides a complete technology stack: SDK, CLI, paywall middleware, a self-hostable x402 facilitator, and a live LLM agent demo.
  • Can point to a public testnet facilitator: set the mcp-server's FACILITATOR_URL to https://agentpay-facilitator-e9b20a5fee6a.herokuapp.com to test on devnet without deploying your own.
  • Ships with an Anthropic Skill (.claude/skills/agenticpay/SKILL.md); after copying it to ~/.claude/skills/, Claude Code gains context about agenticpay, guiding you through monetizing an MCP server, generating tool routing, and verifying on-chain settlement.
  • Demonstrates a real Claude Opus agent receiving a task, deciding which paid tools to use, autonomously paying via x402 micropayments on Solana, and answering the user. The repository provides on-chain proof on Solana devnet (transaction signatures settled by the self-hosted facilitator and x402.org).

Usage

  • Quick start (devnet, about 5 minutes, free): the repository instructions provide a quick-start flow and recommend cloning the monorepo on first run to get the dual-agent live demo and easily editable templates.
  • Framework integration: the examples/ directory provides ready-to-use templates for common AI agent stacks; see examples/README.md for the integration matrix.
  • Facilitator choice: can point to the public x402.org/facilitator for testnet/devnet, or to Coinbase CDP for mainnet; you can also self-host the complete facilitator implementation provided in the repository to fork, audit, or deploy as a service.

Use Cases

Suitable for developers who need to charge per call for MCP tools, and for AI agent stacks that want agents to autonomously complete micropayments. Typical uses include: adding payment capabilities to an MCP server, integrating into common agent frameworks based on the example templates, running the dual-agent demo, and testing the USDC micropayment settlement flow on Solana.

About the facilitator

If you have not encountered x402 before: the facilitator is a trusted intermediary responsible for (1) verifying the agent-signed payment payload, (2) submitting the on-chain USDC transfer, and (3) paying the SOL gas fee, so the agent does not need to hold SOL, only USDC. Most MCP developers do not need to build their own facilitator and can point to a hosted service; this repository provides a complete implementation that supports self-hosting, forking, audit, or deploy as a service.

Handling failed paid calls

Failed tool calls are not charged. x402 settlement is an irreversible push, and the middleware constrains the settlement timing:

  1. Pre-execution verification: the payment payload (signature, funds, requirement match) is verified before the tool handler runs. If the payment is invalid, HTTP 402 is returned and the tool does not execute.
  2. Execution with buffered response: the handler runs, but its response is buffered and not yet sent to the agent.
  3. Settle only on success: if the handler returns a status code ≥ 400, the middleware skips settlement entirely and returns the error directly; failed calls are not charged.
  4. No result without payment: if on-chain settlement itself fails, the buffered tool result is discarded, the agent receives a payment error, and the server does not leak the unpaid result.

A limitation to note: if a tool returns 200 OK but the content is a garbage answer, it will still be charged—the protocol cannot judge response quality. This is also why the per-call price in the demo is kept tiny ($0.0005–$0.001): the worst case is bounded by the price of one call, and quality constraints should belong to a reputation layer (see the roadmap) rather than the payment protocol.

Current status and to-dos

The project is labeled pre-alpha and has been verified end-to-end on devnet. Mainnet configuration is supported, but it requires funding the facilitator with real SOL and pointing to a mainnet-capable RPC (such as Helius, QuickNode, etc.).

The roadmap/to-dos include: a devnet end-to-end demo (smoke + LLM agent), a self-hosted x402 facilitator (verification + settlement, fee_payer abstraction), real MCP server templates (search, fetch, summarize, extract, rather than a toy reverse_string), on-chain escrow for long-running tasks (Anchor program), an on-chain agent reputation registry, and a hosted facilitator service (agenticpay.com). The specific completion status and availability of each of the above have not yet been provided.

Other information

The repository name is inconsistent between the title and the path (the title is agenticpay-dev/agenticpay, the URL is github.com/krystiangw/agenticpay); the actual correspondence has not yet been provided. The project is released under the MIT license and is entirely TypeScript. Regarding the website, spend caps, npm and other sections, only the titles are listed in the materials; detailed explanations have not yet been provided.