MCP + Payments: How AI Agents Access Tools and Pay

MCP standardizes how AI agents find and use tools. But what happens when a tool costs money? Here's how MCP and payment protocols work together.

Kasra Zunnaiyyer
· 7 min read

TL;DR

  • MCP (Model Context Protocol) gives AI agents a universal way to discover and use tools. It’s supported by Claude, GPT, Gemini, Cursor, and more. The standard is real and growing fast.
  • Most MCP tools are free. The interesting question — and the one nobody has a great answer for yet — is what happens when a tool costs money.
  • Two models are emerging: server-side pricing (the tool declares a price via x402, and the agent pays during the request) and agent-side wallets (the agent carries payment capability as a tool and can pay for anything).
  • This post walks through both approaches with real code, explains where they fit, and shows how Botwallet’s MCP server bridges the gap.

The Tool Problem MCP Solved

Before MCP, every AI agent framework had its own way of connecting to external tools. LangChain had tool classes. OpenAI had function calling. Anthropic had tool use. Each with its own schema, its own registration flow, its own quirks.

An API provider that wanted to make their service available to AI agents had to build separate integrations for each framework. A developer building an agent had to write custom wrappers for every tool.

MCP fixed this by standardizing the interface. An MCP server exposes tools (functions the agent can call), resources (data the agent can read), and prompts (templated workflows). Any MCP-compatible client — Claude, GPT, Gemini, Cursor, Windsurf — can connect to any MCP server and discover what’s available.

Anthropic created MCP in November 2024 and donated it to the Linux Foundation in December 2025. As of early 2026, it’s the de facto standard for agent tools. The agent tool problem is solved.

The payment problem isn’t.

When Tools Cost Money

Most MCP tools today are free. They read from databases, call public APIs, or perform local computations. The MCP server is a thin wrapper that’s either self-hosted or runs locally.

But some tools are genuinely expensive to operate. A tool that queries a premium data source, runs GPU inference, generates images, or accesses proprietary research costs the provider real money per call. The provider needs to get paid.

Today, this is handled outside MCP entirely. The developer signs up for the data source, gets an API key, and hardcodes it into the MCP server’s environment. The agent calls the tool, the server uses the key, the developer gets a monthly bill.

This works. It also inherits every problem of the shared API key model:

  • The agent doesn’t know what anything costs
  • The developer can’t set per-agent spending limits
  • There’s no way for the agent to comparison-shop
  • Adding a new paid data source requires a human to sign up and provision a key

The question MCP doesn’t answer yet: how does an agent pay for a tool at the moment it needs one, without a human pre-provisioning credentials?

Approach 1: Server-Side Pricing With x402

Vercel shipped x402-mcp to address this from the server side. The idea: MCP servers should be able to declare which tools are paid and what they cost, right in the tool definition.

A developer building an MCP server with paid tools defines them like this:

server.paidTool(
  "premium_data_lookup",
  { price: 0.01 },
  { query: z.string(), region: z.string() },
  async (args) => {
    const data = await queryPremiumSource(args.query, args.region);
    return { content: [{ type: "text", text: JSON.stringify(data) }] };
  }
);

When an agent calls this tool, the transport layer handles the payment flow:

  1. Agent sends the tool call request over HTTP
  2. Server responds with HTTP 402 and the price ($0.01 USDC)
  3. Agent’s wallet signs a payment on-chain
  4. Agent retries with payment proof in the PAYMENT-SIGNATURE header
  5. Server verifies, executes the tool, and returns the result

Free and paid tools coexist on the same server. The agent discovers both when it connects. No accounts, no API keys — just a price tag and a wallet.

This model is clean when the server wants to monetize its own tools. The server sets the price, handles verification, and gets paid directly. Cloudflare has a similar integration for Workers-based MCP servers.

The limitation: the agent needs to already have x402 payment capability built into its transport layer. Not all MCP clients do.

Approach 2: Agent-Side Wallet via MCP

The other approach works from the agent’s side. Instead of embedding payment into the MCP transport, you give the agent a wallet as an MCP tool.

This is what Botwallet’s MCP server does. It exposes 36 tools across 8 groups — wallet management, payments, earning, x402 API access, withdrawals, funding, guard rails, and history. When an agent connects to the Botwallet MCP server, it gains the ability to:

  • Check its balance
  • Pay anyone (another agent, a merchant, a Solana address)
  • Discover and pay for x402-enabled APIs
  • Create invoices and earn money
  • Check its spending limits before acting

The setup is one JSON block in the agent’s MCP config:

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

Now the agent has a wallet. It can pay for anything — x402-enabled MCP tools, standalone paid APIs, or services from other agents. The payment capability travels with the agent, not the server.

A Concrete Example

Here’s what it looks like when an agent using MCP encounters a paid API and handles it end-to-end:

Step 1: The agent needs premium weather data. Its planning layer decides to query a forecast API.

Step 2: The agent discovers x402 APIs via its Botwallet MCP tools.

Tool call: botwallet_x402_discover
Arguments: { "query": "weather forecast" }

The tool returns a list of x402-enabled weather APIs with endpoints and prices.

Step 3: The agent probes the cheapest option.

Tool call: botwallet_x402_fetch
Arguments: { "url": "https://api.weather-data.com/forecast/NYC" }

If the API is free, data comes back immediately. If it requires payment, the agent sees the price ($0.03 USDC) and a fetch_id. No money moves yet.

Step 4: The agent checks its budget.

Tool call: botwallet_my_limits

Returns the per-transaction threshold, remaining daily budget, and hard cap. The agent confirms $0.03 is within its auto-approve range.

Step 5: The agent pays and gets the data.

Tool call: botwallet_x402_pay_and_fetch
Arguments: { "fetch_id": "txn_8f2a..." }

FROST 2-of-2 signing happens behind the scenes. The agent gets its weather data. Total elapsed time: under two seconds.

The entire flow — discover, probe, check budget, pay, receive — happened through MCP tool calls. The agent never left its standard tool-use interface.

Tip

The botwallet_x402_fetch probe step is free. Encourage agents to probe multiple providers before committing. Price comparison is built into the workflow.

Where Each Approach Fits

ScenarioBest Approach
MCP server wants to monetize its own toolsServer-side x402 (paidTool pattern)
Agent needs to pay for arbitrary APIs at runtimeAgent-side wallet (Botwallet MCP)
Agent talks to both free and paid MCP serversAgent-side wallet (payment capability travels with the agent)
Simple tool with fixed per-call pricingServer-side x402 (cleanest for the provider)
Agent needs guard rails and spending limitsAgent-side wallet (owner controls via Human Portal)

In practice, most agents that handle money will use both. The server-side approach handles direct MCP tool payments. The agent-side wallet handles everything else — paying invoices, sending money to other agents, accessing non-MCP APIs, and operating under guard rails.

The Two-Layer Stack

Think of it as two layers that compose:

MCP layer — standardizes tool discovery, schema, and invocation. The agent finds tools and calls them. This is the “what can I do?” layer.

Payment layer — handles the money. Whether through x402 embedded in the transport (server-side) or through wallet tools (agent-side), this is the “how do I pay for it?” layer.

MCP without payment means agents can only use free tools, or tools where a human pre-provisioned access. Payment without MCP means agents can spend money but have no standard way to discover what’s available.

Together, they form the complete stack: discover tools, evaluate prices, pay, and get results. All programmatic. All within the agent’s existing workflow.

Note

Botwallet’s MCP server works alongside other MCP servers, not instead of them. An agent can connect to a database MCP server, a code execution MCP server, and the Botwallet MCP server simultaneously. Each provides different capabilities. Botwallet provides the financial ones.

Getting Started

If your agent already uses MCP, adding payment capability takes about two minutes:

1. Install the Botwallet CLI and register a wallet:

npm install -g @botwallet/agent-cli
botwallet register --name "My Agent" --owner you@company.com

2. Add Botwallet to your agent’s MCP config:

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

3. Set guard rails in the Human Portal.

Your agent now has 36 financial tools — balance checks, payments, invoicing, x402 API access, and more. It can pay for tools from other MCP servers, access paid APIs, and earn money from its own services. All under your spending controls.

The full setup walkthrough is in the agent setup guide.


MCP gave agents a universal interface for tools. Payment protocols gave agents the ability to spend money. Together, they form two of the three layers in the emerging agent economy — with trust and reputation as the third. The two layers were built independently but they fit together naturally — and the agents that combine both will access a much larger set of tools than the agents that don’t.

The toolbox is open. The wallet is connected. What your agent does next is up to you.

Frequently Asked Questions

What is MCP and why does it matter for AI agents?
MCP (Model Context Protocol) is an open standard that defines how AI agents discover and use external tools. Think of it as a USB-C port for AI — any agent can connect to any MCP server and use its tools. Anthropic created it; it's now hosted by the Linux Foundation and supported by Claude, GPT, Gemini, and Cursor.
How do AI agents pay for MCP tools?
Two approaches exist. Server-side: MCP servers use x402 to declare tool prices and handle payment during HTTP requests. Agent-side: agents carry their own wallet (like Botwallet) with payment tools exposed via MCP, letting them pay for any API they encounter — MCP-based or not.
What is x402-mcp?
x402-mcp is a Vercel-built integration that lets MCP server developers mark individual tools as paid. When an agent calls a paid tool, the server responds with HTTP 402, the agent's wallet signs a USDC payment, and the tool executes. Free and paid tools can coexist on the same server.
Does Botwallet work as an MCP server?
Yes. The Botwallet MCP server exposes 36 tools across wallet management, payments, earning, x402 API access, and more. Any MCP-compatible agent can use it to check balances, send payments, create invoices, and access paid APIs — all through standard MCP tool calls.
Share

More from the blog