AiFinPay

MCP เซิร์ฟเวอร์สำหรับเอเจนต์ AI อัตโนมัติ: ข้อมูลประจำตัวเอเจนต์แบบถาวร การแก้ไข Agent Passport การค้นหาเส้นทาง ประวัติการชำระเงิน โควตา และใบแจ้งหนี้การชำระเงินแบบไม่ต้องลงนาม AIFP-1/AIFP-2

GitHub
3
ลองใช้ MCP นี้ผู้สนับสนุน

เอกสาร

AiFinPay — payment infrastructure for AI agents

AiFinPay provides payment and monetization infrastructure for autonomous AI agents.

  • Agent side: identity, wallet discovery, payment history, route discovery, quotas and settlement preparation.
  • Merchant side: HTTP 402 paywalls and per-request monetization for AI traffic.
  • Non-custodial design: private keys remain with the agent/operator. Public MCP tools do not expose seeds or private keys.

Canonical domain: https://aifinpay.io

Current package versions

PackageCurrent source versionInstall
aifinpay-agent (Python)2.3.0pip install aifinpay-agent
aifinpay-gate (Python merchant gate)0.1.0pip install aifinpay-gate
@aifinpay/agent (Node / TypeScript)2.3.0npm install @aifinpay/agent
@aifinpay/mcp2.4.1npx @aifinpay/mcp
@aifinpay/mcp-http2.0.4Streamable HTTP wrapper
@aifinpay/skill2.5.1 (source: AiFinPay/skill; bundled by @aifinpay/mcp)npm install @aifinpay/skill
@aifinpay/gate0.3.4npm install @aifinpay/gate
@aifinpay/wallet1.1.0npm install @aifinpay/wallet
@aifinpay/deployments1.1.3deployment registry package

Package lines are versioned independently. The package manifests in this repository and the corresponding npm/PyPI registries are the source of truth.

Install

# MCP
npx @aifinpay/mcp

# Node / TypeScript SDK
npm install @aifinpay/agent

# Python SDK
pip install aifinpay-agent

# Merchant paywall
npm install @aifinpay/gate

# Agent skills
npm install @aifinpay/skill

MCP: current tool surface

The current @aifinpay/mcp source registers these tools:

ToolPurpose
agent_addressRead the current EVM, Solana and Casper public addresses.
agent_reloadReload configured local wallet files without starting a new conversation.
agent_claim_selfLink the agent to its owner's dashboard with a one-time URL from dash.aifinpay.io. Signs only an AiFinPay claim challenge for the agent's own address; moves no funds.
payable_fetchOnly when the owner enables payments. Fetch a GET resource from an owner-approved AIFP-1 merchant, buying a prepaid batch on Polygon v1.4 (POL or a pinned stablecoin) within the owner's limits.
agent_quotaRead the agent's quota.
agent_historyRead indexed AiFinPay payment history or retained receipt history.
agent_passport_resolveResolve a public Agent Passport identity and verified wallet bindings.
settlement_routesRead currently runtime-verified AIFP-1 / AIFP-2 settlement routes.
settlement_invoiceBuild and validate a non-signing EVM settlement invoice.
settlement_solanaBuild and validate a non-signing Solana settlement invoice.
settlement_casperBuild and validate a non-signing Casper settlement invoice.
deployment_infoRead deployment addresses, program IDs and settlement status across supported ecosystems.

With AIFINPAY_MODE=dev, an additional dev_payment_quote tool is available for dev-only quote inspection.

Without owner payment configuration the MCP server is read-only: it signs no payment, and creating an invoice or quote is not a completed payment. payable_fetch is registered — and signs and broadcasts locally — only when the owner sets AIFINPAY_PAYMENTS_ENABLED=1 together with AIFINPAY_MAX_USD, AIFINPAY_DAILY_USD, AIFINPAY_GATEWAY_ORIGINS and AIFINPAY_MAX_GAS_POL; with payments enabled and any of them missing, the server does not start. See mcp/README.md.

Legacy tools such as agent_call, agent_quote, pay_with_split and quote_split are not registered by the current MCP server.

MCP client configuration

{
  "mcpServers": {
    "aifinpay": {
      "command": "npx",
      "args": ["-y", "@aifinpay/mcp"]
    }
  }
}

For a persistent local identity, initialize the keystore once. init creates an encrypted keystore and refuses to create one without a passphrase unless you ask for a plaintext test wallet:

AIFINPAY_WALLET_PASSPHRASE='<a long passphrase>' npx @aifinpay/mcp init
# disposable test wallet only:
npx @aifinpay/mcp init --plaintext

Then use agent_reload and agent_address to verify the selected public wallet. Do not paste seeds or private keys into chat, issues, logs or shared configuration.

Full client setup: MCP_CONFIG.md

SDK payment status

The SDK surfaces have different execution status. Do not treat them as interchangeable.

Node / TypeScript

@aifinpay/agent includes the AIFP-1 fetchPaid path. The 2.3.0 source candidate adds explicitly selected Base v1.4 (ETH or pinned USDC) alongside default Polygon v1.4. Paid execution validates the selected chain, pinned deployment/profile, token and RPC before signing; native payments also require a fresh independent price. Legacy Polygon v1.3 still requires its separately reviewed settlement pin. Source support does not activate a production route or publish a package.

See node/README.md and node/PAYMENT_RECEIPTS.md.

Python

The Python package pays AIFP-1 merchants with AiFinPayAgent.fetch_paid (Polygon v1.4, POL or USDC). The 2.3.0 source candidate also supports explicit chain="base" with ETH or pinned USDC and a required gas budget in wei. Its legacy paid call() settlement path stays disabled. MCP's current payment configuration remains Polygon; these source changes do not add a Base MCP setting.

See python/README.md.

Economics

Current protocol economics documented in the v2 line:

  • AIFP-1: payer pays the quoted gross amount; merchant receives 99%; AiFinPay receives 1%; creator/referral receives 0%.
  • AIFP-2 / x402: provider receives 100%; AiFinPay protocol fee is currently 0%.

Older 98.99% / 1% / 0.01% examples belong to a retired fee model and must not be used as current economics.

Merchant monetization

For a site or API that wants to monetize AI-agent traffic:

npm install @aifinpay/gate

The merchant package can return HTTP 402 challenges, expose discovery metadata and meter paid access. See gate/README.md. Python servers (FastAPI, Starlette, Flask, Django) use pip install aifinpay-gate, the same gate as ASGI/WSGI middleware — see python-gate/README.md and the aifinpay-merchant skill in the AiFinPay/skill repository.

Deployment status

Deployment addresses and program IDs are registry data; they are not, by themselves, proof that settlement is enabled. Use deployment_info or the deployment registry and check settlementEnabled / status before presenting a network as active.

Solana

The old Solana program 5g9zWHF1Vv6GiGpA2ZbJQbSCDZd5hAk9AyvabRJvKFx2 was closed and is not the current program.

The current registry contains the redeployed v1.4.1 programs below, both currently disabled for settlement:

NetworkProgram IDSettlement statusReason
Devnet8dty5bD738Z9TzEkDu8vLSnhpJNWtEGMUEcYaKCUTY6yDisabledBackend receipt verification is not implemented.
Mainnet724Ut31i4ecY4dJ25z8HuZetu3A43xtNkPdk4JdbsfdDDisabledBackend receipt verification is not implemented and upgrade authority is not multisig.

Canonical registry source: deployments/registry/splitter/solana/deployments.json

Historical mainnet evidence

These are historical transactions only. They do not certify the current release, fee model or current production readiness.

ProviderAssetHistorical useTransaction
Exa SearchPOLSDK call via Exa0xeb13c5eddf645b3e5b5e5db82d8b19d301a4c0c8593f6e7dce9cd4c3359c8700
io.netPOLLlama-3.3-70B inference, $0.0250x7c6ca0ffcf75b1ca3ade4800fb896c4bb08bc5f1a91916dc2cf4918f16129f0a

Repository layout

sdk/
├── node/          @aifinpay/agent
├── python/        aifinpay-agent
├── mcp/           @aifinpay/mcp
├── mcp-http/      Streamable HTTP wrapper
├── skill/         pointer only — @aifinpay/skill moved to github.com/AiFinPay/skill
├── gate/          merchant HTTP 402 paywall (Node)
├── python-gate/   aifinpay-gate, merchant HTTP 402 paywall (Python)
├── wallet/        lightweight agent wallet / keystore
├── deployments/   deployment registry
└── examples/      integrations and reference examples

Security rules

  • Never print, log or publish a seed, private key, keystore JSON or signing secret.
  • Public addresses and transaction hashes are safe to display.
  • Do not infer production readiness from a contract address, program ID, quote or invoice alone.
  • Retain the original quote, transaction reference and idempotency context when recovering from a settlement error to avoid accidental duplicate payment attempts.

Links

License

MIT — see LICENSE.