Unofficial PayPal Braintree payment gateway MCP Server for AI agents to process payments, manage customers, and handle transactions securely.
An unofficial Model Context Protocol (MCP) server for interacting with PayPal Braintree payment processing services.
This project is available under the MIT License with an Academic Citation Requirement. This means you can freely use, modify, and distribute the code, but any academic or scientific publication that uses this software must provide appropriate attribution.
If you use this software in a research project that leads to a publication, presentation, or report, you must cite this work according to the format provided in CITATION.md.
Commercial and non-academic use follows the standard MIT License terms without the citation requirement.
By using this software, you agree to these terms. See LICENSE.md for the complete license text.
There are two versions of the Braintree MCP server available:
braintree_server.py
)Usage with Claude Desktop:
claude_desktop_config.json
to point to this serverbraintree_sse_server.py
)127.0.0.1:8001
by default (configurable)Manual Usage:
python braintree_sse_server.py
Connecting to the SSE server:
Use an MCP client that supports SSE transport and connect to http://127.0.0.1:8001/sse
This server implements the Model Context Protocol (MCP) specification to provide AI assistant models with direct, structured access to Braintree's payment processing capabilities via GraphQL API. It enables AI systems to perform payment operations like fetching transactions, creating payments, and managing customer data through MCP tools.
git clone https://github.com/yourusername/braintree-mcp-server.git
cd braintree-mcp-server
# If using pyenv
pyenv install 3.13.0
pyenv local 3.13.0
# Or using another method to ensure Python 3.13+
pip install -e .
Create a .env
file in the project root with your Braintree credentials:
BRAINTREE_MERCHANT_ID=your_merchant_id
BRAINTREE_PUBLIC_KEY=your_public_key
BRAINTREE_PRIVATE_KEY=your_private_key
BRAINTREE_ENVIRONMENT=sandbox # or production
You can obtain these credentials from your Braintree Control Panel.
python braintree_server.py
The server runs using stdio transport by default, which is suitable for integration with AI assistant systems that support MCP.
python braintree_sse_server.py
The SSE server provides a web-based transport layer that allows multiple persistent client connections. This is useful for standalone deployments where multiple clients need to access the Braintree functionality.
Default configuration:
See requirements.txt
for the required dependencies.
Simple connectivity test to check if your Braintree credentials are working.
response = await braintree_ping()
# Returns "pong" if successful
Execute arbitrary GraphQL queries against the Braintree API.
query = """
query GetTransactionDetails($id: ID!) {
node(id: $id) {
... on Transaction {
id
status
amount {
value
currencyCode
}
createdAt
}
}
}
"""
variables = {"id": "transaction_id_here"}
response = await braintree_execute_graphql(query, variables)
# Returns JSON response from Braintree
query GetCustomer($id: ID!) {
node(id: $id) {
... on Customer {
id
firstName
lastName
email
paymentMethods {
edges {
node {
id
details {
... on CreditCardDetails {
last4
expirationMonth
expirationYear
cardType
}
}
}
}
}
}
}
}
mutation CreateTransaction($input: ChargePaymentMethodInput!) {
chargePaymentMethod(input: $input) {
transaction {
id
status
amount {
value
currencyCode
}
}
}
}
With variables:
{
"input": {
"paymentMethodId": "payment_method_id_here",
"transaction": {
"amount": "10.00",
"orderId": "order123",
"options": {
"submitForSettlement": true
}
}
}
}
.env
file