Skip to main content
Glama
uiux-me

upbank-mcp

by uiux-me

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 的个人访问令牌。令牌形如 up:yeah:…

Docker

Docker Engine 20.10+ 及 Compose v2(docker compose,而非 docker-compose)。

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

变量

默认值

描述

UP_API_TOKEN

(必填)

个人访问令牌。服务器读取凭据的唯一变量。Compose 没有它则拒绝启动;直接运行时,服务器会启动并在第一次工具调用时失败。

UP_API_BASE

https://api.up.com.au/api/v1

API 基础 URL。仅用于针对 mock 进行测试时覆盖。

MCP_TRANSPORT

stdio

本地 MCP 客户端使用 stdio,网络可寻址服务器使用 http。Compose 设置为 http

MCP_HOST

0.0.0.0

HTTP 传输的绑定地址,在容器内部。

MCP_PORT

8000

HTTP 传输的监听端口,在容器内部。

MCP_HOST_PORT

8000

仅限 Compose。 发布在 127.0.0.1 上的主机端口。如果 8000 已被占用,请更改此项。


运行服务器

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:latest

Claude 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;参见 分页

工具

工具

参数

返回

ping

{ok, id, status_emoji}。验证令牌和 API 可达性。

账户

工具

参数

返回

list_accounts

account_typeSAVER | TRANSACTIONAL | HOME_LOAN)、ownership_typeINDIVIDUAL | JOINT)、page_size(1–100,默认 30)、cursor

带余额的账户页。

get_account

account_id

单个账户。

交易

工具

参数

返回

list_transactions

account_idstatusHELD | SETTLED)、sinceuntilcategorytagpage_size(1–100,默认 30)、cursor

交易页,最新的在前。省略 account_id 可跨所有账户搜索。

get_transaction

transaction_id

单笔交易,包括 hold、round-up 和 cashback 详情。

sinceuntil 以闭区间约束 createdAtcategory 接受父 id,该 id 会匹配其所有子类别。

类别

工具

参数

返回

list_categories

parent

类别树,或某个父类别的子类别。不分页。

get_category

category_id

单个类别及其父、子 id。

categorize_transaction

transaction_idcategory_id

设置类别,当 category_id 为 null 时清除类别。

类别由 Up 固定,无法创建。Id 是诸如 restaurants-and-cafes 的 slug。只有 is_categorizable: true 的交易才能被更改,并且只接受叶子类别——传递诸如 good-life 的父类别会返回 HTTP 403。

标签

工具

参数

返回

list_tags

page_size(1–100,默认 50)、cursor

标签页。标签的 id 即其标签名。

add_tags_to_transaction

transaction_idtags(列表)

添加标签,创建任何不存在的标签。

remove_tags_from_transaction

transaction_idtags(列表)

从交易中移除标签。

一笔交易最多持有 6 个标签。没有剩余交易的标签会从 list_tags 中消失。

附件

工具

参数

返回

list_attachments

page_size(1–100,默认 30)、cursor

附件页。

get_attachment

attachment_id

单个附件。

file_url 是一个签名 URL,在 file_url_expires_at 时过期。请及时获取,或重新请求附件。

Webhook

工具

参数

返回

list_webhooks

page_size(1–100,默认 30)、cursor

Webhook 页。

get_webhook

webhook_id

单个 Webhook。

create_webhook

urldescription(≤64 字符)

新的 Webhook,包括 secret_key

delete_webhook

webhook_id

{ok, deleted}。永久删除。

ping_webhook

webhook_id

发送测试 PING 事件。

list_webhook_logs

webhook_idpage_size(1–100,默认 30)、cursor

最近的投递尝试,包含响应代码和响应体。

secret_key 在创建时返回,之后不再返回。请存储它,以验证传入投递上的 X-Up-Authenticity-Signature 头(SHA-256 HMAC)。


资源

URI

内容

up://accounts

每个账户及其当前余额,作为单个 JSON 快照。

up://categories

完整的类别树,用于解析有效的 category 筛选值。

两者均按需读取,反映读取时的状态。


响应约定

形状

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_amounthold_inforound_upcashbackcard_purchase_methodnotemessage 等字段仅在交易具有它们时出现。

金额

每个金额都是一个对象:

{ "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 主机进行验证,因此 游标无法将客户端重定向到其他服务器。

日期

sinceuntil 接受 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。 令牌不会自行过期。


故障排除

症状

原因与修复

No Up API token configured

UP_API_TOKEN 未设置或为空。检查 .env,并确保 Compose 是从项目目录运行的。

Compose 以 set UP_API_TOKEN in .env 退出

原因相同,发生在容器启动时而非首次调用时。

Bind for 127.0.0.1:8000 failed: port is already allocated

另一个进程占用了 8000 端口。在 .env 中设置 MCP_HOST_PORT

HTTP 401 — Unauthorized

令牌无效或已被吊销。请重新签发。

HTTP 403 — Top-level categories cannot be set…

categorize_transaction 被传入了父类别。请使用 list_categories 中的叶子类别 ID。

HTTP 404 但 ID 看起来有效

ID 是按客户区分的。请确认该 ID 来自此令牌自己的数据。

反复出现 HTTP 429

持续触发速率限制。减小 page_size 并降低请求频率;重试已是自动的。

客户端不显示任何工具

客户端必须使用 -i 运行容器。没有它,stdio 会立即关闭。


参考

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    D
    quality
    D
    maintenance
    A 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.
    2
    32
  • A
    license
    Not graded
    quality
    D
    maintenance
    An 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.
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A 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.
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A 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

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • A Model Context Protocol server for Wix AI tools

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/uiux-me/upbank-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server