Your AI agent can browse the web, write code, and manage files. The one thing it still cannot do — without some setup — is pay for things. The safest way to give an AI agent payment access is with a virtual card for AI agents: a virtual debit card with a fixed spending limit that the agent can use via MCP, without ever touching your real credit card. This tutorial walks you through every step.
The result: a virtual debit card, issued in under 10 seconds, accessible to your agent through four MCP tools, with a spending limit you set. The entire setup takes under 10 minutes.
For a deeper explanation of the architecture behind this — why virtual debit cards, why MCP, and how the security model works — see How AI Agents Make Payments: A Complete Guide.
Prerequisites
- Node.js 18 or higher installed
- Claude Desktop or Cursor (either works; instructions for both are included)
- A credit or debit card to fund your AgentCard account
Step 1: Install the AgentCard CLI
The agent-cards CLI is published to npm. Install it globally so it is available from any directory and so the MCP server process can be launched by your AI client:
npm install -g agent-cards
Verify the installation:
$ agent-cards --version
agent-cards/1.4.2 darwin-arm64 node-v22.9.0
If you see a version number, you are good to proceed. If the command is not found, ensure your npm global bin directory is in your PATH. You can find the path with npm bin -g.
Step 2: Sign Up and Authenticate
AgentCard uses passwordless authentication via magic links. Run the signup command:
$ agent-cards signup
Enter your email address: you@example.com
✓ Magic link sent to you@example.com
Check your inbox and click the link to continue.
Waiting for confirmation...
✓ Account created and authenticated
Logged in as you@example.com
Click the link in the email. The CLI polls for confirmation and completes authentication automatically. Your API key is saved to ~/.config/agent-cards/config.json.
If you already have an account, use agent-cards login instead of agent-cards signup. The flow is identical.
Step 3: Issue a Virtual Debit Card
Issue a card with the amount you want to make available to your agent. Running the command opens a browser to complete the payment, then issues the card immediately:
$ agent-cards cards create --amount 25
✓ Card issued in 7 seconds
Card ID: card_xyz789
Last 4: 4421
Expires: 03/2027
Amount: $25.00
Status: active
The card is a virtual debit card issued through the Mastercard debit card program. It works immediately for card-not-present (online) transactions at any Mastercard-accepting merchant.
$ agent-cards cards create --amount 25
✓ Card issued in 6 seconds
Card ID: card_xyz789
Last 4: 4421
Expires: 03/2027
Amount: $25.00
Status: active
Step 5: Configure MCP
The MCP server is what connects your AI agent to your cards. When your agent needs to look up a card, check a balance, or log a payment, it calls the MCP tools rather than having credentials hardcoded anywhere.
Run this single command to register the AgentCard MCP server with your AI client (Claude Desktop, Claude Code, Cursor, or any MCP-compatible client):
claude mcp add --transport http agent-cards https://mcp.agentcard.sh/mcp \
--header "Authorization: Bearer <your-token>"
Replace <your-token> with your AgentCard API token (found in ~/.config/agent-cards/config.json after login). The MCP server is now available to your agent immediately.
Step 6: Verify Everything Works
First, confirm your card is active from the CLI:
$ agent-cards cards list
ID LABEL LAST4 BALANCE STATUS
card_xyz789 claude-research-march 4421 $25.00 active
Then, in Claude Desktop or Cursor, open a new conversation and ask:
"What AgentCard do I have available? Call the list_cards tool to find out."
If the MCP server is connected, the agent will call list_cards and return your card details. You will see the tool call appear in Claude's interface before the response. A successful response looks like:
I called list_cards and found one active card:
- Card ID: card_xyz789
- Last 4 digits: 4421
- Balance: $25.00
- Status: active
If the agent says it does not have access to payment tools, double-check that the MCP server was added correctly by running claude mcp list.
What Your Agent Can Now Do
With the MCP server connected, your agent has access to four tools:
list_cards
Returns all cards in your account with their IDs, last four digits, balances, and statuses. The agent uses this to discover what payment options are available before attempting a purchase.
get_card_details
Returns full card details for a given card ID, including the PAN, CVV, and expiration date. The agent calls this when it has selected a card and needs the credentials to fill in a payment form.
check_balance
Returns the current balance for a specific card. The agent should call this before committing to a purchase to confirm sufficient funds exist, preventing a declined authorization.
Example: Asking an Agent to Make a Purchase
With setup complete, try an end-to-end test. Give Claude a task that requires a payment:
"I need you to subscribe to the Starter plan on nominalprice.io — it should be $9. Use an Agent Card. Check the balance first and record the payment after."
A capable agent will work through the flow: check available cards, verify balance, retrieve card details, complete checkout, and record the payment. You can watch each MCP tool call appear in the tool use panel.
Managing Cards Going Forward
A few commands you will use regularly:
# See all cards and balances
agent-cards cards list
# Show full details for a specific card (including PAN)
agent-cards cards details card_xyz789
# Issue a new card for a new task
agent-cards cards create --amount 10
# Check balance for a specific card
agent-cards balance card_xyz789
Next Steps
You now have a fully working payment layer for your AI agent. A few directions from here:
- Read the Claude MCP + Payments integration guide for advanced MCP configuration, including the HTTP transport option for remote agents and custom integrations.
- Learn how to compare the AgentCard API with other virtual card approaches in Virtual Card APIs Compared.
- If you are building multi-agent systems, revisit the complete payments guide for patterns around per-task card issuance and budget-gated agents.
- Learn how to give your AI agent a budget without sharing your credit card, including per-task and per-session budget patterns.