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.
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.
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
npm install @stripe/mcp-mpp-adapterStep 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:
{
"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.
| Variable | Description |
|---|---|
MPP_MAX_PER_TOOL_CALL_USD | Hard cap per individual tool call (e.g., "0.10" = 10 cents max per call) |
MPP_MAX_SESSION_SPEND_USD | Total spend limit for a single chat session |
MPP_REQUIRE_CONFIRMATION_ABOVE_USD | If 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 yourSTRIPE_MACHINE_WALLET_SECRET. - ▸
Insufficient Funds: The agent has exhausted the budget allocated to itsSTRIPE_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:
codex mcp add --name stripe --command "npx -y @modelcontextprotocol/server-stripe" --env STRIPE_SECRET_KEY=sk_your_keyNote: 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
How to Set Up the Brave Search MCP Server for Web Research
Enable your AI agent to search the web using Brave Search API through MCP. Perfect for research, fact-checking, and gathering real-time information.
APIsHow to Accept Stripe's Machine Payments Protocol (MPP) in Your MCP Server
Monetize your MCP server by accepting per-tool-call payments using Stripe's Machine Payments Protocol. This guide covers pricing schemas, payment verification, and webhook handling.
APIsHow to Use the Fetch MCP Server for API Integration
Enable your AI agent to fetch content from any URL or API endpoint. Perfect for reading documentation, consuming REST APIs, and gathering web content.