mcpField
B
Brex MCP Server

Brex MCP Server

本地服务
github.com/crazyrabbitLTC金融数据461 周前更新

关于 Brex MCP Server

Brex MCP Server 通过以读取为主的工具和资源,将 MCP 客户端连接到 Brex 的费用与财务数据,并支持部分收据和费用写入操作。它支持字段投影、筛选和分页,以控制响应内容。

主要功能

  1. 01读取预算和支出限额
  2. 02查询费用和交易
  3. 03访问账户和账单
  4. 04匹配及上传收据
  5. 05更新费用
  6. 06筛选、投影和分页数据

适用场景

  1. 01按日期或状态查看费用
  2. 02获取预算和支出限额详情
  3. 03检查卡片及现金交易
  4. 04匹配收据或更新费用

MCP 相关

向 MCP 客户端提供费用、预算、支出限额、预算计划和交易资源,以及查询和部分写入工具。客户端可筛选、分页并限制返回字段。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"brex-server": {
"command": "npx",
"args": [
"-y",
"mcp-brex"
],
"env": {
"BREX_API_KEY": "<BREX_API_KEY>"
}
}
}
}
启动命令npx -y mcp-brex
需要配置的环境变量
BREX_API_KEY密钥

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npmmcp-brex

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Brex MCP 服务

一个用于 Brex API 的模型上下文协议(MCP)服务。经过优化,可安全地返回精简的只读响应,并支持投影和批处理。

安装

Claude Code
# Install the package
npm install -g mcp-brex

# Add to Claude Code with your API key
claude mcp add brex --env BREX_API_KEY=your_brex_api_key -- npx mcp-brex
Claude Desktop

添加到你的 claude_desktop_config.json:

{
  "mcpServers": {
    "brex": {
      "command": "npx",
      "args": ["mcp-brex"],
      "env": {
        "BREX_API_KEY": "your_brex_api_key"
      }
    }
  }
}
手动设置(开发)
git clone https://github.com/dennisonbertram/mcp-brex.git
cd mcp-brex
npm install
npm run build
claude mcp add brex --env BREX_API_KEY=your_key -- node build/index.js

资源

  • brex://expenses | brex://expenses/{id} | brex://expenses/card | brex://expenses/card/{id}
  • brex://budgets | brex://budgets/{id}
  • brex://spend_limits | brex://spend_limits/{id}
  • brex://budget_programs | brex://budget_programs/{id}
  • brex://transactions/card/primary | brex://transactions/cash/{id}
  • brex://docs/usage(面向 Agent 的精简使用指南)

说明:

  • 资源接受 ?summary_only=true&fields=id,status,...,用于控制负载大小。
  • 费用资源会自动展开 merchant 和 budget,以便阅读。

工具(除非另有说明,否则为只读)

  • 预算:get_budgets、get_budget
  • 支出限额:get_spend_limits、get_spend_limit
  • 预算计划:get_budget_programs、get_budget_program
  • 费用(单页):get_expenses
  • 费用(分页):get_all_expenses、get_all_card_expenses
  • 按 ID 查询费用:get_expense、get_card_expense
  • 卡片账单:get_card_statements_primary
  • 交易:get_card_transactions、get_cash_transactions
  • 现金账单:get_cash_account_statements
  • 账户:get_all_accounts、get_account_details
  • 收据(写入):match_receipt、upload_receipt
  • 更新(写入):update_expense

如何调用工具

始终将参数放在 arguments 下(而非 input)。使用分页和筛选来精简负载。

常用参数:

  • 分页:page_size(<=50)、max_items(建议 <=200)
  • 日期筛选:start_date、end_date、window_days
  • 状态筛选:用于费用/交易的 status 数组
  • 金额筛选:用于费用的 min_amount、max_amount
  • 商户筛选:用于费用的 merchant_name
  • 展开控制:使用 expand 数组包含嵌套对象(例如 ["merchant", "budget"])

推荐示例:

{
  "name": "get_all_card_expenses",
  "arguments": {
    "page_size": 10,
    "max_items": 20,
    "start_date": "2025-08-25T00:00:00Z",
    "end_date": "2025-08-26T00:00:00Z",
    "status": ["APPROVED"],
    "min_amount": 100
  }
}
{
  "name": "get_expenses",
  "arguments": {
    "limit": 5,
    "status": "APPROVED"
  }
}
{
  "name": "get_card_transactions",
  "arguments": {
    "limit": 10,
    "posted_at_start": "2025-08-25T00:00:00Z"
  }
}
{
  "name": "get_all_accounts",
  "arguments": {
    "page_size": 10,
    "max_items": 20,
    "status": "ACTIVE"
  }
}
{
  "name": "get_transactions",
  "arguments": {
    "accountId": "acc_123456789",
    "limit": 10
  }
}
{
  "name": "get_expenses",
  "arguments": {
    "limit": 5,
    "expand": ["merchant", "user"]
  }
}

分页和筛选最佳实践

重要:使用分页、筛选和排序来控制响应大小,而不要依赖摘要。

数据控制的关键参数:
  • page_size: number — 每页项目数(建议:≤50)
  • max_items: number — 所有页面的最大项目总数(建议:≤200)
  • start_date/end_date: string — ISO 日期范围筛选
  • window_days: number — 将较大的日期范围拆分为较小的批次
  • status: string[] — 按状态筛选(例如,["APPROVED", "PENDING"])
  • min_amount/max_amount: number — 按金额筛选费用
最佳实践:
  • 批量请求始终使用日期范围,以避免响应过大
  • 使用较小的页面大小(≤50)和合理的 max_items(≤200)
  • 应用状态筛选器,仅获取所需数据
  • 使用 window_days(例如,7)将较大的日期范围分批处理
  • 使用 expand 参数控制嵌套对象的展开:
    • 默认:expand: [] 返回精简对象(每个约 500-1000 个 token)
    • 展开后:expand: ["merchant", "budget"] 返回完整对象(每个约 15K+ 个 token)
    • 可用的展开选项:merchant、budget、user、department、location、receipts
  • 先使用较小的限制进行测试,再逐步扩大规模
  • 现金端点需要额外的 Brex 权限范围;请妥善处理 403 错误

发布

仅发布 build/、README.md 和 LICENSE。

许可证

MIT — 详见 LICENSE。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。