mcpField
M
mcp-nupay

mcp-nupay

Local
github.com/codesparFinance275Updated 4w ago

About mcp-nupay

mcp-nupay is an MCP server for NuPay, Nubank's merchant checkout service, aimed at Brazilian merchants and agents. Shoppers confirm payments in the Nubank app or via Pix, and the server also supports pre-authorized recurring flows.

Key features

  1. 01Create, query and cancel NuPay payments
  2. 02Full and partial refunds with status lookup
  3. 03Registration of final beneficiaries
  4. 04Settlement reports and installment condition queries
  5. 05CIBA / OTP pre-authorization with token refresh

Use cases

  1. 01Starting NuPay checkouts from an agent and tracking payment status
  2. 02Handling merchant refunds and settlement reconciliation
  3. 03Setting up pre-authorized recurring charges for repeat buyers

MCP support

This is an MCP server that exposes 22 tools to MCP clients for payments, refunds, recipients, settlements and token management.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-nupay": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-nupay"
],
"env": {
"NUPAY_MERCHANT_KEY": "<NUPAY_MERCHANT_KEY>",
"NUPAY_MERCHANT_TOKEN": "<NUPAY_MERCHANT_TOKEN>",
"NUPAY_CLIENT_ID": "<NUPAY_CLIENT_ID>",
"NUPAY_CLIENT_SECRET": "<NUPAY_CLIENT_SECRET>",
"NUPAY_ENV": "<NUPAY_ENV>"
}
}
}
}
Run commandnpx -y @codespar/mcp-nupay
Environment variables to set
NUPAY_MERCHANT_KEYSecretNuPay X-Merchant-Key issued to your merchant
NUPAY_MERCHANT_TOKENSecretNuPay X-Merchant-Token issued to your merchant
NUPAY_CLIENT_IDOAuth2/CIBA client_id for pre-authorized (recurrence) flows. Optional unless using backchannel_start / backchannel_complete.
NUPAY_CLIENT_SECRETSecretOAuth2/CIBA client_secret for pre-authorized flows. Optional unless using backchannel_* tools.
NUPAY_ENVsandbox | production. Defaults to sandbox. Drives both checkout API and auth base URLs.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-nupay0.2.2

Tools

22

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
itemsarrayYesLine items purchased
amountobjectYesPayment amount object
amount.valuenumberYesAmount in cents (BRL)
amount.currencystringYesISO-4217, e.g. BRL
shopperobjectYesCustomer identity
shopper.ipstringNoShopper IP for fraud scoring
shopper.namestringYes
shopper.emailstringYes
shopper.phonestringNo
shopper.localestringNoe.g. pt-BR
shopper.documentstringYesCPF digits only
shopper.documentTypeenumYesCPF | CNPJ
shippingobjectNoShipping address + method
storeNamestringNo
recipientsarrayNoUp to 10 final beneficiaries (regulatory split)
callbackUrlstringNoHTTPS webhook URL for status notifications
paymentFlowobjectNoReturn / cancel URLs for redirect flows
paymentFlow.cancelUrlstringNo
paymentFlow.returnUrlstringNo
referenceIdstringYesE-commerce payment reference id (unique per merchant)
installmentsnumberNoInstallment count (pre-authorized only)
merchantNamestringNo
paymentMethodobjectYesMethod selection
paymentMethod.typestringYese.g. NUPAY, PIX
paymentMethod.authorizationstringNoAuthorization mode for NuPay (e.g. CIBA, OTP, REDIRECT)
referenceDatestringNoISO-8601 timestamp
billingAddressobjectNoBilling address
delayToAutoCancelnumberNoMinutes before auto-cancel. Default 30.
merchantOrderReferencestringYesMerchant-side order id (unique per merchant)

Details

From the project README

@codespar/mcp-nupay

MCP server for NuPay — Nubank's merchant checkout rail.

NuPay is Nubank's answer to PayPal / Shop Pay for Brazil: a wallet-backed checkout that leverages Nubank's 100M+ BR customer distribution. Agents create a payment, the shopper confirms inside the Nubank app (push + biometric) or via Pix, and funds settle to the merchant. Pre-authorized flows (CIBA / OTP) unlock recurrence and true one-click for repeat buyers.

Tools (22)

ToolPurpose
create_paymentCreate a NuPay checkout payment.
get_paymentRetrieve full payment details (amount, shopper, items, current status, timestamps) by pspReferenceId.
get_payment_statusRetrieve a payment's status by pspReferenceId.
list_payments_by_dateList payments created within a date range.
cancel_paymentCancel a payment that has not yet been captured/settled.
create_refundRefund a settled payment (full or partial).
get_refundRetrieve refund status by pspReferenceId + refundId.
list_refundsList all refunds issued against a given payment.
create_recipientRegister a final beneficiary (required for regulatory split payments).
get_recipientRetrieve a registered recipient by referenceId.
update_recipientUpdate a registered final beneficiary (name, document, country, type).
delete_recipientRemove a registered recipient.
list_recipientsList registered recipients (final beneficiaries) for the merchant.
list_settlementsList settlement reports (payouts to the merchant bank account) within a date range.
get_settlementRetrieve a single settlement (payout batch) including the list of underlying transactions.
query_payment_conditionsQuery available installment/payment conditions for a given amount and (optionally) shopper CPF.
create_preauth_paymentCreate a NuPay payment using a pre-authorized Bearer access_token (pre-auth / recurrence flow).
backchannel_startStart a CIBA / OTP pre-authorization for a shopper.
backchannel_completeComplete a CIBA/OTP flow by submitting the OTP the shopper received.
backchannel_resend_otpResend the OTP to the shopper for an in-flight authorization ticket.
exchange_tokenExchange an authorization_code or refresh_token at POST /v1/token.
revoke_tokenRevoke an issued access_token or refresh_token at POST /v1/token/revoke.

Install

npm install @codespar/mcp-nupay

Environment

NUPAY_MERCHANT_KEY="..."     # X-Merchant-Key issued to your merchant
NUPAY_MERCHANT_TOKEN="..."   # X-Merchant-Token (secret)
NUPAY_CLIENT_ID="..."        # Optional — OAuth client_id for pre-auth / recurrence
NUPAY_CLIENT_SECRET="..."    # Optional — OAuth client_secret
NUPAY_ENV="sandbox"          # sandbox (default) | production

Authentication

Two flows:

  1. Standard merchant API (payments, refunds, recipients, payment-conditions) uses X-Merchant-Key + X-Merchant-Token headers. No token exchange.
  2. Pre-authorized / recurrence uses OAuth2 + CIBA / OTP. Start with backchannel_start, validate via backchannel_complete, then call create_preauth_payment with the returned Bearer access_token. Refresh with exchange_token (grant_type=refresh_token). Access tokens expire in 5 minutes; refresh tokens should be stored long-term for recurrence.

Base URLs are derived from NUPAY_ENV:

SandboxProduction
APIhttps://sandbox-api.spinpay.com.brhttps://api.spinpay.com.br
Authhttps://sandbox-authentication.spinpay.com.br/apihttps://authentication.spinpay.com.br/api

JWT client_assertion signing is the caller's responsibility — exchange_token expects an already-signed assertion with client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer.

Run

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

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

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.