upbank-mcp
upbank-mcp
一个将 Up Banking API 暴露给 LLM 客户端的 Model Context Protocol 服务器,使用 FastMCP 构建并打包为 Docker。
它提供 19 个工具 和 2 个资源,覆盖 Up API 的完整公开表面——账户、交易、类别、标签、附件和 Webhook——响应针对 token 效率进行了重塑,游标分页端到端保留,并在速率限制时自动重试。
目录
Related MCP server: Up Bank MCP Server
要求
Up 账户 | 来自 https://api.up.com.au/getting_started 的个人访问令牌。令牌形如 |
Docker | Docker Engine 20.10+ 及 Compose v2( |
Python | 3.11+ — 仅当在 Docker 之外运行时需要。 |
Up API 可供澳大利亚的 Up 客户使用。令牌仅授予对签发客户自身数据的访问权限。
快速开始
git clone git@github.com:uiux-me/upbank-mcp.git
cd upbank-mcp
cp .env.example .env # paste your token into UP_API_TOKEN
docker compose up --build服务器监听于 http://127.0.0.1:8000/mcp。验证它:
docker compose exec upbank-mcp python -c "
import asyncio, upbank_mcp
from fastmcp import Client
async def main():
async with Client(upbank_mcp.mcp) as c:
print((await c.call_tool('ping')).data)
asyncio.run(main())"健康的响应包含你的客户 id 和一个状态表情符号:
{'ok': True, 'id': 'eb59f467-…', 'status_emoji': '⚡️'}配置
所有配置均通过环境变量进行。Compose 会自动从项目目录读取 .env。
变量 | 默认值 | 描述 |
| (必填) | 个人访问令牌。服务器读取凭据的唯一变量。Compose 没有它则拒绝启动;直接运行时,服务器会启动并在第一次工具调用时失败。 |
|
| API 基础 URL。仅用于针对 mock 进行测试时覆盖。 |
|
| 本地 MCP 客户端使用 |
|
| HTTP 传输的绑定地址,在容器内部。 |
|
| HTTP 传输的监听端口,在容器内部。 |
|
| 仅限 Compose。 发布在 |
运行服务器
HTTP,通过 Compose
最适合在你的机器上由多个客户端共享的长期运行服务器。
docker compose up --build # foreground
docker compose up -d --build # detached
docker compose logs -f # follow logs
docker compose down # stop and remove端口仅发布在 127.0.0.1 上。参见 安全。
stdio,通过 Docker
最适合将服务器作为子进程启动的 MCP 客户端。构建镜像一次:
docker build -t upbank-mcp:latest .镜像默认使用 MCP_TRANSPORT=stdio,因此无需覆盖传输设置。
不使用 Docker
pip install -e .
export UP_API_TOKEN=up:yeah:...
upbank-mcp设置 MCP_TRANSPORT=http 以通过 HTTP 提供服务,而非 stdio。
连接 MCP 客户端
Claude Code
claude mcp add upbank \
-e UP_API_TOKEN=up:yeah:... \
-- docker run -i --rm -e UP_API_TOKEN upbank-mcp:latestClaude Desktop,或任何使用 mcpServers 配置的客户端
{
"mcpServers": {
"upbank": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "UP_API_TOKEN", "upbank-mcp:latest"],
"env": { "UP_API_TOKEN": "up:yeah:..." }
}
}
}-i 是必需的——服务器通过 stdin/stdout 通信。--rm 在客户端断开连接时清理容器。
通过 HTTP
在 Compose 栈运行时,将客户端指向 http://127.0.0.1:8000/mcp。
工具参考
必需参数为粗体。每个列表工具都接受 cursor;参见 分页。
工具
工具 | 参数 | 返回 |
| — |
|
账户
工具 | 参数 | 返回 |
|
| 带余额的账户页。 |
|
| 单个账户。 |
交易
工具 | 参数 | 返回 |
|
| 交易页,最新的在前。省略 |
|
| 单笔交易,包括 hold、round-up 和 cashback 详情。 |
since 和 until 以闭区间约束 createdAt。category 接受父 id,该 id 会匹配其所有子类别。
类别
工具 | 参数 | 返回 |
|
| 类别树,或某个父类别的子类别。不分页。 |
|
| 单个类别及其父、子 id。 |
|
| 设置类别,当 |
类别由 Up 固定,无法创建。Id 是诸如 restaurants-and-cafes 的 slug。只有 is_categorizable: true 的交易才能被更改,并且只接受叶子类别——传递诸如 good-life 的父类别会返回 HTTP 403。
标签
工具 | 参数 | 返回 |
|
| 标签页。标签的 id 即其标签名。 |
|
| 添加标签,创建任何不存在的标签。 |
|
| 从交易中移除标签。 |
一笔交易最多持有 6 个标签。没有剩余交易的标签会从 list_tags 中消失。
附件
工具 | 参数 | 返回 |
|
| 附件页。 |
|
| 单个附件。 |
file_url 是一个签名 URL,在 file_url_expires_at 时过期。请及时获取,或重新请求附件。
Webhook
工具 | 参数 | 返回 |
|
| Webhook 页。 |
|
| 单个 Webhook。 |
|
| 新的 Webhook,包括 |
|
|
|
|
| 发送测试 |
|
| 最近的投递尝试,包含响应代码和响应体。 |
secret_key 仅在创建时返回,之后不再返回。请存储它,以验证传入投递上的 X-Up-Authenticity-Signature 头(SHA-256 HMAC)。
资源
URI | 内容 |
| 每个账户及其当前余额,作为单个 JSON 快照。 |
| 完整的类别树,用于解析有效的 |
两者均按需读取,反映读取时的状态。
响应约定
形状
Up 返回 JSON:API,它将每个字段嵌套在 attributes/relationships 下,并在每个资源上重复自链接。本服务器将每个资源扁平化为紧凑的 dict,并在可选字段不存在时省略它们,这显著降低了 token 成本,同时不丢失调用者所需的信息。
{
"id": "45b83097-c97d-40da-9790-254056f03d40",
"status": "SETTLED",
"description": "Google One",
"amount": { "value": "-2.49", "currency": "AUD", "base_units": -249 },
"created_at": "2026-08-20T06:53:17+10:00",
"settled_at": "2026-08-20T06:53:17+10:00",
"account_id": "90c0fffc-bed6-4214-9450-6a76cd39957b",
"category_id": "games-and-software",
"parent_category_id": "good-life",
"tags": [],
"is_categorizable": true
}诸如 foreign_amount、hold_info、round_up、cashback、card_purchase_method、note 和 message 等字段仅在交易具有它们时出现。
金额
每个金额都是一个对象:
{ "value": "-2.49", "currency": "AUD", "base_units": -249 }value 是十进制字符串,base_units 是整数最小单位(AUD 为分)。借记为负数。 进行算术运算时优先使用 base_units,以避免浮点错误。
分页
列表工具返回:
{ "items": [ ... ], "next_cursor": "https://api.up.com.au/...", "prev_cursor": null }要翻页,请将返回的游标作为同一工具的 cursor 参数传入。
游标是 Up 自己的不透明 URL,已经编码了过滤条件和页面大小,因此
当设置了 cursor 时,所有其他参数都会被忽略。cursor 为 null 表示该方向
没有更多页面。
游标在跟随前会针对配置的 API 主机进行验证,因此 游标无法将客户端重定向到其他服务器。
日期
since 和 until 接受 YYYY-MM-DD 或完整的 RFC-3339 时间戳。裸
日期和 naive 日期时间会锚定到 Australia/Sydney,这与 Up
在应用中的展示方式一致;对于所涉日期会应用正确的偏移量,
因此夏令时也能正确处理。无法解析的输入会在请求发出前被拒绝,
而不是在发出后以不透明的 HTTP 400 形式浮出。
错误处理与速率限制
API 错误会以
ToolError形式抛出,包含 HTTP 状态码以及 Up 自己的错误标题 和详细信息,例如:HTTP 403 — Forbidden: Top-level categories cannot be set directly on transactions.429 和 5xx 响应会以指数退避方式重试最多 3 次, 并在存在
Retry-After头时予以遵循。网络故障会在浮出前按相同计划重试。
除 429 之外的 4xx 响应不会重试——它们表示请求有误。
项目结构
src/upbank_mcp/
├── client.py Async HTTP client: auth, retry/backoff, date normalisation,
│ cursor host validation
├── shapes.py JSON:API → flat dict transforms, one per resource type
├── server.py FastMCP instance, tool and resource definitions, entrypoint
├── __init__.py Exports `mcp` and `main`
└── __main__.py Enables `python -m upbank_mcp`这种分离是刻意的:client.py 只了解 HTTP,与 MCP 无关;
shapes.py 是纯粹的数据转换;server.py 持有工具契约。
每个模块都可以独立测试。
开发
pip install -e .
export UP_API_TOKEN=up:yeah:...
upbank-mcp # stdio
MCP_TRANSPORT=http upbank-mcp # http on :8000使用 FastMCP 客户端以进程内方式驱动服务器:
import asyncio
from fastmcp import Client
import upbank_mcp
async def main():
async with Client(upbank_mcp.mcp) as client:
print(await client.list_tools())
result = await client.call_tool("list_accounts", {"account_type": "TRANSACTIONAL"})
print(result.data)
asyncio.run(main())更改后重建镜像:
docker compose up -d --build安全
令牌威力强大。 Up 个人访问令牌不能移动资金——API 没有 支付或转账端点——但它们可以读取你的完整交易 历史,并修改类别、标签和 Webhook。请像对待密码一样对待它。
HTTP 传输本身没有认证。 任何能访问 该端口的人都可以读取你的银行数据。因此 Compose 只发布到
127.0.0.1。除非在它前面加上认证,否则不要将其绑定到0.0.0.0, 也不要通过隧道或反向代理暴露它。令牌绝不会被烘焙进镜像。
.env被列在.dockerignore中, 令牌在运行时提供。它不会出现在任何镜像层中,因此 该镜像可以安全地推送到注册表。.env已被 gitignore,.env.example只包含占位符。容器以非 root 用户运行(uid 10001)。
如果令牌曾经暴露,请立即轮换,参见 https://api.up.com.au/getting_started。 令牌不会自行过期。
故障排除
症状 | 原因与修复 |
|
|
Compose 以 | 原因相同,发生在容器启动时而非首次调用时。 |
| 另一个进程占用了 8000 端口。在 |
| 令牌无效或已被吊销。请重新签发。 |
|
|
| ID 是按客户区分的。请确认该 ID 来自此令牌自己的数据。 |
反复出现 | 持续触发速率限制。减小 |
客户端不显示任何工具 | 客户端必须使用 |
参考
Available Tools
19 toolsadd_tags_to_transactionAdd Tags To TransactionC
Add one or more tags to a transaction.
Inputs: tags (required), transaction_id (required). Returns: object
categorize_transactionCategorize TransactionA
Set or clear a transaction's category.
Only transactions with is_categorizable: true can be changed.
Inputs: transaction_id (required), category_id. Returns: object
create_webhookCreate WebhookA
Register a webhook for transaction events.
The response contains secret_key, which is returned only once — store it now
to verify the X-Up-Authenticity-Signature header on incoming deliveries.
Inputs: url (required), description. Returns: object
delete_webhookDelete WebhookB
Permanently delete a webhook. This cannot be undone.
Inputs: webhook_id (required). Returns: object
get_accountGet AccountC
Retrieve a single account by id.
Inputs: account_id (required). Returns: object
get_attachmentGet AttachmentB
Retrieve a single attachment by id.
Inputs: attachment_id (required). Returns: object
get_categoryGet CategoryB
Retrieve a single category by id.
Inputs: category_id (required). Returns: object
get_transactionGet TransactionB
Retrieve a single transaction by id, including hold, round-up and cashback detail.
Inputs: transaction_id (required). Returns: object
get_webhookGet WebhookC
Retrieve a single webhook by id.
Inputs: webhook_id (required). Returns: object
list_accountsList AccountsB
List the customer's Up accounts with their current balances.
Inputs: cursor, page_size, account_type, ownership_type. Returns: object
list_attachmentsList AttachmentsB
List transaction attachments. File URLs are signed and expire shortly.
Inputs: cursor, page_size. Returns: object
list_categoriesList CategoriesA
List the category tree. Categories are fixed by Up, not user-defined.
Inputs: parent. Returns: object
list_tagsList TagsB
List all tags the customer has created. A tag's id is its label.
Inputs: cursor, page_size. Returns: object
list_transactionsList TransactionsA
List transactions, newest first, optionally filtered by account, status, date range, category or tag.
Inputs: tag, since, until, cursor, +4 more. Returns: object
list_webhook_logsList Webhook LogsA
List recent delivery attempts for a webhook, to debug failing deliveries.
Inputs: webhook_id (required), cursor, page_size. Returns: object
list_webhooksList WebhooksC
List configured webhooks.
Inputs: cursor, page_size. Returns: object
pingPingA
Check that the configured Up API token is valid and the API is reachable.
Inputs: no named parameters. Returns: object
ping_webhookPing WebhookA
Send a test PING event to a webhook to verify it is reachable.
Inputs: webhook_id (required). Returns: object
remove_tags_from_transactionRemove Tags From TransactionC
Remove one or more tags from a transaction.
Inputs: tags (required), transaction_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool targets a distinct resource and action (accounts, transactions, categories, tags, attachments, webhooks), with clear separation between list/get/create/delete/add/remove/ping operations. Overlap is minimal and descriptions explicitly differentiate ambiguous pairs like ping vs ping_webhook.
Nearly all tools follow a consistent snake_case verb_noun pattern (list_accounts, get_transaction, create_webhook, add_tags_to_transaction). The sole minor deviation is 'ping', which lacks a noun but remains unambiguous and predictable.
19 tools across six resource groups is slightly above the typical 3–15 sweet spot, but each tool maps to a distinct, necessary operation for a banking API. No tool appears redundant or trivially thin.
Coverage is broad: full webhook lifecycle plus ping/logs, transaction list/get/categorize, tag add/remove/list, and read operations for accounts, categories, and attachments. Minor gaps exist, notably no attachment upload/delete, but core workflows are otherwise well-covered.
Maintenance
Related MCP Connectors
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- AlicenseDqualityDmaintenanceA Model Context Protocol server that allows AI assistants to connect to and manage Israeli bank accounts, fetch transactions, and handle authentication for all major Israeli banks and credit card companies.238ISC
- AlicenseNot gradedqualityDmaintenanceAn MCP wrapper for Up Bank's API that allows Claude and other MCP-enabled clients to manage accounts, transactions, categories, tags, and webhooks from Up Bank.3MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables interaction with You Need A Budget (YNAB) via their API, allowing users to manage budgets, accounts, categories, and transactions through natural language.2MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows AI assistants to interact with Lunch Money accounts, enabling management of transactions, categories, budgets, and other financial data through natural language commands.MIT