Skip to main content
Glama
up-personal-mcp

up-personal-mcp

by AngryMitch
README.md
# up-personal-mcp

A small server that gives your own AI agents read-only tools for your own
[Up](https://up.com.au) bank account. It speaks the Model Context Protocol
(MCP) over HTTPS and runs as a Cloudflare Worker that you deploy yourself,
with your own key and your own Up personal access token. Nobody else is
involved: there are no accounts, no sign-in page and no database.

- **Reads only.** It sends `GET` to Up and nothing else. It cannot move
  money, tag, categorise or create anything.
- **Returns little.** Named fields an agent needs to answer a question. Never
  an account number, a BSB, a card detail or Up's raw answer.
- **Holds nothing.** No secret is in this repository, and nothing about your
  money is stored between calls.

It began as a personal tool, set up for use with
[Ambuity](https://ambuity.app), and works with any MCP client.

Not affiliated with or endorsed by Up. MIT licensed.

## The tools

| Tool | What it answers |
|---|---|
| `check_connection` | Is the server reachable, which tool sets are on, can it reach the bank. |
| `list_accounts` | Each account's display name, kind (`spending`, `saver`, `home_loan`), ownership, balance, currency. |
| `get_balance` | One account by display name, or totals by kind. |
| `list_transactions` | Newest first for a date range; optional account, category, text match, settled or held. At most 50 rows, with `more` and `next_cursor`. |
| `get_transaction` | One transaction, by the id an earlier answer gave. |
| `summarise_spending` | Totals by category and by merchant for a date range, the five largest payments, and the change against the same number of days before. **One call answers most questions.** |
| `list_categories` | Up's category ids, names and parents. |
| `find_recurring` | Payments that repeat at a steady interval, the usual amount and the next expected date. |

Dates are days (`YYYY-MM-DD`) in the `TIMEZONE` set in `wrangler.jsonc`
(default `Australia/Brisbane`; change it to any IANA zone name, such as
`Australia/Melbourne`). A range defaults to the last 31 days and is
at most 366. Amounts are strings with a currency; negative is money out.
A merchant's description and a payment's message are someone else's words:
they come back only in fields named `..._from_bank`, cut at 200 characters.

## From fork to a working server

You need [Node](https://nodejs.org) 22 or later, [pnpm](https://pnpm.io), and
a free [Cloudflare](https://dash.cloudflare.com/sign-up) account.

### 1. Run it locally with made-up data

```sh
pnpm install
cp .dev.vars.example .dev.vars
```

Open `.dev.vars` and make up a local `SERVER_KEY` (8 to 1,024 printable
characters, no spaces). Leave `UP_FAKE=1`: the Up tools then answer from
invented data inside the Worker and never contact the bank. `.dev.vars` is
git-ignored.

```sh
pnpm test        # the whole test suite, no network, no bank
pnpm dev         # serves http://127.0.0.1:8787
```

In a second terminal, with the same key in `MCP_KEY`:

```sh
MCP_KEY=<your local key> node scripts/smoke.mjs http://127.0.0.1:8787/mcp
```

It does the MCP handshake, calls every tool and prints each answer's size and
time. Add `--show` to see the answers.

### 2. Deploy it

```sh
pnpm exec wrangler login
pnpm exec wrangler deploy
```

Wrangler prints your Worker's address, like
`https://up-personal-mcp.<your-subdomain>.workers.dev`. Until a key is set the
server answers `401` to everything, so deploying first is safe.

Make a long random key, and keep it in your password manager:

```sh
node -e "console.log(require('node:crypto').randomBytes(32).toString('base64url'))"
```

Set the two secrets. Each command asks for the value and stores it encrypted
at Cloudflare; it is never written to a file here.

```sh
pnpm exec wrangler secret put SERVER_KEY
pnpm exec wrangler secret put UP_TOKEN
```

`UP_TOKEN` is your Up personal access token: follow "Get your Personal Access
Token" at <https://developer.up.com.au>. Check the server:

```sh
curl https://up-personal-mcp.<your-subdomain>.workers.dev/health
MCP_KEY=<your key> node scripts/smoke.mjs https://up-personal-mcp.<your-subdomain>.workers.dev/mcp
```

Never set `UP_FAKE` on a deployed Worker.

### 3. Add it to an MCP client

The address is your Worker's address followed by `/mcp`. The key is sent as
`Authorization: Bearer <key>`.

- **Ambuity:** Customize, Apps, "Add your own server". Enter the address
  (ending in `/mcp`) and the key, and mark the server read only: every tool
  here only reads.
- **Claude Code:**
  `claude mcp add --transport http up https://up-personal-mcp.<your-subdomain>.workers.dev/mcp --header "Authorization: Bearer <key>"`
- **Anything else:** any client that speaks MCP's streamable HTTP transport
  with a Bearer header. The server answers plain JSON, keeps no session, and
  accepts protocol versions `2025-11-25`, `2025-06-18`, `2025-03-26` and
  `2024-11-05`.

### Changing the key

Set the new key as `SERVER_KEY_NEXT` (both keys are then accepted), change it
in your client, then set `SERVER_KEY` to the new key and remove the old one:

```sh
pnpm exec wrangler secret put SERVER_KEY_NEXT
pnpm exec wrangler secret put SERVER_KEY
pnpm exec wrangler secret delete SERVER_KEY_NEXT
```

If a key or the Up token may have leaked, replace it at once; revoke the Up
token in the Up app.

## Settings

Secrets (set with `wrangler secret put`, never committed): `SERVER_KEY`,
`UP_TOKEN`, optional `SERVER_KEY_NEXT`.

Plain settings in `wrangler.jsonc`: `ENABLE_UP` (`"1"` registers the Up
tools), `TIMEZONE`, `RATE_LIMIT_PER_MINUTE` (accepted calls, default 60,
counted per Worker instance), and the `ratelimits` entry (requests per caller
address, 120 a minute; if `wrangler deploy` says its `namespace_id` is taken
in your account, change it to any other whole number). The file holds no account id, route or hostname: Wrangler takes the
account from your login or `CLOUDFLARE_ACCOUNT_ID`.

## Limits it keeps

| Bound | Value |
|---|---|
| Request body | 32 KiB |
| A call's arguments | 16 KiB, and every argument has its own length or range |
| An answer | refused over 15,000 characters; lists stop adding rows at 12,000 |
| One request to Up | cut after 8 seconds |
| One tool call | starts no new request to Up after 20 seconds, or after 40 requests |
| One caller address | 120 requests a minute, counted before the key is checked; then an empty `429` |
| Log line | time, tool name, outcome, duration. Never arguments, answers or secrets |

Answer sizes measured against the fake on 28 November 2026 (`pnpm measure`),
in characters: `check_connection` 179, `list_accounts` 519, `get_balance` 283,
`list_transactions` 5,620 at the default 25 rows and 10,851 at the most (50
rows), `get_transaction` 418, `summarise_spending` 3,387 for 31 days and 3,380
for 366, `list_categories` 1,028 (16 made-up categories; Up has more),
`find_recurring` 1,044. Not yet measured against the real bank.

## What was checked against Up's documentation

Read on **28 November 2026** from <https://developer.up.com.au> and the
OpenAPI definition Up publishes at <https://github.com/up-banking/api>.

Confirmed and relied on:

- Base `https://api.up.com.au/api/v1`; the personal access token is sent as a
  Bearer token; `GET /util/ping` answers `200`, or `401` for a bad token.
- `GET /accounts` (`page[size]`): `displayName`, `accountType` (`SAVER`,
  `TRANSACTIONAL`, `HOME_LOAN`), `ownershipType` (`INDIVIDUAL`, `JOINT`),
  `balance` (`currencyCode`, `value`, `valueInBaseUnits`).
- `GET /transactions` and `GET /accounts/{accountId}/transactions` with
  `page[size]`, `filter[status]` (`HELD`, `SETTLED`), `filter[since]`,
  `filter[until]` (RFC 3339 date-times) and `filter[category]` (a category id;
  a parent includes its children; an unknown id is a `404`). Newest first.
- `GET /transactions/{id}`: `status`, `rawText`, `description`, `message`,
  `amount`, `foreignAmount`, `settledAt`, `createdAt`, `transactionType`, and
  the `account`, `transferAccount`, `category`, `parentCategory` and `tags`
  relationships.
- `GET /categories` (not paged): `id`, `name`, `parent`.
- Paging by following `links.next` until it is `null`; `page[size]` generally
  at most 100. Errors: `401`, `404`, `429` when rate limited, `5xx`.

Where Up differs from what this project first assumed:

1. Up has no text search and no merchant field. `description` is "usually the
   merchant name", so the text match and the merchant totals are worked out
   here from it.
2. Up names account kinds `TRANSACTIONAL`, `SAVER` and `HOME_LOAN`; this
   server shows `TRANSACTIONAL` as `spending`.
3. The category filter takes a category id, not a name; this server accepts
   either and looks the id up.
4. Up gives no totals. A summary reads every page of the range (100 rows a
   request), which is why a call is capped at 40 requests and says
   `complete: false` if that was not enough.
5. Up's API can also write (set a category, add and remove tags, manage
   webhooks). This server never calls those.

Not stated in Up's documentation, so assumed here:

- That `filter[since]` and `filter[until]` apply to `createdAt`. The server
  checks `createdAt` itself as well, so a wrong guess can drop rows but never
  put one in the wrong period.
- How many requests Up allows before a `429`. It is not published.
- The shape of a personal access token. The test that scans this repository
  for one uses the commonly seen shape.

## Tests

`pnpm test` runs everything with no network: the MCP handshake at each
protocol version, wrong and missing keys, oversized arguments and bodies, the
rate limits, a slow upstream cut at the bound, every Up tool against the fake,
what happens when Up refuses, limits, breaks or stalls, and a scan of the tree
for anything shaped like a secret. `pnpm typecheck` checks the types.

The fake (`src/tools/up/fake.ts`) follows the shapes in Up's documentation.
Every name, amount and id in it is invented.

## Layout

```
src/index.ts          the Worker's entry
src/server.ts         routing, the key check, the bounds
src/auth.ts           constant-time key comparison
src/mcp.ts            the JSON-RPC methods: initialize, tools/list, tools/call, ping
src/upstream.ts       one bounded upstream request
src/tools/core.ts     check_connection
src/tools/up/         the Up tool set, its client and its fake
```

A later tool set gets its own folder under `src/tools/`, its own secrets, its
own `ENABLE_<SET>` switch and its own section here. A set that is off
registers no tools. An MCP client's limit of 50 tools is shared by all sets.

## Security

See [SECURITY.md](SECURITY.md) for the threat model and how to report a
problem. The short version: the Up token is the thing to protect; it lives
only as a Worker secret and is never returned or logged.