---
title: "Connect Brex to ChatGPT: Manage cards, spend limits, and expenses"
slug: connect-brex-to-chatgpt-manage-cards-spend-limits-and-expenses
date: 2026-10-31
author: Yuvraj Muley
categories: ["AI & Agents"]
excerpt: "Learn how to generate a secure Brex MCP server using Truto and connect it to ChatGPT. Automate card issuance, spend limits, and expense audits with AI agents."
tldr: "Connect Brex to ChatGPT via Truto's managed MCP server. This guide covers overcoming Brex API quirks, generating secure tool endpoints, and running real-world financial workflows."
canonical: https://truto.one/blog/connect-brex-to-chatgpt-manage-cards-spend-limits-and-expenses/
---

# Connect Brex to ChatGPT: Manage cards, spend limits, and expenses


If you need to connect Brex to ChatGPT to automate corporate card issuance, [audit expenses, or dynamically adjust spend limits](https://truto.one/how-to-connect-ai-agents-to-brex-automate-expense-management-via-mcp/), you need a Model Context Protocol (MCP) server. This server acts as the [translation layer](https://truto.one/auto-generated-mcp-tools-for-ai-agents-a-2026-architecture-guide/) between ChatGPT's tool calling capabilities and Brex's REST APIs. You can either build, host, and maintain this infrastructure yourself, or use a [managed integration platform](https://truto.one/best-mcp-server-platforms-for-enterprise-ai-agents-2026/) like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude, check out our guide on [connecting Brex to Claude](https://truto.one/connect-brex-to-claude-track-transactions-receipts-and-budgets/) or explore our broader architectural overview on [connecting Brex to AI Agents](https://truto.one/connect-brex-to-ai-agents-automate-transfers-vendors-and-users/).

Giving a Large Language Model (LLM) read and write access to a financial platform like Brex is a serious engineering challenge. You have to handle complex nested payloads for spend controls, enforce strict idempotency for financial actions, and correctly route arguments from a flat LLM prompt into specific query parameters and request bodies. 

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Brex, connect it natively to ChatGPT, and execute complex financial workflows using natural language.

> Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
>
> [Talk to us](https://truto.one/book-a-demo/)

## The Engineering Reality of the Brex API

Building a custom MCP server means you own the entire API lifecycle. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Brex's specific financial API surface introduces challenges that break standard CRUD assumptions.

If you decide to build a custom MCP server for Brex, here are the specific integration hurdles you will face:

### Nested Spend Controls and Limit Types
Unlike a simple SaaS CRM, Brex's data model heavily relies on nested configurations. When you create a card via the API, the payload structure changes depending on the `limit_type`. If the limit type is `CARD`, the API strictly requires a nested `spend_controls` object. If the limit type is `USER`, passing `spend_controls` will result in a 400 Bad Request. Your MCP server must generate JSON schemas that clearly articulate these conditional dependencies to ChatGPT, otherwise, the LLM will constantly hallucinate invalid payload structures when trying to provision cards.

### Idempotency in Financial Operations
When your AI agent initiates an incoming transfer or funds movement, the Brex API requires an `Idempotency-Key` header. If the LLM makes a mistake or if a network timeout occurs, a standard retry without managing idempotency could result in duplicate financial transfers. Your integration layer must intercept the LLM's tool call, generate a deterministic or secure random idempotency key, and attach it to the HTTP headers before proxying the request to Brex.

### Rate Limiting and Backoff Responsibilities
Brex enforces strict rate limits on API consumers to protect their infrastructure. When an upstream limit is hit, Brex returns an HTTP 429 Too Many Requests status. It is critical to understand that Truto does not retry, throttle, or apply backoff on rate limit errors automatically. When Brex returns a 429, Truto passes that error directly back to the caller (ChatGPT). However, Truto normalizes the upstream rate limit information into standardized IETF headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`). The caller - or the orchestrating agent framework - is entirely responsible for implementing the retry and backoff logic using these standardized headers.

### The Flat Input Namespace Problem
When ChatGPT invokes a tool, it passes all arguments as a single, flat JSON object. However, Brex's API expects certain parameters in the query string (e.g., `user_id` for filtering cards) and others in the request body (e.g., `spend_controls`). If you build this yourself, you have to write custom middleware for every endpoint to map the flat LLM arguments to the correct HTTP locations. Truto handles this automatically by extracting the query and body schemas from the integration documentation and splitting the LLM's arguments into the correct locations before execution.

## Generating a Brex MCP Server

To connect Brex to ChatGPT, you first need to generate an MCP server endpoint scoped specifically to your connected Brex account. Truto allows you to do this via the dashboard UI or programmatically via the API.

### Method 1: Via the Truto UI

If you are testing a workflow or manually provisioning access for an internal ChatGPT workspace, the UI is the fastest path.

1. Navigate to the **Integrated Accounts** page in your Truto dashboard.
2. Select your connected Brex account.
3. Click the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. Select your desired configuration (name, allowed methods, tags, and optional expiry).
6. Click save and **copy the generated MCP server URL** (e.g., `https://api.truto.one/mcp/a1b2c3d4e5f6...`).

### Method 2: Via the Truto API

For production use cases where you need to programmatically provision MCP servers for your customers or automated agent pools, use the Truto API. 

The API securely stores a hashed version of the token, schedules any necessary cleanup alarms if an expiry is set, and returns the ready-to-use URL.

**Endpoint:** `POST /integrated-account/:id/mcp`

```bash
curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Brex Card Management MCP",
    "config": {
      "methods": ["read", "write"],
      "tags": ["cards", "spend_limits", "expenses"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'
```

The response will contain the secure URL needed by the MCP client:

```json
{
  "id": "abc-123",
  "name": "Brex Card Management MCP",
  "config": { "methods": ["read", "write"] },
  "expires_at": "2026-12-31T23:59:59.000Z",
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f6..."
}
```

## Connecting the MCP Server to ChatGPT

Once you have your Truto MCP URL, you need to register it with your ChatGPT environment. You can do this through the ChatGPT interface or via a local configuration file if you are running a custom client.

### Method A: Via the ChatGPT UI

If you are using ChatGPT Pro, Plus, Business, Enterprise, or Education, you can add custom connectors directly in the interface.

1. Open ChatGPT and navigate to **Settings -> Apps -> Advanced settings**.
2. Enable **Developer mode** (MCP support is gated behind this flag).
3. Under **MCP servers / Custom connectors**, click to add a new server.
4. **Name:** Enter a recognizable label (e.g., "Brex Financial Ops").
5. **Server URL:** Paste the Truto MCP URL you generated earlier.
6. Click **Save**.

ChatGPT will immediately perform the MCP initialization handshake, discover the available Brex tools, and surface them to the model.

### Method B: Via Manual Config File

If you are running a custom MCP client, an orchestrator, or a local agent framework that accepts MCP configurations, you can register the server using the standard Server-Sent Events (SSE) transport.

```json
{
  "mcpServers": {
    "brex-financial-ops": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/a1b2c3d4e5f6..."
      ]
    }
  }
}
```

## Brex Hero Tools for AI Agents

When you connect Brex via Truto, the MCP server dynamically derives tool definitions from the integration's underlying schema documentation. The LLM is provided with exact descriptions, required fields, and JSON schema boundaries for every operation.

Here are the most high-leverage tools available for Brex workflows.

### list_all_brex_cards
Retrieves a list of Brex cards, optionally filtered by user ID. This is the foundational tool for auditing card issuance across the company. The tool schema explicitly returns card statuses, limit types, and spend controls, giving the LLM immediate context on how funds are allocated.

**Contextual usage notes:** The LLM will often use this tool first when asked to troubleshoot a declined transaction, as it needs to map a user's name to a specific `card_id`.

> "Pull all active Brex cards assigned to the engineering department and list their current spend controls."

### create_a_brex_card
Provisions a new physical or virtual Brex card. The LLM handles constructing the payload, distinguishing between `CARD` limit types (which require `spend_controls`) and `USER` limit types. 

**Contextual usage notes:** If the user requests a physical card, the LLM knows via the schema description that a `mailing_address` object is mandatory and that the first two lines must be under 60 characters.

> "Issue a new virtual vendor card for AWS Hosting, set the limit type to CARD, and cap the monthly spend control at $5,000."

### brex_cards_lock
Immediately locks an existing, unlocked Brex card. The card owner receives an automated notification from Brex. 

**Contextual usage notes:** This tool requires both a `card_id` and a `reason`. AI agents commonly use this in security workflows triggered by anomaly detection or employee offboarding requests.

> "Lock the vendor card ending in 4921 immediately and log the reason as 'suspected compromised credentials'."

### list_all_brex_budgets
Retrieves the Spend Limit budgets belonging to the Brex account. It returns the current budget status, the financial limit, the spend type, and the period recurrence.

**Contextual usage notes:** Agents use this to check available funds before attempting to provision new cards or approve large expense requests.

> "Check our Q3 Offsite travel budget. How much of the limit is remaining for this period?"

### update_a_brex_spend_limit_by_id
Modifies an existing Spend Limit in Brex. 

**Contextual usage notes:** This is highly useful for dynamic budget adjustments. If an agent identifies that a marketing campaign is scaling faster than expected, it can request human approval and then automatically bump the limit via this tool.

> "Increase the spend limit for the 'Q4 Advertising' budget by $10,000, leaving the period recurrence unchanged."

### list_all_brex_expenses
Fetches a paginated list of Brex expenses, filterable by user, expense type, status, and date ranges. 

**Contextual usage notes:** Truto automatically injects `limit` and `next_cursor` properties into the LLM's query schema. The prompt explicitly instructs the model to pass the cursor values back unchanged to navigate large expense ledgers reliably.

> "Find all unapproved expenses over $500 from the last 14 days and summarize the merchants involved."

To view the complete inventory of available Brex tools, schema definitions, and required parameters, visit the [Brex integration page](https://truto.one/integrations/detail/brex).

## Workflows in Action

Connecting Brex to ChatGPT unlocks multi-step financial operations that would normally require logging into a dashboard, exporting CSVs, and manually clicking through forms.

### Scenario 1: Provisioning a Restricted Vendor Card

When a team needs to spin up a new software subscription, an admin can instruct ChatGPT to handle the entire vendor and card provisioning lifecycle.

> "We are signing up for Datadog. Create a new vendor record for them, then issue a virtual Brex card assigned to me with a strict $2,000 monthly limit. Name the card 'Datadog Infrastructure'."

**Execution Steps:**
1. **`create_a_brex_vendor`**: ChatGPT calls this tool, passing `"company_name": "Datadog"` to register the payee in the system.
2. **`list_all_brex_me`**: The agent calls this tool to retrieve the authenticated admin's `user_id`, as it needs an owner ID to issue the card.
3. **`create_a_brex_card`**: The agent constructs a payload with `card_name: "Datadog Infrastructure"`, `card_type: "VIRTUAL"`, `limit_type: "CARD"`, and provides the mandatory `spend_controls` object capping the limit at $2,000 monthly. 

**Result:** The admin receives confirmation in the chat window, and the card details are immediately ready for use, perfectly mapped to the correct vendor.

### Scenario 2: Security Audit and Card Freeze

If suspicious activity is reported, an IT or Finance admin can use ChatGPT to instantly audit and remediate the threat.

> "I think John Doe's travel card was compromised. Lock his card immediately and pull a list of all expenses charged to his account in the last 48 hours."

```mermaid
sequenceDiagram
    participant Admin as User (Admin)
    participant GPT as ChatGPT
    participant Truto as Truto MCP Server
    participant Brex as Brex API

    Admin->>GPT: "Lock John's travel card and pull recent expenses."
    
    GPT->>Truto: Call list_all_brex_users (search: "John Doe")
    Truto->>Brex: GET /users?search=John%20Doe
    Brex-->>Truto: Return user_id: "usr_892"
    Truto-->>GPT: user_id: "usr_892"
    
    GPT->>Truto: Call list_all_brex_cards (user_id: "usr_892")
    Truto->>Brex: GET /cards?user_id=usr_892
    Brex-->>Truto: Return card_id: "crd_445"
    Truto-->>GPT: card_id: "crd_445"
    
    GPT->>Truto: Call brex_cards_lock (card_id: "crd_445", reason: "compromised")
    Truto->>Brex: POST /cards/crd_445/lock
    Brex-->>Truto: Success
    Truto-->>GPT: Card locked successfully
    
    GPT->>Truto: Call list_all_brex_expenses (user_id: "usr_892", purchased_at_start: <timestamp>)
    Truto->>Brex: GET /expenses?user_id=usr_892&purchased_at_start=...
    Brex-->>Truto: Return 3 recent expenses
    Truto-->>GPT: Expense data
    
    GPT-->>Admin: "John's card (ending in 3321) is locked. Here are the 3 charges from the last 48 hours..."
```

**Execution Steps:**
1. **`list_all_brex_users`**: ChatGPT searches for "John Doe" to retrieve the correct `user_id`.
2. **`list_all_brex_cards`**: The agent filters cards by John's `user_id` to locate the active travel card ID.
3. **`brex_cards_lock`**: ChatGPT locks the specific card ID, providing the reason requested by the admin.
4. **`list_all_brex_expenses`**: The agent queries the ledger for John's expenses, applying a datetime filter for the last 48 hours.

**Result:** The threat is neutralized in seconds without the admin needing to hunt through the Brex dashboard, and an immediate audit report is printed in the chat.

## Security and Access Control

Providing an LLM with access to corporate funds requires strict governance. Truto's MCP architecture provides multiple layers of access control, ensuring your Brex MCP URL remains secure and scoped to the principle of least privilege.

*   **Method Filtering (`methods`):** Restrict the LLM's capabilities at the server level. By configuring `methods: ["read"]`, you guarantee the agent can only pull reports and audit ledgers, physically preventing it from creating cards, transferring funds, or altering budgets.
*   **Tag Filtering (`tags`):** Scope the server to specific functional domains. Setting `tags: ["expenses", "users"]` ensures the agent has zero visibility into core treasury operations, webhooks, or accounting integrations.
*   **Authentication Requirement (`require_api_token_auth`):** By default, an MCP URL is protected by its cryptographic token. For enterprise environments, enabling this flag forces the MCP client to also pass a valid Truto API token via a Bearer header. If the URL leaks, it remains useless without the secondary authentication token.
*   **Ephemeral Servers (`expires_at`):** For temporary auditing tasks or contractor access, you can append an ISO datetime to the server configuration. Truto will automatically destroy the server endpoint and its keys at the exact second it expires.

## Final Thoughts

Building an AI integration with Brex is not just about establishing an OAuth connection; it is about accurately mapping complex financial schemas, handling strict idempotency requirements, and normalizing rate limits across a sprawling API surface. 

By leveraging a managed MCP infrastructure layer, you remove the burden of translating flat LLM inputs into nested JSON payloads, maintaining custom middleware, and manually tracking schema drift. Truto handles the protocol translation and secure execution, allowing your engineering team to focus on building the actual financial intelligence inside your AI agent.

> Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
>
> [Talk to us](https://truto.one/book-a-demo/)
