@autopayprotocol/mcp
v0.1.2
Published
MCP server for AutoPay Protocol — lets AI agents manage crypto subscriptions via tool calls
Downloads
32
Readme
@autopayprotocol/mcp
Model Context Protocol server that gives AI agents (Claude, Cursor, Windsurf) the ability to manage USDC subscriptions on AutoPay Protocol. Zero-code integration — just add to your MCP config.
Install
npm install -g @autopayprotocol/mcpSetup
Add to your MCP configuration file:
Claude Code (~/.claude/settings.json)
{
"mcpServers": {
"autopay": {
"command": "npx",
"args": ["-y", "@autopayprotocol/mcp"],
"env": {
"AUTOPAY_PRIVATE_KEY": "0x...",
"AUTOPAY_CHAIN": "base"
}
}
}
}Cursor (.cursor/mcp.json)
{
"mcpServers": {
"autopay": {
"command": "npx",
"args": ["-y", "@autopayprotocol/mcp"],
"env": {
"AUTOPAY_PRIVATE_KEY": "0x...",
"AUTOPAY_CHAIN": "base"
}
}
}
}Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| AUTOPAY_PRIVATE_KEY | Yes | Agent wallet private key (0x...) |
| AUTOPAY_CHAIN | No | Chain to use: base (default), flowEvm, baseSepolia |
| AUTOPAY_RPC_URL | No | Override the default public RPC URL |
Aliases: AGENT_PRIVATE_KEY (for AUTOPAY_PRIVATE_KEY), CHAIN (for AUTOPAY_CHAIN).
Tools
| Tool | Description |
|------|-------------|
| autopay_balance | Check wallet USDC and gas token balance |
| autopay_subscribe | Create an on-chain subscription (first payment immediate) |
| autopay_unsubscribe | Cancel a subscription by revoking the policy |
| autopay_get_policy | Read on-chain policy details (status, amount, cap, etc.) |
| autopay_fetch | Fetch a URL with auto-subscription on HTTP 402 |
| autopay_approve_usdc | Pre-approve USDC spending to PolicyManager |
| autopay_bridge_usdc | Bridge USDC from another chain via LiFi |
| autopay_swap_native_to_usdc | Swap native tokens (ETH, FLOW) to USDC |
Tool Details
autopay_subscribe
| Input | Type | Description |
|-------|------|-------------|
| merchant | string | Merchant EVM address |
| amount | number | USDC per billing cycle |
| interval | string \| number | Preset (monthly, weekly, etc.) or seconds |
| spendingCap? | number | Max total spend. Default: amount * 30 |
| metadataUrl? | string | Optional plan metadata URL |
autopay_fetch
| Input | Type | Description |
|-------|------|-------------|
| url | string | URL to fetch |
| method? | string | HTTP method (GET, POST, etc.) |
| headers? | object | Request headers |
| body? | string | Request body |
If the server returns HTTP 402 with an AutoPay discovery body, the tool automatically subscribes and retries with authentication.
autopay_bridge_usdc
| Input | Type | Description |
|-------|------|-------------|
| fromChainId | number | Source chain ID |
| amount | number | USDC amount to bridge |
| sourceRpcUrl | string | RPC URL for the source chain |
| slippage? | number | Slippage tolerance in %. Default: 0.5 |
Supported source chains: Ethereum (1), Optimism (10), Polygon (137), Arbitrum (42161), Avalanche (43114), BSC (56), Base (8453), Flow EVM (747).
How It Works
- Agent starts the MCP server with a funded wallet
- When the agent encounters a paid API, it uses
autopay_fetchorautopay_subscribe - The server creates an on-chain subscription policy (first charge immediate)
- Subsequent requests reuse cached subscriptions automatically
- The agent can check status with
autopay_get_policyand cancel withautopay_unsubscribe
