{
  "markdown": "# AgentPay MCP Server\n\n**Agent-to-Agent micropayments via x402 + MCP** — let AI agents autonomously pay for API access with USDC on Base.\n\n<!-- mcp-name: io.github.yyxqqq777/agentpay -->\n\n## Install\n\n### Option A — Remote MCP（推荐，无需本地安装）\n\n在 Cursor / Claude / 任意支持 Streamable HTTP 的客户端添加：\n\n`https://agentpay-xhs-production.up.railway.app/mcp`\n\n官方 Registry 条目：`io.github.yyxqqq777/agentpay`\n\n### Option B — 本地 stdio（`uvx` / PyPI）\n\n```json\n{\n  \"mcpServers\": {\n    \"agentpay\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-server-agentpay\"],\n      \"env\": {\n        \"AGENT_PRIVATE_KEY\": \"0xYourAgentPrivateKey\"\n      }\n    }\n  }\n}\n```\n\n只需填付款钱包私钥（需有 USDC）。网关地址已内置，一般不用改。\n\n或永久安装：\n\n```bash\npip install mcp-server-agentpay\n# or\nuv tool install mcp-server-agentpay\n```\n\n## Tools\n\n| Tool | Description | Cost |\n|------|-------------|------|\n| `xhs_get_note_detail` | Xiaohongshu note detail | 0.01 USDC/call |\n| `xhs_get_user_notes` | Xiaohongshu user posted notes list | 0.01 USDC/call |\n| `china_wholesale_pricing_query` | Factory-direct wholesale pricing (1688/Yiwu) | 0.01 USDC/call |\n| `agentpay_payment_status` | View payment config, wallet, and spending limits | Free |\n\n### Example prompts\n\n- \"帮我看看这条小红书笔记写了什么：https://www.xiaohongshu.com/explore/...\"\n- \"拉一下这个博主最近发的笔记，user_id=...\"\n- \"Search wholesale prices for wireless earbuds under $3\"\n- \"What's my AgentPay wallet and spending limit?\"\n\n## Environment Variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `AGENT_PRIVATE_KEY` | Yes（付费工具） | 付款钱包私钥 |\n| `MAX_SPEND_PER_CALL` | No | 单次上限（默认 `0.10`） |\n| `GATEWAY_BASE_URL` | No | 网关地址（默认已指向公网 Gateway） |\n\n## How it works\n\n```\nMCP Client  →  mcp-server-agentpay  →  x402 Gateway  →  Paid API\n              (auto 402 → sign → retry)   (verify USDC)\n```\n\n1. Tool call hits a paid API endpoint\n2. Gateway returns `402 Payment Required` with USDC payment details\n3. MCP server signs payment and retries automatically\n4. JSON data flows back to the LLM\n\n## Self-host the Gateway\n\nIf you operate the paid API, deploy the gateway separately:\n\n```bash\npip install \"mcp-server-agentpay[gateway]\"\n# .env: PAYMENT_MODE=production + upstream keys + your receive wallet\nagentpay-gateway\n```\n\n### Real USDC settlement (x402)\n\n| Mode | Behavior |\n|------|----------|\n| `PAYMENT_MODE=demo` | Local fake pay (dev only) |\n| `PAYMENT_MODE=production` | Official Facilitator **verify + settle** on-chain |\n\n**Testnet (Base Sepolia)** — use `https://x402.org/facilitator`, network `eip155:84532`.\n\n```bash\n# Fund a test agent with Sepolia USDC, then:\nPYTHONPATH=src python scripts/test_x402_settlement.py\n```\n\n**Mainnet** — set `PAYMENT_NETWORK=eip155:8453` and a mainnet facilitator\n(`https://api.cdp.coinbase.com/platform/v2/x402` or PayAI). USDC goes to `WALLET_RECIPIENT_ADDRESS`.\n\nSee [`.env.example`](.env.example).\n\n## Publish to MCP Registry\n\nThis package is designed for the [official MCP Registry](https://registry.modelcontextprotocol.io).\n\n```bash\n# 1. Publish to PyPI\npip install build twine\npython -m build && twine upload dist/*\n\n# 2. Publish to MCP Registry (packages + remotes)\n./scripts/publish_all.sh\n```\n\nOr create a GitHub Release (`v0.1.0`) — Actions uses Trusted Publishing to PyPI then updates the Registry.\n\nBefore publishing, update `server.json` and README `mcp-name` with your GitHub namespace (`io.github.<username>/agentpay`).\n\n## Development\n\n```bash\ngit clone https://github.com/yyxqqq777/mcp-server-agentpay\ncd mcp-server-agentpay\npython -m venv .venv && source .venv/bin/activate\npip install -e \".[dev]\"\npytest tests/ -v\n```\n\n## License\n\nMIT\n",
  "bytes": 3583,
  "sha": "a5eb962a89dcfda1f8bc0b35a88410d8f4933fd5aeffd734dfb1833a3605ac6c",
  "repo_slug": "yyxqqq777/mcp-server-agentpay",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_yyxqqq777_agentpay_3fa05a08/readme"
}