mcp-openpay — Claude Code MCP server
Connects an AI coding agent to Openpay for charges, customers, subscriptions, MXN payouts, and webhooks. Built for the Mexican gateway.
claude mcp add --env OPENPAY_MERCHANT_ID=<OPENPAY_MERCHANT_ID> --env OPENPAY_PRIVATE_KEY=<OPENPAY_PRIVATE_KEY> --env OPENPAY_ENV=<OPENPAY_ENV> --transport stdio openpay -- npx -y @codespar/mcp-openpayWhat mcp-openpay does
mcp-openpay exposes 23 Openpay operations to an agent. It can create, inspect, capture, and refund charges, manage customers and tokenized cards, create plans and subscriptions, send MXN payouts, and handle bank accounts and webhooks. Several operations accept customer_id to use customer-level routing.
The package runs with npx over stdio, with an HTTP mode available for server-to-server testing through MCP_HTTP=true MCP_PORT=3000. Authentication uses HTTP Basic; the server creates the Base64 value from the private key. Set OPENPAY_MERCHANT_ID and OPENPAY_PRIVATE_KEY, then choose sandbox or production with OPENPAY_ENV; sandbox is the default.
Use Openpay.js for client-side card tokenization and send the resulting token to the server. Raw PAN or CVV data on the server requires PCI-DSS compliance.
What it helps with
- create and refund an Openpay charge
- store customers and tokenized cards
- start recurring billing from a plan
- send MXN funds to a bank account
- register and remove webhook endpoints
Example prompts for the agent
- Create an Openpay charge for the order in
orders.jsonand return its ID. - Set up a subscription plan, then subscribe the customer with this
customer_id. - List the Openpay payouts and add a webhook for new payment events.
How to install mcp-openpay
Platform CLI
claude mcp add --env OPENPAY_MERCHANT_ID=<OPENPAY_MERCHANT_ID> --env OPENPAY_PRIVATE_KEY=<OPENPAY_PRIVATE_KEY> --env OPENPAY_ENV=<OPENPAY_ENV> --transport stdio openpay -- npx -y @codespar/mcp-openpayReplace <…> with your own values
Platform CLI
codex mcp add openpay --env OPENPAY_MERCHANT_ID=<OPENPAY_MERCHANT_ID> --env OPENPAY_PRIVATE_KEY=<OPENPAY_PRIVATE_KEY> --env OPENPAY_ENV=<OPENPAY_ENV> -- npx -y @codespar/mcp-openpayReplace <…> with your own values
Config file
{
"mcpServers": {
"openpay": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-openpay"
],
"env": {
"OPENPAY_MERCHANT_ID": "<OPENPAY_MERCHANT_ID>",
"OPENPAY_PRIVATE_KEY": "<OPENPAY_PRIVATE_KEY>",
"OPENPAY_ENV": "<OPENPAY_ENV>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"openpay": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-openpay"
],
"env": {
"OPENPAY_MERCHANT_ID": "<OPENPAY_MERCHANT_ID>",
"OPENPAY_PRIVATE_KEY": "<OPENPAY_PRIVATE_KEY>",
"OPENPAY_ENV": "<OPENPAY_ENV>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e OPENPAY_MERCHANT_ID=<OPENPAY_MERCHANT_ID> -e OPENPAY_PRIVATE_KEY=<OPENPAY_PRIVATE_KEY> -e OPENPAY_ENV=<OPENPAY_ENV> openpay npx -y @codespar/mcp-openpayReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-openpay
How do I install mcp-openpay in Claude Code?
Run claude mcp add mcp-openpay -e OPENPAY_MERCHANT_ID=<OPENPAY_MERCHANT_ID> -e OPENPAY_PRIVATE_KEY=<OPENPAY_PRIVATE_KEY> -- npx -y @codespar/mcp-openpay.
What does mcp-openpay do?
It gives an agent 23 Openpay tools for charges, customers, cards, subscriptions, payouts, bank accounts, and webhooks.
What does mcp-openpay require for card payments?
Configure OPENPAY_MERCHANT_ID and OPENPAY_PRIVATE_KEY. Openpay.js tokenization is preferred; sending raw PAN or CVV data server-side requires PCI-DSS compliance.