AgentPay

Registre officiel IA et agents

x402 micropayments MCP: Xiaohongshu notes and paid APIs settled in USDC on Base.

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

Remote (streamable-http)
Claude Code
claude mcp add --transport http agentpay 'https://agentpay-xhs-production.up.railway.app/mcp'
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "agentpay": {
            "type": "http",
            "url": "https://agentpay-xhs-production.up.railway.app/mcp"
        }
    }
}
PYPI package mcp-server-agentpay
Claude Code
claude mcp add agentpay -e 'AGENT_PRIVATE_KEY=<your agent_private_key>' -e 'MAX_SPEND_PER_CALL=0.10' -e 'GATEWAY_BASE_URL=https://agentpay-xhs-production.up.railway.app' -- uvx mcp-server-agentpay==0.1.3
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "agentpay": {
            "command": "uvx",
            "args": [
                "mcp-server-agentpay==0.1.3"
            ],
            "env": {
                "AGENT_PRIVATE_KEY": "<your agent_private_key>",
                "MAX_SPEND_PER_CALL": "0.10",
                "GATEWAY_BASE_URL": "https://agentpay-xhs-production.up.railway.app"
            }
        }
    }
}

Variables d'environnement

  • AGENT_PRIVATE_KEY obligatoire secret EVM private key for signing USDC micropayments on Base (wallet must hold USDC)
  • MAX_SPEND_PER_CALL Maximum USDC the agent may spend per API call (default: 0.10)
  • GATEWAY_BASE_URL Optional override of the AgentPay gateway URL

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. AgentPay MCP Server
  2. Install
  3. Tools
  4. Environment Variables
  5. How it works
  6. Self-host the Gateway
  7. Publish to MCP Registry
  8. Development
  9. License

AgentPay MCP Server

Agent-to-Agent micropayments via x402 + MCP — let AI agents autonomously pay for API access with USDC on Base.

Install

Option A — Remote MCP(推荐,无需本地安装)

在 Cursor / Claude / 任意支持 Streamable HTTP 的客户端添加:

https://agentpay-xhs-production.up.railway.app/mcp

官方 Registry 条目:io.github.yyxqqq777/agentpay

Option B — 本地 stdio(uvx / PyPI)
{
  "mcpServers": {
    "agentpay": {
      "command": "uvx",
      "args": ["mcp-server-agentpay"],
      "env": {
        "AGENT_PRIVATE_KEY": "0xYourAgentPrivateKey"
      }
    }
  }
}

只需填付款钱包私钥(需有 USDC)。网关地址已内置,一般不用改。

或永久安装:

pip install mcp-server-agentpay
# or
uv tool install mcp-server-agentpay

Tools

ToolDescriptionCost
xhs_get_note_detailXiaohongshu note detail0.01 USDC/call
xhs_get_user_notesXiaohongshu user posted notes list0.01 USDC/call
china_wholesale_pricing_queryFactory-direct wholesale pricing (1688/Yiwu)0.01 USDC/call
agentpay_payment_statusView payment config, wallet, and spending limitsFree
Example prompts
  • "帮我看看这条小红书笔记写了什么:https://www.xiaohongshu.com/explore/...";
  • "拉一下这个博主最近发的笔记,user_id=..."
  • "Search wholesale prices for wireless earbuds under $3"
  • "What's my AgentPay wallet and spending limit?"

Environment Variables

VariableRequiredDescription
AGENT_PRIVATE_KEYYes(付费工具)付款钱包私钥
MAX_SPEND_PER_CALLNo单次上限(默认 0.10)
GATEWAY_BASE_URLNo网关地址(默认已指向公网 Gateway)

How it works

MCP Client  →  mcp-server-agentpay  →  x402 Gateway  →  Paid API
              (auto 402 → sign → retry)   (verify USDC)
  1. Tool call hits a paid API endpoint
  2. Gateway returns 402 Payment Required with USDC payment details
  3. MCP server signs payment and retries automatically
  4. JSON data flows back to the LLM

Self-host the Gateway

If you operate the paid API, deploy the gateway separately:

pip install "mcp-server-agentpay[gateway]"
# .env: PAYMENT_MODE=production + upstream keys + your receive wallet
agentpay-gateway
Real USDC settlement (x402)
ModeBehavior
PAYMENT_MODE=demoLocal fake pay (dev only)
PAYMENT_MODE=productionOfficial Facilitator verify + settle on-chain

Testnet (Base Sepolia) — use https://x402.org/facilitator, network eip155:84532.

# Fund a test agent with Sepolia USDC, then:
PYTHONPATH=src python scripts/test_x402_settlement.py

Mainnet — set PAYMENT_NETWORK=eip155:8453 and a mainnet facilitator (https://api.cdp.coinbase.com/platform/v2/x402 or PayAI). USDC goes to WALLET_RECIPIENT_ADDRESS.

See .env.example.

Publish to MCP Registry

This package is designed for the official MCP Registry.

# 1. Publish to PyPI
pip install build twine
python -m build && twine upload dist/*

# 2. Publish to MCP Registry (packages + remotes)
./scripts/publish_all.sh

Or create a GitHub Release (v0.1.0) — Actions uses Trusted Publishing to PyPI then updates the Registry.

Before publishing, update server.json and README mcp-name with your GitHub namespace (io.github.<username>/agentpay).

Development

git clone https://github.com/yyxqqq777/mcp-server-agentpay
cd mcp-server-agentpay
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ -v

License

MIT

Questions fréquentes

Qu'est-ce que AgentPay ?

x402 micropayments MCP: Xiaohongshu notes and paid APIs settled in USDC on Base.

Comment installer AgentPay ?

Il fonctionne comme serveur distant. Dans Claude Code : claude mcp add --transport http agentpay 'https://agentpay-xhs-production.up.railway.app/mcp'. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour AgentPay ?

Oui. Il attend AGENT_PRIVATE_KEY, à renseigner dans sa configuration.

AgentPay est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient AgentPay ?

Il est publié par yyxqqq777. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.