关于 mcp-braintree
mcp-braintree 是基于 Braintree(PayPal)GraphQL API 的 MCP 服务,用于全球卡支付的授权、扣款、退款与 vault 管理。目标用户是已拥有 Braintree 商户账户、希望由 Agent 处理支付和客户管理的拉美 SaaS 企业。
主要功能
- 01授权、捕获、扣款与撤销交易
- 02支付方式 vault 存储与删除
- 03客户的创建、更新与查询
- 04争议(dispute)处理与证据提交
- 05客户端 token 生成,用于前端分词
适用场景
- 01由 Agent 对 SaaS 订阅进行扣款与退款
- 02管理已存储支付方式的客户资料
- 03跟踪并回应信用卡争议
MCP 相关
该项目作为 MCP 服务,向 MCP 客户端暴露 22 个工具,用于调用 Braintree GraphQL 接口完成支付与客户操作。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y @codespar/mcp-braintreeBRAINTREE_MERCHANT_IDBraintree merchant id (from the Control Panel > API).BRAINTREE_PUBLIC_KEY密钥Braintree public API key — Basic auth username.BRAINTREE_PRIVATE_KEY密钥Braintree private API key — Basic auth password (secret).BRAINTREE_ENVBraintree environment. 'sandbox' (default, https://payments.sandbox.braintree-api.com/graphql) or 'production' (https://payments.braintree-api.com/graphql).BRAINTREE_API_VERSIONBraintree-Version header value (YYYY-MM-DD). Defaults to 2019-01-01.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
22收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| amount | string | 是 | 以十进制字符串表示的金额(例如,“10.50”)。Braintree 金额使用字符串。 |
| orderId | string | 否 | 商家侧订单引用。 |
| transaction | object | 否 | 其他 TransactionInput 字段(customerDetails、billingAddress、shippingAddress、descriptor、customFields、riskData、lineItems 等)。与 amount/orderId/merchantAccountId 合并。 |
| paymentMethodId | string | 是 | 令牌化支付方式 ID 或 nonce(来自客户端 SDK)。 |
| merchantAccountId | string | 否 | 可选的商家账户 ID(适用于支持多币种/多账户的商家)。 |
详细介绍
@codespar/mcp-braintree
适用于 Braintree(PayPal)的 MCP 服务——通过 Braintree GraphQL API 处理全球银行卡支付。
目标客户:面向美国和欧盟买家的拉美 SaaS 企业,这些买家已持有 Braintree 商户账户,并希望通过 Agent 驱动支付、付款方式存储和客户管理。
工具(22)
| 工具 | 用途 |
|---|---|
authorize_transaction | 通过 Braintree GraphQL authorizePaymentMethod 授权交易(预留资金但不扣款)。 |
charge_transaction | 通过 Braintree GraphQL chargePaymentMethod 原子地授权并扣款。 |
capture_transaction | 通过 captureTransaction 扣取先前已授权的交易款项。 |
refund_transaction | 通过 refundTransaction 退还已结算的交易款项。 |
void_transaction | 通过 reverseTransaction 撤销尚未结算的交易(撤销授权)。 |
vault_payment_method | 通过 vaultPaymentMethod 将令牌化的付款方式永久存储在 Braintree 金库中。 |
delete_payment_method | 通过 deletePaymentMethodFromVault 删除金库中存储的付款方式。 |
create_customer | 通过 createCustomer 创建 Braintree 客户。 |
update_customer | 通过 updateCustomer 更新现有的 Braintree 客户。 |
get_transaction | 通过 GraphQL search.transactions 查询,按 ID 获取交易。 |
get_customer | 通过 GraphQL node(id:) 查询,按 ID 获取客户。 |
submit_for_settlement | 通过 submitTransactionForSettlement 提交先前已授权的交易以供结算。 |
update_payment_method | 通过 updatePaymentMethod 更新金库中付款方式的元数据。 |
verify_payment_method | 通过 verifyPaymentMethod 对令牌化的付款方式进行信用卡验证(零授权或 1 美元授权)。 |
delete_customer | 通过 deleteCustomer 删除 Braintree 客户。 |
find_customer | 通过 GraphQL search.customers 查询搜索客户。 |
search_transactions | 通过 GraphQL search.transactions 查询搜索交易。 |
find_dispute | 通过 GraphQL node(id:) 查询,按 ID 获取争议。 |
accept_dispute | 通过 acceptDispute 接受争议责任——商户认责,争议金额将被退款…… |
finalize_dispute | 通过 finalizeDispute 完成争议处理——将先前添加的证据提交给银行卡网络审核。 |
find_merchant_account | 通过 GraphQL node(id:) 查询,按 ID 获取商户账户。 |
create_client_token | 通过 createClientToken 创建 Braintree 客户端令牌,用于客户端令牌化(Drop-in、Hosted Fields、m……) |
安装
npm install @codespar/mcp-braintree
环境
BRAINTREE_MERCHANT_ID="..." # merchant id
BRAINTREE_PUBLIC_KEY="..." # public API key (Basic auth user)
BRAINTREE_PRIVATE_KEY="..." # private API key (Basic auth password, secret)
BRAINTREE_ENV="sandbox" # 'sandbox' (default) or 'production'
BRAINTREE_API_VERSION="2019-01-01" # optional, Braintree-Version header
端点:
sandbox→https://payments.sandbox.braintree-api.com/graphqlproduction→https://payments.braintree-api.com/graphql
身份验证
Braintree 的 GraphQL 端点接受 HTTP Basic 身份验证,使用经 base64 编码的 PUBLIC_KEY:PRIVATE_KEY。每个请求还必须包含 Braintree-Version: YYYY-MM-DD 标头——服务默认使用 2019-01-01,也可通过 BRAINTREE_API_VERSION 覆盖。
付款方式 ID
大多数变更操作都需要 paymentMethodId。这些 ID 来自客户端令牌化(Braintree Drop-in / Hosted Fields / SDK)——服务不接受原始 PAN。使用 create_client_token 为浏览器或移动 SDK 创建令牌。
运行
# stdio (default — for Claude Desktop, Cursor, etc)
npx @codespar/mcp-braintree
# HTTP (for server-to-server testing)
MCP_HTTP=true MCP_PORT=3000 npx @codespar/mcp-braintree
说明
- 金额在 Braintree GraphQL 中是字符串(例如
"10.50"),而不是数字。服务会转发 Agent 传入的任何格式;字符串是稳妥的默认选择。 - Braintree 的 GraphQL 架构会不断演进;一些未在 MCP
inputSchema中公开的输入字段,仍可通过additional/ 嵌套对象传入,服务会将其转发。
企业版
需要为 Agent 支付设置治理、预算限额和审计跟踪?CodeSpar Enterprise 在这些 MCP 服务之上提供策略引擎、支付路由和合规模板。
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。