15 MCP tools for AI agent integration with AgentGatePay
Model Context Protocol (MCP) provides a standardized way for AI agents (Claude, ChatGPT, custom agents) to interact with AgentGatePay's payment infrastructure.
- Core Payment Flow - 4 tools
- Payment History & Analytics - 2 tools
- Payment Verification - 1 tool
- User Management - 3 tools
- API Key Management - 3 tools
- Audit & Monitoring - 2 tools
Endpoint: POST https://mcp.agentgatepay.com/
This is the primary MCP interface. All 15 tools are available through a single unified endpoint.
curl -X POST https://mcp.agentgatepay.com/ \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "agentpay_issue_mandate",
"arguments": {
"subject": "agent-wallet-address",
"budget_usd": 10.0,
"scope": "research",
"ttl_minutes": 1440
}
}
}'Server: /mcp-server/agentpay-mcp-server.js
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"agentgatepay": {
"command": "node",
"args": ["/path/to/agentpay-mcp-server.js"],
"env": {
"API_KEY": "your-api-key",
"WALLET_PRIVATE_KEY": "your-private-key"
}
}
}
}Issue an AP2 budget mandate for spending control.
Authentication: Recommended (tracks mandate usage)
Arguments:
{
"subject": "agent-wallet-address-or-id",
"budget_usd": 10.0,
"scope": "research,api_access",
"ttl_minutes": 1440
}Parameters:
subject(required): Agent identifier or wallet addressbudget_usd(required): Maximum spending limit in USDscope(required): Comma-separated permissionsttl_minutes(required): Time to live (max: 43200 = 30 days)
Returns:
{
"mandate_id": "mnd_abc123...",
"mandate_token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkFQMi1WREMifQ...",
"subject": "agent-wallet-address",
"budget_usd": "10.00",
"scope": "research",
"issued_at": "2025-12-11T15:30:00Z",
"expires_at": "2025-12-12T15:30:00Z",
"status": "active"
}mandate_token - required for all payments!
Verify mandate validity and check remaining budget.
Authentication: Not required
Arguments:
{
"mandate_token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkFQMi1WREMifQ..."
}Returns:
{
"valid": true,
"mandate_id": "mnd_abc123...",
"subject": "agent-wallet-address",
"budget_usd": "10.00",
"budget_remaining": "9.99",
"scope": "research",
"expires_at": "2025-12-12T15:30:00Z",
"status": "active"
}Create x402 payment requirement (get payment details).
Authentication: Requires mandate token
Arguments:
{
"amount_usd": "0.01",
"resource_path": "/api/premium-content",
"chain": "base",
"token": "USDC"
}Parameters:
amount_usd(required): Payment amount in USDresource_path(optional): Resource identifierchain(optional):ethereum,base,polygon,arbitrum(default:base)token(optional):USDC,USDT,DAI(default:USDC)
Returns:
{
"status": "payment_required",
"price_usd": "0.01",
"receiver_address": "0xReceiverWallet...",
"chain": "base",
"token": "USDC",
"amount_tokens": 10000,
"payment_instructions": "Send 10000 USDC (6 decimals) to receiver address"
}Submit payment and access protected resource.
Authentication: Requires API key + mandate token
Arguments:
{
"tx_hash": "0xYourBlockchainTransactionHash",
"mandate_token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkFQMi1WREMifQ...",
"chain": "base",
"token": "USDC",
"price_usd": "0.01"
}Parameters:
tx_hash(required): Blockchain transaction hashmandate_token(required): AP2 mandate tokenchain(required): Blockchain used for paymenttoken(required): Token used for paymentprice_usd(required): Payment amount
Returns:
{
"status": "success",
"message": "Payment verified successfully",
"resource_data": "Protected content here...",
"charge_id": "chg_abc123...",
"payment_details": {
"tx_hash": "0xYourTransactionHash",
"amount_usd": "0.01",
"paid_at": "2025-12-11T15:32:00Z",
"block_number": 12345678,
"confirmations": 3
},
"mandate_remaining_budget": "9.99"
}Get payment history for authenticated user.
Authentication: Required (API key)
Arguments:
{
"limit": 50,
"offset": 0,
"start_time": 1699564800,
"end_time": 1699651200
}Parameters:
limit(optional): Results per page (default: 20, max: 100)offset(optional): Pagination offsetstart_time(optional): Unix timestampend_time(optional): Unix timestamp
Returns:
{
"total": 42,
"count": 10,
"payments": [
{
"charge_id": "chg_abc123...",
"tx_hash": "0xTransaction...",
"amount_usd": "0.01",
"chain": "base",
"token": "USDC",
"paid_at": "2025-12-11T15:34:50Z",
"direction": "sent"
}
]
}Get spending or revenue analytics for authenticated user.
Authentication: Required (API key)
Arguments:
{
"period": "30d"
}Parameters:
period(optional):24h,7d,30d,all(default:all)
Returns (Agent):
{
"role": "agent",
"total_spent_usd": "5.00",
"total_transactions": 5,
"by_chain": {
"base": "3.00",
"ethereum": "2.00"
},
"by_token": {
"USDC": "4.00",
"USDT": "1.00"
},
"reputation_score": 100
}Returns (Merchant):
{
"role": "merchant",
"total_revenue_usd": "12.50",
"total_transactions": 12,
"by_chain": {
"base": "8.00",
"ethereum": "4.50"
},
"by_token": {
"USDC": "10.00",
"USDT": "2.50"
},
"commission_paid_usd": "0.06",
"reputation_score": 100
}Verify a blockchain payment transaction.
Authentication: Required (API key)
Arguments:
{
"tx_hash": "0xBlockchainTransactionHash"
}Returns:
{
"verified": true,
"payment": {
"tx_hash": "0xTransactionHash",
"amount_usd": "0.01",
"receiver_address": "0xMerchantWallet...",
"payer_address": "0xBuyerWallet...",
"chain": "base",
"token": "USDC",
"paid_at": "2025-12-11T15:34:50Z",
"block_number": 12345678,
"confirmations": 12,
"status": "confirmed"
}
}Create a new user account.
Authentication: Not required
Arguments:
{
"email": "user@example.com",
"password": "SecurePassword123",
"user_type": "agent"
}Parameters:
email(required): Valid email addresspassword(required): Minimum 8 charactersuser_type(required):"agent","merchant", or"both"
Returns:
{
"user_id": "usr_abc123...",
"email": "user@example.com",
"account_type": "agent",
"api_key": "pk_live_GFnXNA4o3Tbboj2Ca03uTwqk...",
"created_at": "2025-12-11T15:30:00Z",
"reputation_score": 100
}api_key - it's only shown once!
Get current user profile information.
Authentication: Required (API key)
Arguments:
{}Returns:
{
"user_id": "usr_abc123...",
"email": "user@example.com",
"account_type": "agent",
"reputation_score": 100,
"created_at": "2025-12-11T15:30:00Z",
"wallets": [
{
"address": "0xYourWallet...",
"label": "Primary Wallet",
"added_at": "2025-12-11T15:31:00Z"
}
]
}Add a blockchain wallet address to your account.
Authentication: Required (API key)
Arguments:
{
"chain": "base",
"address": "0xYourEthereumAddress",
"label": "Primary Wallet"
}Parameters:
chain(required):ethereum,base,polygon,arbitrumaddress(required): Wallet address (0x...)label(optional): Friendly name
Returns:
{
"user_id": "usr_abc123...",
"wallet_address": "0xYourEthereumAddress",
"chain": "base",
"label": "Primary Wallet",
"added_at": "2025-12-11T15:31:00Z"
}Create a new API key for programmatic access.
Authentication: Required (API key)
Arguments:
{
"name": "Production Server",
"permissions": ["read", "write"]
}Parameters:
name(required): Friendly name for the keypermissions(optional): Array of permissions
Returns:
{
"key_id": "key_abc123...",
"api_key": "pk_live_NewGeneratedKey...",
"key_prefix": "pk_live_NewG",
"name": "Production Server",
"created_at": "2025-12-11T15:35:00Z"
}api_key - it's only shown once!
Rate Limit: 10 keys per day per user
List all API keys for your account.
Authentication: Required (API key)
Arguments:
{}Returns:
{
"api_keys": [
{
"key_id": "key_abc123...",
"key_prefix": "pk_live_GFnX",
"name": "Primary Key",
"created_at": "2025-12-11T15:30:00Z",
"last_used": "2025-12-11T16:45:00Z",
"status": "active"
}
],
"count": 1
}Revoke an API key (cannot be undone).
Authentication: Required (API key)
Arguments:
{
"key_id": "key_abc123..."
}Returns:
{
"success": true,
"key_id": "key_abc123...",
"key_prefix": "pk_live_GFnX",
"revoked_at": "2025-12-11T16:50:00Z",
"message": "API key revoked successfully"
}Get audit logs for current user (authentication-scoped).
Authentication: Required (API key)
Arguments:
{
"event_type": "x402_payment_settled",
"limit": 50,
"start_time": 1699564800,
"end_time": 1699651200
}Parameters:
event_type(optional): Filter by event typelimit(optional): Results per page (default: 20, max: 100)start_time(optional): Unix timestampend_time(optional): Unix timestamp
Returns:
{
"logs": [
{
"id": "log_abc123...",
"timestamp": "2025-12-11T15:34:50Z",
"event_type": "x402_payment_settled",
"details": {
"tx_hash": "0xTransaction...",
"amount_usd": "0.01",
"chain": "base"
}
}
],
"count": 10,
"has_more": true
}Event Types:
mandate_issued- Mandate createdmandate_verified- Mandate validationx402_payment_settled- Payment completedreputation_updated- Reputation score changedaif_check_passed- Security check passed
Get system health and component status.
Authentication: Not required
Arguments:
{}Returns:
{
"status": "healthy",
"version": "v1.0.0",
"timestamp": 1702345678,
"components": {
"gateway": "ok",
"payments": "ok",
"aif": "ok",
"mandates": "ok",
"mcp": "ok"
}
}Here's a complete example showing all 4 payment flow tools:
# 1. Issue mandate
curl -X POST https://mcp.agentgatepay.com/ \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "agentpay_issue_mandate",
"arguments": {
"subject": "0xYourWalletAddress",
"budget_usd": 10.0,
"scope": "research",
"ttl_minutes": 1440
}
}
}'
# Save mandate_token from response
# 2. Verify mandate
curl -X POST https://mcp.agentgatepay.com/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "agentpay_verify_mandate",
"arguments": {
"mandate_token": "YOUR_MANDATE_TOKEN"
}
}
}'
# 3. Create payment (get payment details)
curl -X POST https://mcp.agentgatepay.com/ \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "agentpay_create_payment",
"arguments": {
"amount_usd": "0.01",
"chain": "base",
"token": "USDC"
}
}
}'
# 4. Send blockchain transaction (use ethers.js/web3.py)
# ... send USDC to receiver_address from step 3 ...
# 5. Submit payment proof
curl -X POST https://mcp.agentgatepay.com/ \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "agentpay_submit_payment",
"arguments": {
"tx_hash": "0xYourTransactionHash",
"mandate_token": "YOUR_MANDATE_TOKEN",
"chain": "base",
"token": "USDC",
"price_usd": "0.01"
}
}
}'Use the official SDK for easier integration:
pip install agentgatepay-sdkfrom agentgatepay_sdk import AgentGatePayMCPClient
# Initialize client
client = AgentGatePayMCPClient(
api_url="https://mcp.agentgatepay.com/",
api_key="YOUR_API_KEY"
)
# Issue mandate
mandate = client.call_tool("agentpay_issue_mandate", {
"subject": "0xYourWalletAddress",
"budget_usd": 10.0,
"scope": "research",
"ttl_minutes": 1440
})
# Verify mandate
verification = client.call_tool("agentpay_verify_mandate", {
"mandate_token": mandate['mandate_token']
})
# Get analytics
analytics = client.call_tool("agentpay_get_analytics", {
"period": "30d"
})
print(f"Total spent: ${analytics['total_spent_usd']}")All MCP tools return structured error responses:
{
"success": false,
"error": "Mandate token invalid or expired",
"code": "INVALID_MANDATE",
"timestamp": 1702345678
}Always check success field before proceeding:
result = client.call_tool("agentpay_issue_mandate", {...})
if not result.get('success', True):
print(f"Error: {result['error']}")
return
# Proceed with mandate_token
mandate_token = result['mandate_token']Common Errors:
INVALID_MANDATE- Mandate expired or invalidINSUFFICIENT_BUDGET- Mandate budget too lowNONCE_ALREADY_USED- Replay attack blocked (tx_hash submitted twice)PAYMENT_VERIFICATION_FAILED- Blockchain transaction invalidRATE_LIMIT_EXCEEDED- Too many requests
Rate limits are enforced per-endpoint to prevent abuse:
| Endpoint | Rate Limit |
|---|---|
/mandates/issue |
20 req/min |
/mandates/verify |
100 req/min |
/x402/resource |
60 req/min |
| Other endpoints | 60 req/min |
MCP tools count toward endpoint rate limits.
- Documentation: docs/
- GitHub Issues: Report bugs
- Email: support@agentgatepay.com
- Examples: Example Code
- SDKs: Official SDKs
Last Updated: December 2025 MCP Version: 1.0 Tools: 15 (100% REST API parity)