APIs·
intermediate
·14 min read·Apr 4, 2026

How to Use Stripe's Machine Payments Protocol (MPP) as an MCP Client

Learn how to configure your AI agent as an MCP client that can automatically pay per tool usage using Stripe's Machine Payments Protocol — enabling access to premium, monetized MCP servers.

StripeMPPMachine Payments ProtocolpaymentsMCP clientAI agentsmonetizationarchitecture

Using Stripe's Machine Payments Protocol as an MCP Client

Stripe's Machine Payments Protocol (MPP) enables AI agents to autonomously pay for tool usage on monetized MCP servers. Instead of a human manually authorizing each API call with a credit card, your agent holds an isolated "Machine Wallet" payment budget and settles micro-payments securely per tool call.

Prerequisites

  • A Stripe account with developer access.
  • Funds added to your Stripe account balance to fund the Machine Wallet.
  • An MCP client framework that supports custom server adapters.

Step 1: Create a Machine Wallet

A machine wallet is a new Stripe primitive that represents an AI agent's payment identity and strict spending budget.

bash
curl https://api.stripe.com/v1/machine_wallets \
  -u sk_live_your_secret_key: \
  -d "display_name=My Code Assistant Agent" \
  -d "budget[amount]=10000" \
  -d "budget[currency]=usd" \
  -d "budget[period]=monthly"

Step 2: Install the MPP MCP Client Adapter

bash
npm install @stripe/mcp-mpp-adapter

Step 3: Configuration Setup

You must map the specific paid server (e.g., a proprietary legal database MCP server) through the Stripe MPP adapter. Add the MPP credentials to your Claude Desktop or custom agent config:

json
{
  "mcpServers": {
    "premium-legal-database": {
      "command": "npx",
      "args": ["-y", "@stripe/mcp-mpp-adapter"],
      "env": {
        "UPSTREAM_MCP_SERVER": "https://api.legal-mcp-server.com/mcp",
        "STRIPE_MACHINE_WALLET_ID": "mw_live_abc123",
        "STRIPE_MACHINE_WALLET_SECRET": "mws_live_xyz789",
        "MPP_MAX_PER_TOOL_CALL_USD": "0.50",
        "MPP_REQUIRE_CONFIRMATION_ABOVE_USD": "1.00"
      }
    }
  }
}

Step 4: Spending Controls & Best Practices

You can and should fine-tune your AI's spending behavior using environment variables. AI agents can get stuck in loops; without limits, a stuck agent could drain your wallet in minutes.

VariableDescription
MPP_MAX_PER_TOOL_CALL_USDHard cap per individual tool call (e.g., "0.10" = 10 cents max per call)
MPP_MAX_SESSION_SPEND_USDTotal spend limit for a single chat session
MPP_REQUIRE_CONFIRMATION_ABOVE_USDIf the MCP server asks for more than this, the adapter suspends execution and prompts the human user to confirm.

Troubleshooting

  • 402 Payment Required: The upstream MCP server rejected the tool call because the MPP payment header was missing or invalid. Verify your STRIPE_MACHINE_WALLET_SECRET.
  • Insufficient Funds: The agent has exhausted the budget allocated to its STRIPE_MACHINE_WALLET_ID. You must use the Stripe API or Dashboard to top up the machine wallet.
  • Agent Hallucinating Tool Costs: Sometimes agents try to negotiate pricing with the MCP server via JSON-RPC. Ensure your agent system prompt explicitly states that it does not negotiate prices; the MPP adapter handles the transaction layer.

Using with OpenAI Codex

You can use this MCP server with the OpenAI Codex CLI by adding it to your configuration:

bash
codex mcp add --name stripe --command "npx -y @modelcontextprotocol/server-stripe" --env STRIPE_SECRET_KEY=sk_your_key

Note: This configures the Stripe MCP server, which your Codex agent can then use as a client.

For a full list of recommended servers, see Best MCP Servers for OpenAI Codex.

Related Guides