Ag402 MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install ag402-core
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add ag402-mcp -- node "<FULL_PATH_TO_AG402>/dist/index.js"

Replace <FULL_PATH_TO_AG402>/dist/index.js with the actual folder you prepared in step 1.

README.md

Give your AI agent a wallet. It pays for APIs automatically.

Ag402

<strong>Give your AI agent a wallet. It pays for APIs automatically.</strong>


&nbsp;
&nbsp;

Ag402 is the payment layer for the Coinbase x402 protocol. It makes AI agents pay for API calls automatically — on Solana, in USDC, with zero code changes.

Agent calls API → 402 Payment Required → Ag402 auto-pays USDC on Solana → 200 OK

Non-custodial. Zero telemetry. Already in production.


Why Ag402

Zero friction

  • Zero code changes for buyers, sellers, and MCP developers
  • One command to start paying: ag402 run -- python my_agent.py
  • One command to start selling: ag402 serve --target ... --price ... --address ...
  • One command to install MCP tools: ag402 install claude-code
  • No config files, no API keys, no accounts, no signup
  • Colab one-click demo — try it in your browser, zero install

Open standard

  • Implements Coinbase x402 — the emerging HTTP payment standard
  • MIT licensed, fully open source, extensible protocol layer (open402) with zero dependencies
  • AI-native docs — ships with `llms.txt` so LLM agents can read the full CLI reference natively

Battle-tested

  • Token RugChecklive on Solana mainnet with real USDC payments
  • 775+ tests, 90%+ coverage, 4 rounds of internal security review (24/24 issues fixed)
  • Multi-endpoint RPC failover + circuit breaker + async delivery retry

Blazing fast

  • ~0.5s standard payment (confirmed finality, not 13s finalized)
  • ~1ms prepaid payment (local HMAC, no on-chain call)
  • Zero overhead on non-402 requests — no body read, no allocation
  • Connection pooling, lazy imports, SQLite WAL mode

Security-first

  • 6-layer budget protection — per-tx / per-minute / daily / circuit breaker / rollback / key redaction
  • Non-custodial — private keys never leave your machine
  • Seller-No-Key — sellers only need a public address, zero private key risk
  • Zero telemetry — no tracking, no IP logging, no analytics
  • Wallet encryption: PBKDF2 (480K iter) + AES
  • CI: CodeQL + Trivy + pip-audit + Semgrep + OpenSSF Scorecard

Universal compatibility

  • Claude Code, Cursor, Claude Desktop — MCP auto-config
  • OpenClaw — native Skill (SKILL.md + TOOLS.md + skill.py), not just MCP
  • LangChain, AutoGen, CrewAI, Semantic Kernel — works automatically
  • Any Python agent using httpx or requests — zero changes
  • TypeScript/Node.js agents@ag402/fetch npm package, zero dependencies

Zero Code Changes. For Everyone.

You are... What you do Code changes
Agent user (LangChain, CrewAI, AutoGen, any Python agent) pip install ag402-core && ag402 run -- python my_agent.py Zero — your agent code is untouched
TypeScript/Node.js agent developer npm install @ag402/fetch — wrap fetch() w

Configuration

claude_desktop_config.json
{ "mcpServers": { "ag402": { "command": "ag402", "args": ["mcp"] } } }

Try it

Configure my Claude Desktop to use Ag402 for automatic API payments.
Help me set up a paywall for my local MCP server using the ag402 serve command.
Show me how to run my existing Python agent with Ag402 enabled to handle API payments.
Explain how to install the Ag402 MCP tools for Claude Code.

Frequently Asked Questions

What are the key features of Ag402?

Automatic USDC payments on Solana for API calls. Zero code changes required for agents or API providers. Implements the Coinbase x402 HTTP payment standard. Non-custodial wallet management with encrypted keys. 6-layer budget protection including circuit breakers.

What can I use Ag402 for?

Enabling AI agents to access paid premium APIs without manual intervention. Monetizing custom MCP servers by adding a paywall with one command. Automating micro-payments for data scraping or API-heavy research tasks. Integrating secure, non-custodial payment flows into existing Python-based AI agents.

How do I install Ag402?

Install Ag402 by running: pip install ag402-core

What MCP clients work with Ag402?

Ag402 works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Ag402 docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare