Safrapay

Finance and commerce

MCP server for Safrapay, Banco Safra acquirer: credit, Pix, boleto + split, 3DS, chargebacks.

Your AI app calls the Safrapay MCP server, which does the finance and commerce work and sends the result back to the chat.

About Safrapay

Safrapay is a community MCP server from codespar, filed in our directory under finance and commerce. MCP server for Safrapay, Banco Safra acquirer: credit, Pix, boleto + split, 3DS, chargebacks.

Safrapay runs on your own machine: your AI app starts it with the command npx -y @codespar/mcp-safrapay@0.2.0-alpha.3 and talks to it over standard input and output. It needs SAFRAPAY_CLIENT_ID, SAFRAPAY_CLIENT_SECRET and SAFRAPAY_MERCHANT_ID set before Safrapay starts.

Safrapay is listed in the official MCP registry as io.github.codespar/mcp-safrapay, version 0.2.0-alpha.3.

At a glance

Publisher
codespar (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @codespar/mcp-safrapay
Written in
TypeScript
License
MIT
GitHub stars
278
Official MCP registry
io.github.codespar/mcp-safrapay

How to set up Safrapay

  1. Install Node.js on the machine that runs your AI app, because Safrapay starts with npx and downloads its package on first run.
  2. Create SAFRAPAY_CLIENT_ID, SAFRAPAY_CLIENT_SECRET and SAFRAPAY_MERCHANT_ID for Safrapay in the connected service's own settings, scoped to the smallest permissions the job needs.
  3. Add Safrapay to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Safrapay tools to confirm the connection.
  5. Run one read-only task with Safrapay first, and keep your app asking before each tool call until the results look right.

Safrapay compared with similar servers

  • Santander by codespar has fewer GitHub stars than Safrapay (278 against 278); both are community servers, and both run locally.
  • Rinne by codespar has fewer GitHub stars than Safrapay (278 against 278); both are community servers, and both run locally.
  • Shopee by codespar has fewer GitHub stars than Safrapay (278 against 278); both are community servers, and both run locally.

Before you connect Safrapay

  • Give Safrapay its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Safrapay tool call until you trust what it does with them.
  • Treat text that Safrapay fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Safrapay on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Safrapay

How marketing and sales teams put Safrapay to work, by company size. Pick the size closest to yours and start Safrapay on one use case.

Small business

  • A small business can ask Safrapay which products and customers drive margin, then plan promotions around them.
  • Owners can use Safrapay to check refunds, failed payments and churn reasons without opening three dashboards.
  • Safrapay runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Ecommerce teams can connect Safrapay to tie campaigns to orders and revenue, not just clicks.
  • Marketing and finance can use Safrapay to check spend against budget each week and move money to what's working.
  • Start Safrapay on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should keep Safrapay read-only for agents, with any money movement handled by people and existing approvals.
  • Large commerce teams can use Safrapay to answer revenue questions by channel and region with figures finance signs off on.
  • Safrapay is a community server, so have security review the code and pin a version before Safrapay touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Safrapay README

From codespar/mcp-dev-latam on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

@codespar/mcp-safrapay

MCP server for Safrapay, Banco Safra's acquirer. B2B-banking crossover focused on mid-to-large BR merchants and private-banking clientele.

Safrapay's API surface is operated on Aditum's payment platform (documented at safrapay-docs.aditum.com.br). The gateway, portal, reconciliation, and webhook products are split across separate base hosts.

Status: 0.1.0-alpha.1. The endpoint paths here were derived from the Aditum-hosted Safrapay developer docs (publicly reachable). Auth flow (BCRYPT + CNPJ on gateway, JWT Bearer thereafter) is best-effort: the BCRYPT hash input format is not fully specified in public docs and very likely requires a sandbox account to finalize. Treat all tools as scaffolding until validated against a live sandbox merchant.

Tools (22)

Tool Purpose
authorize_payment Authorize a credit-card payment on Safrapay.
capture_payment Capture a previously authorized (pre-auth) payment.
cancel_payment Cancel (void) an authorized-but-uncaptured payment.
refund_payment Refund a captured payment.
create_pix Create a Pix charge.
create_boleto Create a boleto charge.
get_payment Retrieve a charge by Safrapay chargeId.
tokenize_card Tokenize a card for PCI-safe reuse.
create_split_rule Configure split distribution for an existing charge.
get_statement Retrieve the digital statement (extrato).
list_transactions List charges with optional filters.
delete_card_token Revoke a stored card token.
search_by_merchant_order Look up charges by the merchant-side order identifier (the order_id supplied at creation).
query_chargeback Retrieve chargeback (contestacao) detail for a charge: reason code, acquirer deadline, dispute amount, evid...
query_installments Simulate an installment plan for a given amount.
authenticate_3ds Kick off 3-D Secure authentication before authorize_payment.
create_recurrence Create a recurring-billing subscription.
get_recurrence Retrieve a recurrence by id: schedule, next-charge date, charge history, status.
cancel_recurrence Cancel an active recurrence.
get_settlement_report Retrieve a settlement (liquidacao) report from the reconciliation host.
create_payment_link Create a hosted-checkout payment link.
register_webhook Bulk-register webhook subscriptions on the Safrapay webhook product.

Install

npm install @codespar/mcp-safrapay@alpha

Environment

SAFRAPAY_CLIENT_ID="..."      # Merchant CNPJ (sent as merchantCredential)
SAFRAPAY_CLIENT_SECRET="..."  # MerchantToken (used to compute BCRYPT)
SAFRAPAY_MERCHANT_ID="..."    # Safrapay merchant id (body field where required)
SAFRAPAY_ENV="sandbox"        # 'sandbox' (default) or 'production'

Base URLs

Safrapay splits its API into four products hosted on distinct domains:

Product Sandbox Production
Gateway (payments) https://payment-dev.aditum.com.br https://payment.aditum.com.br
Portal (management) https://portal-dev.aditum.com.br https://portal-api.aditum.com.br
Reconciliation https://reconciliation-dev.aditum.com.br https://reconciliation-api.aditum.com.br
Webhook https://webhook-dev.aditum.com.br https://webhook.aditum.com.br

Authentication

Gateway uses a two-step bootstrap:

  1. POST {gateway}/v2/merchant/auth with headers Authorization: <BCRYPT(CNPJ+MerchantToken)> and merchantCredential: <CNPJ> to exchange for a JWT access token.
  2. Subsequent calls send Authorization: Bearer <jwt>.

The server caches the JWT in memory until 60 s before expiry. The BCRYPT input concatenation is an informed guess; refine once you have a sandbox account.

Run

# stdio (default)
npx @codespar/mcp-safrapay

# HTTP
MCP_HTTP=true MCP_PORT=3000 npx @codespar/mcp-safrapay

Endpoint map (used by tools)

Tool Method Path (under gateway, unless noted)
authorize_payment POST /v2/charge/authorization or /v2/charge/preauthorization
capture_payment PUT /v2/charge/capture/{chargeId}
cancel_payment PUT /v2/charge/cancelation/{chargeId}
refund_payment PUT /v2/charge/cancelation/{chargeId} (partial amount)
create_pix POST /v2/charge/pix
create_boleto POST /v2/charge/boleto
get_payment GET /v2/charge/{chargeId}
tokenize_card POST /v2/card (or /v2/temporary/card)
create_split_rule PUT /v2/charge/split/{chargeId}
get_statement GET /v2/Account/Movement/Extract
list_transactions GET /v2/charges
register_webhook POST {webhook}/v1/webhook/bulk

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Questions about Safrapay

What is the Safrapay MCP server?

MCP server for Safrapay, Banco Safra acquirer: credit, Pix, boleto + split, 3DS, chargebacks. Safrapay is maintained by codespar on GitHub at codespar/mcp-dev-latam, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Safrapay MCP server?

Add Safrapay to your AI app's MCP config with the command npx -y @codespar/mcp-safrapay@0.2.0-alpha.3. In Claude Code, run claude mcp add --transport stdio codespar-safrapay -- npx -y @codespar/mcp-safrapay@0.2.0-alpha.3. To run Safrapay this way you need Node.js installed.

Does Safrapay need an API key?

Yes. Safrapay expects SAFRAPAY_CLIENT_ID, SAFRAPAY_CLIENT_SECRET and SAFRAPAY_MERCHANT_ID to be set. Create the key for Safrapay in the connected service's own settings, give it the smallest permissions the job needs, and keep it out of shared config files.

Is Safrapay an official MCP server?

No. Safrapay is a community server maintained by codespar. Community servers can be excellent; read the code and the open issues before you give Safrapay access to company data.

What license is Safrapay under?

Safrapay is released under the MIT license, according to its GitHub repository. The license covers the code of Safrapay; the service it connects to has its own terms.