Skip to main content
BR

Braintree

v0.2.1API Key

PayPal-owned global payment processor. Target: LatAm SaaS selling to US/EU with existing Braintree accounts. GraphQL API (v2019-01-01) — transactions, vault, customers, client tokens.

22 tools5 env vars🌐 GLOBALstable on npm

What your agent can do

Braintree gives your agent 22 tools it calls directly — pick the ones it needs, in Claude, Cursor, or any MCP client.

  • authorize_transactionAuthorize a transaction (reserve funds without capturing) via Braintree GraphQL authorizePaymentMethod. Pass a paymentMethodId obtained from client-side tokenization (Drop-in / Hosted Fields / SDK nonce). Capture later with capture_transaction.
  • charge_transactionAuthorize and capture a transaction atomically via Braintree GraphQL chargePaymentMethod. Use for one-step sales. For auth-now-capture-later split, use authorize_transaction + capture_transaction.
  • capture_transactionCapture a previously authorized transaction via captureTransaction. Amount defaults to full authorized amount when omitted (partial captures allowed up to the authorized total).
Example call
// Your agent calls a tool directly — no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("authorize_transaction", { /* ... */ });

Install

terminal
$ npm install @codespar/mcp-braintree

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "braintree": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-braintree"
      ],
      "env": {
        "BRAINTREE_MERCHANT_ID": "<your_braintree_merchant_id>",
        "BRAINTREE_PUBLIC_KEY": "<your_braintree_public_key>",
        "BRAINTREE_PRIVATE_KEY": "<your_braintree_private_key>"
      }
    }
  }
}

After restart, your agent can call any of the 22 tools below — try authorize_transaction first.

Environment variables · 5

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

BRAINTREE_MERCHANT_ID
required

Braintree merchant id (from the Control Panel > API).

BRAINTREE_PUBLIC_KEY
required

Braintree public API key — Basic auth username.

BRAINTREE_PRIVATE_KEY
requiredsecret

Braintree private API key — Basic auth password (secret).

BRAINTREE_ENV
optional

Braintree environment. 'sandbox' (default, https://payments.sandbox.braintree-api.com/graphql) or 'production' (https://payments.braintree-api.com/graphql).

BRAINTREE_API_VERSION
optional

Braintree-Version header value (YYYY-MM-DD). Defaults to 2019-01-01.

Available tools · 22

Each tool is independent — your agent loads only what it needs to reduce context and response time.

WRITEauthorize_transaction
Authorize a transaction (reserve funds without capturing) via Braintree GraphQL authorizePaymentMethod. Pass a paymentMethodId obtained from client-side tokenization (Drop-in / Hosted Fields / SDK nonce). Capture later with capture_transaction.
WRITEcharge_transaction
Authorize and capture a transaction atomically via Braintree GraphQL chargePaymentMethod. Use for one-step sales. For auth-now-capture-later split, use authorize_transaction + capture_transaction.
WRITEcapture_transaction
Capture a previously authorized transaction via captureTransaction. Amount defaults to full authorized amount when omitted (partial captures allowed up to the authorized total).
DELETErefund_transaction
Refund a settled transaction via refundTransaction. Amount defaults to the full settled amount when omitted. For partial refunds, pass a smaller amount.
DELETEvoid_transaction
Void an unsettled transaction (reverse the authorization) via reverseTransaction. Use when funds are authorized but not yet captured — for captured/settled transactions use refund_transaction instead.
WRITEvault_payment_method
Permanently store a tokenized payment method in the Braintree vault via vaultPaymentMethod. The input paymentMethodId must be a single-use nonce; the mutation returns a permanent vaulted payment method id that can be reused for future charges.
DELETEdelete_payment_method
Delete a vaulted payment method via deletePaymentMethodFromVault. Irreversible — the token cannot be used for future charges after deletion.
WRITEcreate_customer
Create a Braintree customer via createCustomer. Customers group multiple vaulted payment methods and transactions under one identity.

Compatible frameworks

MCP is a protocol — any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

Run `npx -y @codespar/mcp-braintree` and add the config block above to your MCP client — Claude, Cursor, VS Code, or any MCP-compatible client. No build step, no SDK required. Prefer hosted? CodeSpar's managed tier runs it for you with auth handled.
Braintree — MCP server · 22 tools | CodeSpar