mcp-pagar-me — Claude Code MCP server: what it does, how to install
Connects AI agents to the Pagar.me payment platform to issue Pix charges, handle split payouts, and manage billing.
claude mcp add --env PAGARME_API_KEY=<PAGARME_API_KEY> --env PAGARME_PUBLIC_KEY=<PAGARME_PUBLIC_KEY> --transport stdio pagar-me -- npx -y @codespar/mcp-pagar-meWhat mcp-pagar-me does
This server links your workspace with the Stone-owned Pagar.me gateway. It provides 22 callable tools. An assistant can generate orders, check account balances, or trigger transactions via Pix or credit cards. Two-step charge capture and refund flows work out of the box.
Beyond single transactions, the tooling covers multi-party split payouts. You can configure recipients and schedule direct bank withdrawals. Subscription billing is supported alongside automated webhook registration.
You need PAGARME_API_KEY in your environment to authenticate calls. Tokenizing card details via create_card_token fails unless you also define PAGARME_PUBLIC_KEY. You can test safe workflows first by supplying sandbox test credentials from your Pagar.me account.
What it helps with
- Generate customer charges using Pix or bank cards
- Configure split payouts and direct transfers to recipient accounts
- Execute complete or partial refunds on existing transactions
- Set up recurring subscription plans and customer enrollments
Example prompts for the agent
- Create a new Pix charge for 150 BRL
- Check the current balance and retrieve anticipation limits for this recipient
- Issue a partial refund for charge ID
ch_12345
How to install mcp-pagar-me
Platform CLI
claude mcp add --env PAGARME_API_KEY=<PAGARME_API_KEY> --env PAGARME_PUBLIC_KEY=<PAGARME_PUBLIC_KEY> --transport stdio pagar-me -- npx -y @codespar/mcp-pagar-meReplace <…> with your own values
Platform CLI
codex mcp add pagar-me --env PAGARME_API_KEY=<PAGARME_API_KEY> --env PAGARME_PUBLIC_KEY=<PAGARME_PUBLIC_KEY> -- npx -y @codespar/mcp-pagar-meReplace <…> with your own values
Config file
{
"mcpServers": {
"pagar-me": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-pagar-me"
],
"env": {
"PAGARME_API_KEY": "<PAGARME_API_KEY>",
"PAGARME_PUBLIC_KEY": "<PAGARME_PUBLIC_KEY>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"pagar-me": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-pagar-me"
],
"env": {
"PAGARME_API_KEY": "<PAGARME_API_KEY>",
"PAGARME_PUBLIC_KEY": "<PAGARME_PUBLIC_KEY>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e PAGARME_API_KEY=<PAGARME_API_KEY> -e PAGARME_PUBLIC_KEY=<PAGARME_PUBLIC_KEY> pagar-me npx -y @codespar/mcp-pagar-meReplace <…> 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-pagar-me
How to install mcp-pagar-me in Claude Code?
Run claude mcp add mcp-pagar-me -e PAGARME_API_KEY=<PAGARME_API_KEY> -- npx -y @codespar/mcp-pagar-me in your terminal.
What does mcp-pagar-me do?
It supplies 22 tools to interact with Pagar.me, letting models process charges, manage recipients, split payments, and control subscriptions.
When is PAGARME_PUBLIC_KEY necessary?
You only need the public key when calling create_card_token for card tokenization. All other endpoints run strictly on PAGARME_API_KEY.