# Brex MCP

The Brex MCP server lets AI assistants interact directly with your Brex account: query expenses, look up users, check card statuses, and more through natural language.

Beta
The MCP server's tools may change as we continue developing new use cases and features.

## Prerequisites

1. **Accept the Developer API agreement.** An account admin or card admin must accept the Developer API agreement in **Settings → Developer**.
2. **Enable the beta.** Go to **Settings → Beta features** in the Brex Dashboard and select **Brex in AI assistants**.


Once enabled, all users in your Brex account can connect to the MCP server with their own credentials. This is different from the Brex Developer API, which requires admin-provisioned API tokens. Any employee can authorize via OAuth and access tools scoped to their own data, while admin-only tools are restricted to account admins and card admins.

## Connect to the Brex MCP server

The server is hosted at `https://api.brex.com/mcp` and supports any MCP-compatible client. Most clients handle authentication automatically with discovery. Just add the server URL and you'll be prompted to log in with your Brex account.

### Claude Code


```bash
claude mcp add --transport http brex https://api.brex.com/mcp
```

Then verify the connection:


```bash
claude /mcp
```

### Claude Desktop

Install the [Brex connector](https://claude.com/connectors/brex) from the Claude connectors directory.

Alternatively, add it manually to your config file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`



```json
{
  "mcpServers": {
    "brex": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.brex.com/mcp"],
      "env": {}
    }
  }
}
```

Restart Claude Desktop after saving. Requires Node.js v20+.

### ChatGPT

Install the [Brex app](https://chatgpt.com/apps/brex/asdk_app_6961bc9309ec819199ce7ce38b7d3bf1) from the ChatGPT app directory.

### Cursor

Open **Settings → MCP** and add a new server:

- **Name**: `brex`
- **Type**: `http`
- **URL**: `https://api.brex.com/mcp`


### Codex


```bash
codex mcp add brex --url https://api.brex.com/mcp
```

### Other MCP clients

Any client that supports MCP HTTP transport can connect to `https://api.brex.com/mcp`. If your client supports OAuth with Dynamic Client Registration, authentication is handled automatically. Otherwise, use an API key (see below).

## Authentication

The Brex MCP server supports two authentication methods.

### OAuth (recommended)

MCP clients that support OAuth will automatically initiate a browser-based authorization flow when you first connect. No manual token setup required.

- **Authorization server**: `https://accounts-api.brex.com/oauth2/default`
- **Discovery endpoint**: `https://api.brex.com/.well-known/oauth-protected-resource/mcp`


The server supports [Dynamic Client Registration (RFC 7591)](https://www.rfc-editor.org/rfc/rfc7591), so MCP clients don't need to be pre-registered. Sessions remain active, so you won't need to re-authorize on every use.

You can view and revoke authorized sessions from **Settings → Personal settings → Connected integrations** in the Brex Dashboard.

### API key

For clients that don't support OAuth, or for programmatic access, account and card admins can authenticate with a Brex API token. Generate one from **Settings → Developer** in the Brex Dashboard.

Pass it as a Bearer token in the Authorization header:


```
Authorization: Bearer YOUR_BREX_ACCESS_TOKEN
```

For example, in Claude Code:


```bash
claude mcp add --transport http brex https://api.brex.com/mcp \
  --header "Authorization: Bearer YOUR_BREX_ACCESS_TOKEN"
```

Or in `.mcp.json`:


```json
{
  "mcpServers": {
    "brex": {
      "type": "http",
      "url": "https://api.brex.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_BREX_ACCESS_TOKEN"
      }
    }
  }
}
```

### Security best practices

- **Prefer OAuth over API keys.** OAuth scopes access to what you authorize, and sessions can be revoked from the Dashboard.
- **Use restricted tokens.** If using API keys, create tokens with only the scopes your use case needs.
- **Enable human confirmation.** Configure your AI assistant to require approval before executing actions.
- **Store tokens securely.** Use environment variables; never commit tokens to version control.
- **Monitor usage.** Review API logs in the Brex Dashboard to track MCP activity.


## Available tools

Most tools are available to all users. Tools marked "Account admin or Card admin" require elevated access.

| Tool | Capability | Access |
|  --- | --- | --- |
| `get_user_myself` | Get your own profile | All users |
| `get_user_by_id` | Look up a user by ID | All users |
| `list_users_by_name_or_email` | Search users by name or email | All users |
| `list_users` | List and filter users | All users |
| `list_my_expenses` | See your recent expenses | All users |
| `get_expense_by_id` | Get details for a specific expense | All users |
| `get_reimbursement_payout_date` | Check payout ETAs for reimbursements | All users |
| `query_expense_analytics` | Ask high-level company spend questions | Account admin or Card admin |
| `list_my_cards` | See your cards and their status | All users |
| `get_card_by_id` | Get details for a specific card | All users |
| `list_my_limits` | View your spend limits and remaining balance | All users |
| `get_expense_policy` | Get expense policy for a spend limit | All users |


### Current limitations

- The MCP server is read-only. It cannot create, update, or delete resources.


## Example prompts

Once connected, try these with your AI assistant:

**Expense review**

> "Show me all my expenses from the past month that are missing receipts."


**User lookup**

> "Find the user with email sarah@acme.com and show me their active cards."


**Spend analysis**

> "What are my current spend limits and how much budget do I have remaining?"


**Company spend (admin)**

> "What was our total spend on software last quarter?"


## Troubleshooting

### OAuth flow not completing

1. Check that your browser allows popups from `accounts-api.brex.com`.
2. Confirm the beta is enabled in **Settings → Beta features**.
3. Try clearing your browser cookies for `accounts-api.brex.com` and reconnecting.


### `401 Unauthorized`

1. If using OAuth, your session may have expired. Reconnect to re-authorize.
2. If using an API key, confirm the token includes the `Bearer` prefix.
3. Generate a new token from **Settings → Developer** in the Brex Dashboard.


### Tools not appearing

1. Restart your AI assistant after adding the MCP server config.
2. Check your assistant's logs for connection errors.
3. Verify the JSON config has no syntax errors.


### Connection timeouts

1. Verify the URL is exactly `https://api.brex.com/mcp`.
2. Check your network allows outbound HTTPS connections.
3. If using `mcp-remote`, ensure Node.js v20+ is installed.


## Resources

- [Model Context Protocol specification](https://modelcontextprotocol.io)
- [Brex API documentation](/)
- [Brex API support](/docs/support)