# mcp-openpay

Connects an AI coding agent to Openpay for charges, customers, subscriptions, MXN payouts, and webhooks. Built for the Mexican gateway.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 274
- Author: codespar
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codespar/mcp-dev-latam/tree/HEAD/packages/payments/openpay
- Updated: 2026-09-27
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-openpay

## What it 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.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `OPENPAY_MERCHANT_ID`, `OPENPAY_PRIVATE_KEY`, `OPENPAY_ENV` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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-openpay
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
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-openpay
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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

### Gemini CLI

**Platform CLI**
```bash
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-openpay
```
Replace <…> with your own values

## When to use it
- 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
- Create an Openpay charge for the order in `orders.json` and 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.

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [OpenWork MCP Gateway](https://affpapa.org/en/nevibecode/mcp/openwork-mcp-gateway.md) — MCP server · ★ 24242
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [basebalance.cloud — x402 RPC & MCP gateway](https://affpapa.org/en/nevibecode/mcp/basebalancecloud-x402-rpc-mcp-gateway.md) — MCP server · ★ 7506

From the same set: [codespar/mcp-dev-latam](https://affpapa.org/en/nevibecode/by/codespar/mcp-dev-latam.md) — 124 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
