Skip to main content
Glama
enable-banking-mcp

enable-banking-mcp

README.md
# enable-banking-mcp

Let an AI agent (Claude Code, Codex, any MCP client) **read** your bank accounts and help
you analyse your spending, without ever being able to move money.

It connects to your bank through [Enable Banking](https://enablebanking.com/) (PSD2 open
banking, free for your own accounts in *linked accounts* mode), keeps a growing local
history in SQLite (banks only return 90 days), and exposes it through a read-only
[MCP](https://modelcontextprotocol.io/) server.

![How enable-banking-mcp works: read-only PSD2 bank sync into a growing local SQLite database exposed through a read-only MCP server](docs/architecture.svg)

- **Read-only by design**: the consent only covers reading, and the MCP server only holds a
  GET-only HTTP client (enforced by tests). There is no payment code at all.
- **Local**: keys, history and session stay on your machine, readable by you only.
- **History that grows**: each sync merges what the bank returns, so the history extends past
  the bank's 90-day window. Pending transactions are replaced once booked.
- **Categories** from simple, editable rules; monthly income / spending views.
- **Optional payslips** (French *bulletins de paie*): amounts checked to the cent, matched
  against the salary credit on your account.
- Label parsing tuned for **LCL** (France); other banks use Enable Banking's structured fields.

## Set it up with an agent

Clone the repository, open it in Claude Code or Codex, and ask:

> Set up this repository for me, following AGENTS.md.

The agent installs everything, tells you the few steps that need your browser (creating the
Enable Banking application, logging in to your bank), and checks each one. The steps below
are the same, by hand.

## Set it up by hand

Requirements: macOS or Linux, [uv](https://docs.astral.sh/uv/) (it installs Python 3.11+),
`make`, and an account at a bank supported by Enable Banking.

```sh
git clone <this repository> enable-banking && cd enable-banking
make install
```

### 1. Create the Enable Banking application (once)

1. Sign up at <https://enablebanking.com/sign-in/> (login link by email).
2. In the Control Panel → **Applications** → new application:
   - environment **Production** (or **Sandbox** to try with a fake bank first);
   - redirect URL `https://localhost:8443/callback` (the page does not need to exist: you
     will only copy its address);
   - let the browser generate the key: it downloads `<APP_ID>.pem`.
3. Move the key into the repository: `mkdir -p keys && mv ~/Downloads/<APP_ID>.pem keys/`.
4. Production only: on the application page, **Activate by linking accounts**, log in to your
   bank and link your account(s). The application becomes active in restricted mode, which
   only sees the accounts you linked.

### 2. Connect your bank

```sh
make setup                          # registers keys/<APP_ID>.pem (KEY=… if you have several)
make banks COUNTRY=FR               # find your bank's exact name
make login BANK="LCL" COUNTRY=FR    # opens your bank's page, then paste the redirect address
```

After logging in, the browser lands on `https://localhost:8443/callback?code=…`. The page
does not load: copy the full address from the address bar and paste it in the terminal. The
first sync runs right after. With a Sandbox application, use `make login-sandbox` instead.

### 3. Plug it into your agent

```sh
make mcp                 # registers the server with Claude Code and/or Codex, for this folder
make mcp SCOPE=user      # Claude Code: available from any folder
```

Restart the agent, then ask things like *"How much did I spend on restaurants per month?"*
or *"Which subscriptions could I cancel?"*. For another MCP client, the stdio command is
`uv --directory /path/to/enable-banking run eb-mcp`.

### 4. Tune the categories

The first sync creates `data/categories.toml` from [the defaults](src/enable_banking_mcp/default_categories.toml).
Add a rule for transfers to your own other accounts (`internal = true`, so they are not
counted as spending) and one for your salary (`salary = true`), then:

```sh
uv run eb-db categorize    # recompute, and list what is still uncategorized
make report                # monthly salary, other income, spending, transfers to own accounts
```

## Keeping it up to date

| When | Command |
|---|---|
| Every week or so, **at least every 2 months** | `make sync` (a transaction that leaves the 90-day window unsynced is lost) |
| Every ~180 days, when the consent expires | `make login` |
| To stop | `make logout` (revokes the access at the bank) |

In Claude Code, `/resync` does it all: syncs if needed, imports new payslips, completes the
categories and summarises what changed.

## MCP tools

| Tool | Source | Use |
|---|---|---|
| `list_accounts` | local session | accounts and consent expiry |
| `get_balances` | bank | today's balances |
| `get_transactions` | bank | recent transactions (≤ 89 days), also saved locally |
| `get_saved_transactions` | local history | full history, filters by kind / text / dates, no quota |
| `query_finances` | local history | read-only SQL (SELECT only) |

Banks allow only ~4 unattended requests per day: the server caches bank answers for
15 minutes, and agents are told to prefer the local tools.

## Local data

Everything lives in `data/finances.db` (mode 600):

| Table / view | Content |
|---|---|
| `transactions` | deduplicated transactions: date, signed amount, kind, counterparty, category, raw bank answer |
| `balances`, `accounts`, `syncs` | balances at each sync, account details, last sync |
| `payslips` | payslip amounts: gross, contributions, net before tax, tax withheld, net paid… |
| `v_monthly`, `v_spending` | monthly summary, and spending per month and category |

`kind` is one of `card`, `direct_debit`, `transfer_in`, `transfer_out`, `loan`, `bank_fee`,
`other`. Run `uv run eb-db --help` for the database commands.

### Payslips (optional, French format)

`uv run eb-db add-payslip < payslip.json` stores a payslip only if its amounts add up
(gross − contributions + allowances − deductions = net paid = net before tax − tax), and
matches it with the salary credit on the account. Only amounts are stored. The `/resync`
skill reads the PDFs (from a Google Drive folder or `data/payslips/`) and extracts the
fields with [this guide](.claude/skills/resync/payslip-fields.md).

## Other banks

Enable Banking covers most European banks. The connection, sync and storage work with any
of them. Only the label parser (`src/enable_banking_mcp/labels.py`) is bank-specific: LCL
puts everything in a free-text label, which is decoded into kind, merchant, card date,
currency and FX fees. For other banks a generic parser uses the structured fields (creditor,
debtor, transaction code). To decode another bank's labels, add a parser to `_PARSERS`
with a test in `tests/test_labels.py`.

## Security

- **Three layers of read-only**: the consent given to the bank only covers reading; any
  payment would need a new approval by you at your bank; the MCP server only has a GET client.
- **Private files**: the key in `keys/`, the history in `data/`, the configuration and session
  in `~/.config/enable-banking-mcp/`, all mode 600 and gitignored. With the key and the session
  anyone can read your accounts: never publish them.
- Your bank credentials never go through this project: you type them on your bank's page.
- Transaction labels come from third parties: a transfer can carry misleading text. Agents
  are told to treat labels as data, but keep a critical eye.

## Development

```sh
make test                  # made-up data only
uv run eb-db sql "SELECT * FROM v_monthly"
```

Layout and conventions for contributors (human or agent) are in [AGENTS.md](AGENTS.md).

## License

[MIT](LICENSE). Not affiliated with Enable Banking or any bank.

TDQS

A3.9/5.0

Scored across 5 tools

Disambiguation4/5

The only real overlap is between get_transactions (live bank call, quota-limited) and get_saved_transactions (local history), but the descriptions explicitly frame the trade-off and tell the agent when to prefer each. list_accounts, get_balances and query_finances are cleanly distinct resource+action pairs. An agent can select correctly with the guidance given.

Naming Consistency5/5

Every tool follows a strict verb_noun snake_case pattern: list_accounts, get_balances, get_transactions, get_saved_transactions, query_finances. The modifiers (saved_, query_) are used predictably to signal the local-history vs live-bank distinction.

Tool Count4/5

Five tools is lean but proportionate to a read-only banking data surface: discovery, balances, live transactions, cached transactions, and ad-hoc SQL. Nothing is obviously redundant, though the surface is small enough that a couple of extra conveniences would not have hurt.

Completeness4/5

The read path is well covered, and query_finances with its documented schema (transactions, payslips, balances, syncs, views) gives a broad analysis escape hatch. Gaps are minor: there is no tool to trigger a history sync (it is pushed to a `make sync` CLI) and no consent/refresh management beyond reading the expiry date.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues