Connect Brex to Claude: Track transactions, receipts, and budgets
Learn how to connect Brex to claude using Truto. Step-by-step guide to tool calling, API quirks, and autonomous workflows.
If your team needs to connect Brex to Claude to automate expense reconciliation, chase missing receipts, or manage corporate cards, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's natural language tool calls and Brex's REST APIs. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses ChatGPT, check out our guide on /connect-brex-to-chatgpt-manage-cards-spend-limits-and-expenses/ or explore our broader architectural overview on /connect-brex-to-ai-agents-automate-transfers-vendors-and-users/.
Giving a Large Language Model (LLM) read and write access to a sprawling financial ecosystem like Brex is an engineering challenge. You have to handle OAuth 2.0 token lifecycles, map massive JSON schemas to MCP tool definitions, and deal with strict financial API quotas. Every time Brex updates an endpoint or changes their budget resource structure, you have to update your server code, redeploy, and test the integration.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Brex, connect it natively to Claude Desktop, and execute complex treasury and expense workflows using natural language.
The Engineering Reality of the Brex API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools via JSON-RPC 2.0, the reality of implementing it against Brex's APIs is painful. You are not just integrating a simple ledger - you are integrating Brex Team, Brex Cash, Brex Cards, and Brex Expenses, all of which require specific data handling.
If you decide to build a custom MCP server for Brex, you own the entire API lifecycle. Here are the specific challenges you will face:
Fragmented Budgets vs. Spend Limits
Brex has evolved its spend management data models over time. As a result, an LLM interacting with your server can easily get confused between legacy budgets, "Spend Limits", and the newer "Budgets V2" endpoints. An LLM has no context on which API version to use. Your MCP server must strictly expose tools and schemas that correspond to your specific Brex configuration, explicitly guiding the LLM on whether to use budget_id or spend_limit_id depending on the object it is modifying.
Presigned S3 URLs for Receipt Uploads
When you want an LLM to attach a receipt to an expense, it cannot just POST a file buffer to a Brex endpoint. Brex requires a two-step handshake. First, you must hit the receipt_match or receipt_upload endpoint to generate a presigned Amazon S3 URI. This URI expires in 30 minutes and only accepts PUT requests. You must orchestrate the LLM to request the URI, securely execute the PUT request with the raw file data, and handle the asynchronous matching process on the Brex side.
Rate Limits Without Safety Nets
Financial APIs enforce aggressive rate limits to protect backend ledgers. Truto does not retry, throttle, or apply backoff on rate limit errors. When the Brex API returns an HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. Your MCP client architecture must be responsible for catching these 429s, reading the reset headers, and implementing its own retry or backoff logic.
Generating the Brex MCP Server
Truto derives MCP tools dynamically from the integration's documented API resources. A tool only appears in the MCP server if it has a corresponding documentation entry, ensuring the LLM is only exposed to curated, well-described endpoints.
You can generate an MCP server for Brex using either the Truto UI or the Truto API.
Method 1: Via the Truto UI
For teams that want a quick, no-code setup, you can generate the server directly from the Truto dashboard.
- Navigate to the Integrated Accounts page and select your connected Brex account.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration (e.g., name, allowed methods, tags, and expiry).
- Copy the generated MCP server URL (e.g.,
https://api.truto.one/mcp/<token>).
Method 2: Via the API
For automated deployments, you can programmatically generate MCP servers. The API validates the available Brex tools, generates a secure cryptographically hashed token, stores it in distributed KV storage for low-latency routing, and returns the ready-to-use URL.
Make an authenticated POST request to /integrated-account/:id/mcp:
curl -X POST https://api.truto.one/integrated-account/<brex_account_id>/mcp \
-H "Authorization: Bearer <YOUR_TRUTO_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Brex Treasury Agent Server",
"config": {
"methods": ["read", "write"],
"tags": ["expenses", "cards", "cash"]
}
}'The response will return the secure endpoint URL:
{
"id": "mcp_123abc",
"name": "Brex Treasury Agent Server",
"config": { "methods": ["read", "write"] },
"expires_at": null,
"url": "https://api.truto.one/mcp/a1b2c3d4e5f67890"
}Connecting the MCP Server to Claude
Once you have your Truto MCP URL, you can connect it to Claude. The server is completely self-contained; the URL contains the cryptographic token that encodes the specific Brex integrated account.
Method A: Via the Claude UI
If you are using the Claude desktop app or enterprise web interface:
- Open Claude and navigate to Settings -> Integrations -> Add MCP Server.
- Provide a name for the connection (e.g., "Brex Financials").
- Paste the Truto MCP URL you generated.
- Click Add. Claude will instantly execute an
initializehandshake and pull down the list of available Brex tools.
Method B: Via Manual Config File
For developers using the Claude Desktop app locally, you can modify the claude_desktop_config.json file. Because Truto MCP servers run remotely over HTTPS, you must use the official @modelcontextprotocol/server-sse transport to route traffic.
Add the following to your configuration file (located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"brex-finance": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"--url",
"https://api.truto.one/mcp/<YOUR_TRUTO_TOKEN>"
]
}
}
}Restart Claude Desktop. The agent will immediately parse the dynamically generated JSON Schemas for the Brex endpoints and make them available in your chat context.
Security and Access Control
Giving an AI agent raw API access requires strict guardrails. Truto MCP servers support multiple layers of configuration to limit the agent's blast radius on your Brex account:
- Method Filtering (
methods): Restrict the server to onlyreadoperations (get,list) to prevent the LLM from accidentally executing state-changing actions like issuing cards or transferring funds. - Tag Filtering (
tags): Scope the server to specific functional areas (e.g.,["receipts", "expenses"]) so the LLM cannot access employee payroll or corporate budget settings. - Expiration (
expires_at): Set a strict ISO 8601 datetime for the server to automatically self-destruct. This is critical when provisioning temporary MCP access to automated external agents or contractors. - Dual Authentication (
require_api_token_auth): By default, possession of the MCP URL grants access. By setting this flag totrue, the MCP client must also pass a valid Truto API token in theAuthorizationheader.
Brex Hero Tools for Claude
Truto maps Brex's API surface into flat, descriptive, snake_case tools. When an MCP client invokes a tool, Truto splits the single arguments object into query and body parameters based on the integration's schema rules, routing the request to the upstream API.
Here are the highest-leverage tools available on the Brex MCP Server.
list_all_brex_expenses
Fetches paginated expense records. Admins and bookkeepers see all expenses; regular users only see their own. You can filter by date ranges, payment status, and expense types.
Contextual Note: Because Brex can return thousands of expenses, the LLM must manage pagination. Truto automatically injects limit and next_cursor parameters into the schema. Instruct the LLM to pass the nextCursor string back exactly as received.
"Fetch all settled expenses from last week that do not have a receipt attached. Paginate through the results if there are more than 100."
create_a_brex_card_receipt_match
Generates a short-lived, presigned S3 URL where a receipt file can be uploaded. Brex will automatically attempt to match the uploaded receipt against existing un-receipted expenses.
Contextual Note: This tool returns an id and a uri. The uri expires in 30 minutes and only accepts PUT requests. Your agent must execute the file upload using a standard HTTP request after receiving this URI.
"I have a PDF receipt for a recent Uber ride. Generate a receipt match URI in Brex so I can upload it for reconciliation."
get_single_brex_accounting_record_by_id
Retrieves the detailed accounting representation of a transaction, including the exact General Ledger (GL) line items mapped by Brex.
Contextual Note: Use the single_entry=true parameter if you only want the core cash-flow line items, omitting complex multi-entry accruals.
"Look up accounting record ID 98765 and verify if the ERP posting date was recorded, and list the associated GL line items."
create_a_brex_transfer
Initiates a money movement via ACH, Domestic Wire, Cheque, or International Wire.
Contextual Note: This is a high-risk operation. It requires a counterparty, amount, description, external_memo, and originating_account. The amount must be formatted carefully based on the currency.
"Draft an ACH transfer for $5,000 to the counterparty 'Acme Corp' from our primary cash account. Use 'Q3 Vendor Payment' as the description."
list_all_brex_budgets_v_2
Lists all modern budgets configured in the Brex account, including their recurrence periods, assigned amounts, and current spend statuses.
Contextual Note: Always prefer the v_2 budget endpoints over the legacy spend limit tools unless you are maintaining backward compatibility with older Brex account structures.
"List all active budgets in Brex and tell me which ones are currently exceeding 80% of their allocated limit for this month."
brex_cards_lock
Instantly freezes an existing Brex card to prevent further authorizations.
Contextual Note: The card owner will immediately receive an email/push notification stating the card was locked and the reason string provided in the API call.
"Lock the vendor card assigned to 'SaaS Subscriptions' immediately. Set the reason to 'Suspected unauthorized charge detected'."
For the full list of tools, schemas, and required parameters, visit the Brex integration page.
Workflows in Action
By chaining these dynamically generated tools, Claude can execute complex, multi-step financial operations that would normally require manual data entry across multiple dashboards.
Workflow 1: End-of-Month Receipt Reconciliation
Chasing down missing receipts is the most painful part of month-end close. An agent can automate the discovery and matching process.
"Find all expenses from the last 7 days over $500 that are missing receipts. For each one, check if the merchant was 'AWS'. If it was, generate a receipt upload link so I can push the invoice to it."
- Claude calls
list_all_brex_expenseswith a date filter and inspects the JSON array for missing receipt flags and amounts > 500. - Claude filters the array in-memory for the merchant "AWS".
- For matching records, Claude calls
create_a_brex_card_receipt_matchwith the expense details. - Claude returns the presigned S3 URLs to the user or passes them to a secondary file-processing agent to complete the upload.
sequenceDiagram
participant User
participant ClaudeDesktop as Claude Desktop
participant TrutoMCP as Truto MCP Server
participant BrexAPI as Brex API
User->>ClaudeDesktop: "Reconcile missing AWS receipts"
ClaudeDesktop->>TrutoMCP: Call list_all_brex_expenses
TrutoMCP->>BrexAPI: GET /v1/expenses
BrexAPI-->>TrutoMCP: 200 OK (Expenses array)
TrutoMCP-->>ClaudeDesktop: Filtered expense data
ClaudeDesktop->>TrutoMCP: Call create_a_brex_card_receipt_match
TrutoMCP->>BrexAPI: POST /v1/expenses/receipt_match
BrexAPI-->>TrutoMCP: 200 OK (Presigned S3 URI)
TrutoMCP-->>ClaudeDesktop: Returns URI
ClaudeDesktop-->>User: "Ready. Upload file to this URI."Workflow 2: Automated Employee Offboarding
When an employee leaves, IT and Finance must coordinate to revoke access and freeze spending immediately to prevent rogue charges.
"We are offboarding John Doe (john.doe@company.com). Find his Brex user ID, lock all his active physical and virtual cards, and set his user status to inactive."
- Claude calls
list_all_brex_userswith the email filter to retrieve John'suser_id. - Claude calls
list_all_brex_cardspassing theuser_idto get the list of active cards. - Claude loops through the cards, calling
brex_cards_lockon each one with the reason "Employee offboarding". - Claude calls
update_a_brex_user_by_id, setting the user's status to INACTIVE.
Workflow 3: Treasury Cash Account Monitoring
Finance teams need constant visibility into liquidity across primary and secondary cash accounts.
"Check the balances of all our Brex cash accounts. If any account has an available balance below $50,000, draft an incoming transfer from our linked bank account to top it up by $25,000."
- Claude calls
list_all_brex_accounts_cashesto retrieve the current and available balances for all cash accounts. - Claude analyzes the balances. If an account is below the threshold, it retrieves the account's ID.
- Claude calls
list_all_brex_linked_accountsto find an eligible funding source. - Claude calls
create_a_brex_incoming_transfer(ACH debit) using the linked account as the counterparty and the low-balance account as the receiver.
Moving Past Infrastructure
Building an MCP server from scratch for Brex means wrestling with idempotency headers, API version migrations, rate limits, and complex nested schemas. By using Truto to generate a managed MCP server, you eliminate the integration infrastructure layer entirely.
Instead of reading Brex's API documentation to figure out how to format a budget payload, you simply provide the secure Truto MCP URL to your agent. Your engineering time shifts from maintaining HTTP clients and token refresh logic to actually building the agentic workflows that save your finance team hundreds of hours a month.