Skip to main content

Official package

The Safefy MCP Server implements the Model Context Protocol (MCP), the open standard that lets AI assistants use external tools. With it, your AI agent queries and operates the Safefy API right in the conversation.

What it is for

  • Integrate faster. Ask “add Safefy PIX payments to my checkout” and the agent reads the integration guide, writes the code with the SDK or the API and tests it in the Sandbox: it creates the charge, simulates the payment and resends the webhook.
  • Operate your account by chatting. “What’s my balance?”, “list yesterday’s transactions”, “create a R$ 150 PIX charge for customer João” become chat requests, without opening the dashboard.

Requirements

Start with Sandbox credentials. The environment is detected from the key prefix (pk_sandbox_ or pk_production_), so nothing else needs to change to switch environments.

Setup by platform

Credentials go in the MCP server’s environment variables, as in the examples below.
Do not paste the Secret Key in the chat. Conversation history is no place for secrets. Since version 1.1.0, the tool that accepted keys through the chat is disabled by default.
Edit claude_desktop_config.json and restart Claude:
To check it works, ask the agent: “What’s my Safefy balance?”

Environment variables

Security

The AI agent can move money, so the server has its own safeguards:
  • The token only goes to the Safefy API. Calls outside the API host or outside /v1/ are rejected.
  • Cards only by token. The agent never receives the card number or CVV. Card charges use the cardToken from tokenization.
  • Payouts only to a registered account. A payout requires a payout account already registered in the dashboard (ad-hoc PIX keys are not accepted) and explicit user confirmation in the conversation, with amount and destination shown.
  • Credentials outside the chat. Keys live in environment variables.
For production use, create a credential with only the permissions you need. See Credential permissions.

Available tools

All tools are prefixed with safefy_payment_.

Integration and setup

  • get_integration_guide: integration guide using the Node SDK or the API directly (any language)
  • list_capabilities: lists what the server covers
  • get_configuration: shows the environment and whether credentials are set, without exposing the Secret Key
  • authenticate: generates the access token
  • configure_credentials: accepts keys through the chat. Disabled by default
  • api_request: generic call to any /v1/ API route, for operations without a dedicated tool

Transactions

  • create_transaction: creates a PIX, boleto or card charge (card via cardToken)
  • get_transaction: gets a transaction
  • list_transactions: lists transactions with filters
  • simulate_transaction: simulates payment or failure in the Sandbox
  • resend_transaction_webhook: resends a transaction’s webhook

Balance

  • get_balance: gets the available balance

Payouts

  • create_cashout: requests a payout to a registered account, with user confirmation
  • get_cashout: gets a payout
  • list_cashouts: lists payouts with filters
  • cancel_cashout: cancels a pending payout
  • simulate_cashout: simulates completion or failure in the Sandbox

Customers

  • create_customer: creates a customer
  • get_customer: gets a customer
  • list_customers: lists customers with filters
  • update_customer: updates customer data

Orders

  • create_order: creates an order
  • get_order: gets an order
  • list_orders: lists orders

Products

  • get_product: gets a product
  • list_products: lists products with filters
  • get_payment_link: gets a payment link
  • start_payment_link: starts a charge on a payment link
  • get_payment_link_status: gets a link’s status

Usage examples

The agent calls create_transaction and shows the PIX Copy and Paste code.
The agent calls list_transactions and get_balance and presents a summary.
The agent reads get_integration_guide, writes the code and uses create_transaction and simulate_transaction to test it.