Mintage
by navedr
README.md
# Mintage
Mintage is a self-hosted, read-only server that gives Claude access to your own bank, card and investment data. It pulls data from Plaid, stores it in a local SQLite database, and exposes it over MCP (the Model Context Protocol). It is built for a single user: one GitHub account is allowed in, and nobody else can sign in. It works as a custom connector in claude.ai and as an MCP server in Claude Code. Linked banks show their logos, taken from Plaid institution metadata.
## Safety model
- **Read-only.** Every MCP tool only reads. Nothing can move money, initiate payments or change anything at your bank.
- **Free Plaid endpoints only.** All Plaid traffic goes through one module that checks every call against an allowlist of 10 endpoints: `/link/token/create`, `/item/public_token/exchange`, `/transactions/sync`, `/accounts/get`, `/item/get`, `/webhook_verification_key/get`, `/item/remove`, `/institutions/get_by_id`, `/investments/holdings/get` and `/investments/transactions/get`. The endpoints that are billed per request on paid plans, `/transactions/refresh`, `/accounts/balance/get` and `/investments/refresh`, are never called.
- **Tokens encrypted at rest.** Plaid access tokens are encrypted with Fernet (`TOKEN_ENCRYPTION_KEY`) before they are written to the database.
- **One person.** Sign-in is GitHub OAuth, restricted to a single numeric GitHub user ID (`ALLOWED_GITHUB_USER_ID`).
- **Admin hardening.** The admin UI uses a session cookie plus CSRF protection. Plaid webhook signatures are verified before a webhook is acted on.
- **What is stored where.** Everything lives in `DATA_DIR` (`./data` in the compose example): accounts, balances, transactions, holdings and investment transactions, plus the encrypted Plaid tokens. Bank credentials never reach Mintage; they are entered only in Plaid Link. Secrets live in your `.env`.
## Plaid Trial plan: read this first
Plaid's Trial plan is free but strictly limited. It is available to US and Canada teams created on or after 2026-04-15.
- You get **10 Items for the lifetime of the account**. An Item is one linked bank login.
- **Removing an Item does not free its slot.**
- When a bank connection breaks, always use **Fix connection** (Plaid update mode) in the admin UI. Re-adding the bank as a new Item burns a slot.
- Test everything in **Sandbox** first (`PLAID_ENV=sandbox`).
- Link production banks **one at a time**, and check the result before adding the next.
Investments is an optional product. You choose whether to include it when you link a bank.
## Setup
1. **Plaid.** Create an account at <https://dashboard.plaid.com>, apply for the Trial plan, and copy your client ID and the sandbox or production secret.
2. **GitHub OAuth App.** Go to <https://github.com/settings/developers> and choose New OAuth App. Set Homepage URL to your `BASE_URL`. Add **two redirect URIs**: `BASE_URL/auth/callback` (Claude sign-in) and `BASE_URL/admin/callback` (admin sign-in). Leave wildcard matching and Device Flow off; "Expire user access tokens" can stay on. (Older single-callback forms: use `BASE_URL/`, which covers both paths.)
3. **Your numeric GitHub ID.** Run `gh api users/<you> --jq .id`.
4. **Generate keys.** Use the two commands in `.env.example` to create `TOKEN_ENCRYPTION_KEY` (a Fernet key) and `JWT_SIGNING_KEY`.
5. **Deploy.** Copy `deploy/docker-compose.example.yml` to `docker-compose.yml`, set the image owner, and copy `.env.example` to `.env` and fill it in. Then create the data directory with the right owner **before the first start**: `mkdir -p data && sudo chown 1000:1000 data && chmod 700 data`. The container runs as user 1000 with a read-only root filesystem, so if `./data` does not exist Docker creates it owned by root and Mintage cannot create its database (`chmod 700` is advisable because the directory holds encrypted tokens). Finally run `docker compose up -d`.
6. **HTTPS.** Put a TLS reverse proxy or tunnel (Cloudflare Tunnel, Caddy, and so on) in front of the published port. Do not put an interactive SSO wall (for example a Cloudflare Access login page) in front of it: Claude's connector cannot get through one.
The container's port is published on `127.0.0.1` only. The compose file sets `FORWARDED_ALLOW_IPS: "*"` so the app honours `X-Forwarded-*` headers from your proxy. That is safe only because nothing but the host can reach the port. If you change the port binding, change that setting too.
## Link banks
Open `BASE_URL/admin` (visiting the bare host `BASE_URL/` redirects there), sign in with GitHub, and choose **Add bank**. Complete Plaid Link and tick Investments if the institution holds brokerage accounts you want included. Data syncs right after linking and then on a schedule and on Plaid webhooks.
## Connect Claude
- **claude.ai:** Settings, Connectors, Add custom connector. Use the URL `BASE_URL/mcp`, sign in with GitHub, and approve the consent screen.
- **Claude Code:** `claude mcp add --transport http mintage BASE_URL/mcp`
## Tools
| Tool | What it does |
| --- | --- |
| `list_accounts` | Linked bank, card and investment accounts with balances. |
| `search_transactions` | Search transactions by date, text, merchant, category, amount and direction, with paging. |
| `spending_summary` | Spending (or income) over a period grouped by category, merchant, month or account, following your spending rules. |
| `connection_status` | Health of each linked bank, data age, and what to do if a connection needs attention. |
| `portfolio_holdings` | Current holdings with quantity, price, market value, cost basis, unrealized gain and weight, grouped by security, account or type. |
| `investment_activity` | Buys, sells, dividends, fees and transfers, filterable by type and ticker, with paging. |
**Sign convention.** Transaction amounts are signed from your point of view: money coming in is positive (`+120.00`), money going out is negative (`-45.30`). Totals in `spending_summary` and holdings values are reported as positive amounts.
**Spending rules.** What counts as spending or income is configured in the admin UI on the Spending rules page (`/admin/settings`), not hardcoded: which categories count as spending or income, whether refunds are netted against spending, and description phrases that are never or always counted. The rules in effect are echoed back in each summary as `rules_applied`, and a caller can pass `ignore_spending_rules=true` to count every transaction in the chosen direction.
## Operations
- **Backups.** Back up the whole `./data` directory and your `TOKEN_ENCRYPTION_KEY`. Without the key, the stored Plaid tokens cannot be decrypted.
- **Rotating keys.** Rotating `TOKEN_ENCRYPTION_KEY` makes stored tokens unreadable, so every bank must be re-linked (and on the Trial plan that costs Items). Rotating `JWT_SIGNING_KEY` simply signs Claude out; reconnect the connector.
- **Logs.** The server writes JSON log lines to stdout: `docker compose logs -f mintage`.
- **Sync schedule.** `SYNC_INTERVAL_HOURS` sets the hours between scheduled syncs (default 6, `0` disables the scheduler). Webhooks trigger syncs in between.
- **Database.** By default Mintage uses SQLite in `DATA_DIR`. `DATABASE_URL` is optional and Postgres-ready, but the driver is not bundled: install it yourself (for example `pip install "psycopg[binary]"`) and set `DATABASE_URL=postgresql+psycopg://user:password@host:5432/mintage`.
- **Proxy headers.** `FORWARDED_ALLOW_IPS` (default `127.0.0.1`) lists the peer IPs whose `X-Forwarded-*` headers are trusted. Behind Docker's published port, requests arrive from the bridge gateway, so the compose example sets `"*"`, which is safe only while the port is published on `127.0.0.1`.
## Development
```bash
python3.12 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
pytest # offline tests
pytest -m sandbox # real Plaid Sandbox; needs PLAID_SANDBOX_CLIENT_ID and PLAID_SANDBOX_SECRET
ruff check src tests
```
The admin UI is in `web/` (Vite and React):
```bash
cd web
npm install
npm run dev # proxies /admin/api to localhost:8000
npx vitest run
npm run build # outputs to src/mintage/web_dist, served at /admin
```
Build the image with `docker build -t mintage:dev .`. CI (`.github/workflows/ci.yml`) runs lint, tests and the web build, and publishes the image to GHCR from `main` and version tags.
## License
MIT. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues