Copiloto Financeiro MCP Server
Enables AI agents to manage personal finances for Brazilian users through MCP tools, including categorizing transactions, reconciling debts, checking cash-flow projections, and adjusting budgets, with integration to Open Finance Brasil via Pluggy.
README
Copiloto Financeiro
π§π· Leia em portuguΓͺs
Self-hosted personal finance copilot, built for Brazil. Pulls bank transaction history daily from Pluggy (Open Finance Brasil), stores it in SQLite, and answers: how much am I spending, will I be able to meet upcoming costs, and if not, what do I need to adjust. Supports a whole household β each person keeps their own bank connection and data, and debts can be explicitly shared between people.
A Bun-workspace monorepo: backend/ is the Elysia server (API + auth + cron sync +
migrations), frontend/ is a Vite + React SPA, and shared/ holds the TypeScript types
for the wire format between them. See ARCHITECTURE.md for how it fits together and
backend/API-ARCHITECTURE.md for what belongs on which backend route. Contributing?
Read CONTRIBUTING.md first.
Philosophy
Built for a specific person: a Brazilian developer who already works with AI agents every day and wants to run their own (or their family's) finances the same way β spreadsheets stopped scaling, and a SaaS budgeting app you can't change to fit how your own money actually works isn't the answer either.
Built AI-agent-first, for Brazilians. Every domain operation this app has β
categorizing a transaction, reconciling a debt, checking next month's projection, adding
a category rule β exists as an MCP tool (backend/src/mcp-server.ts) before it exists as
a REST route with a form on top. Claude is the primary client this is built and tested
against today, but the tools speak plain MCP, so any agent that can hold an MCP
connection can drive the app the same way. The web UI isn't a second-class citizen β
it's the same operations, the same backend functions, just reached by clicking instead
of asking. And it's built on Open Finance Brasil
via Pluggy from day one, not a generic budgeting tool with a Brazilian bank integration
bolted on β that's the whole foundation, not a feature.
A few concrete principles that follow from that:
- Don't like what it's showing? Change it. This ships with only the basics of personal finance β accounts, categories, bills, debts, a cash-flow projection β and deliberately isn't opinionated beyond that. It's not trying to anticipate every household's workflow with a settings screen for each one (see the notification rules above: env var + a function you edit, not a rules-builder UI). If something doesn't match how your own money works, the expectation is you fork it and change the code, not file a feature request and wait.
- The backend is the source of truth for every number. Anything that looks like a
calculation β a debt payoff date, a category breakdown, a net-worth figure β is
computed once, on the server, and shipped to the frontend (and to an agent, via MCP)
as a finished value. Neither one re-derives it. This was violated a few times early on
(see
backend/API-ARCHITECTURE.md's fix log) and every time it caused the UI to quietly disagree with itself across pages β and it's exactly what keeps the MCP tools and the REST API from ever disagreeing about what a number means, since they call the exact same functions. - Real data over fixtures, when it matters. Pluggy's pagination and balance-sign quirks only ever surfaced when testing against a real bank connection β a hand-rolled fixture would have happily hidden the same bug. Automated tests still run against a real (if throwaway) SQLite database rather than a mocked ORM, for the same reason.
- Additive over rewritten. New features (household member profiles, shared debts, notification rules) were built as extensions of the existing model rather than a redesign β a shared debt is still one row, now with an optional pointer to who it's shared with, not a new subsystem.
- No more layers than the problem needs. The backend is routes + services, not routes + services + repositories β a third layer was considered and dropped because nothing in this codebase needed the extra indirection. Add structure when duplication or a real bug demands it, not in advance of one.
- Sized to be forked, not just used. No feature flags, no multi-tenant auth, no premature abstraction for hypothetical future users of this deployment β but the domain logic stays behind clean route/service boundaries specifically so someone running their own fork can change categorization rules, add a new resource, wire up a new MCP tool, or add a new notification provider without fighting the architecture to do it.
Setup
This app only reads from Pluggy β it doesn't handle connecting your bank accounts itself. Use meu-pluggy (Pluggy's own reference app, built on their Connect widget) to link each bank account and get the Item ID(s) you then paste in here per person.
- Copy
.env.exampleto.env. The only value you actually need to set isSESSION_SECRET(any long random string, e.g.openssl rand -hex 32) β everything else in there is optional:PLUGGY_CLIENT_ID/PLUGGY_CLIENT_SECRET/PLUGGY_ITEM_IDSare a one-time bootstrap only, for carrying over credentials from before household member profiles existed. Pluggy credentials normally live in the database now, entered per-person from/configafter setup β leave these blank for a fresh install.CRON_SCHEDULE(default0 6 * * *) β when the daily sync runs.MIN_BUFFER(default0) β balance floor below which a projected month is flagged as a shortfall.LARGE_TRANSACTION_THRESHOLD(default500) β notification rule: flag any newly synced transaction at or above this amount (BRL).PUSHOVER_APP_TOKEN/SMTP_HOST+ friends β only needed if you want push notifications; see "Notifications" below.PORT(default3000) /DB_PATH(default./data/budget.sqlite).
- Install dependencies (single lockfile, all three workspaces):
bun install - Run the dev servers:
bun run devruns backend + frontend together in one terminal (viaconcurrently). To run them separately in two terminals instead:bun run dev:backendβ backend on:3000with hot reload (also runs DB migrations on boot)bun run dev:frontendβ Vite dev server, proxies/apiand/publicto the backend
- Visit the Vite dev server URL's
/setupto create the admin account. Login is single-admin (one household, no signup). Once you're in, add each household member from/configβ name, color, and their own Pluggy Client ID/Secret/Item IDs β and roll everyone up in the/householdview.
Notifications
After every sync, a small set of rules (backend/src/services/notifications/rules.ts)
checks what changed β a transaction over LARGE_TRANSACTION_THRESHOLD, a projected
shortfall next month β and, the first time each one fires, creates a notification and
delivers it through whichever channels you've enabled for that person from /config:
- Pushover β set
PUSHOVER_APP_TOKEN(one app-level token for the whole deployment, from pushover.net), then each person adds their own Pushover user key from/config. - Email β set
SMTP_HOST/SMTP_PORT/SMTP_USER/SMTP_PASS/SMTP_FROM(one relay for the whole deployment), then each person adds their own destination address.
Both are tested from the same /config panel before you rely on them. Adding a new
provider or rule is a code change (see the doc comments in
backend/src/services/notifications/), not a UI-configurable system β this is meant to
be forked and adjusted, not built as a general-purpose rules engine nobody needed yet.
Development
bun run devβ both dev servers together in one terminal;bun run dev:backend/bun run dev:frontendβ the same two, separatelybun run buildβ build the frontend (Vite βfrontend/dist), served by the backend in productionbun run startβ run the backend from the repo root, serving the built frontendbun run typecheckβ type-check bothbackend/andfrontend/
The daily sync runs on CRON_SCHEDULE (default 0 6 * * *) and also once at startup if
the last successful sync is more than 24h old. You can also trigger it manually:
POST /api/sync/run (requires an authenticated session).
Deploying with Docker Compose (CasaOS)
docker compose up -d --build
This builds the image, runs migrations automatically on boot, and persists the SQLite
database at ./data/budget.sqlite via a bind-mounted volume. On CasaOS, point the
compose app / custom-install feature at this docker-compose.yml, and mount the volume
under /DATA/AppData/copiloto-financeiro per CasaOS convention (edit the volumes:
path in docker-compose.yml accordingly).
The container exposes port 3000 internally, mapped to 8080 on the host by default β
adjust in docker-compose.yml if that conflicts with something else on your CasaOS box.
Exposing it to the internet (Caddy + WireGuard + Oracle Cloud)
This app does not need its own DDoS/exposure hardening β it's designed to sit behind a reverse proxy you already run elsewhere (e.g. an Oracle Cloud box running Caddy, reached from your home server over WireGuard). It only needs a login (built in) and to bind to a port Caddy can reach. Example snippet for your existing Caddyfile:
copiloto.example.com {
reverse_proxy <wireguard-ip-of-this-box>:8080
}
Caddy handles TLS termination and sits in front of the app; the home box is never directly reachable from the internet. The app itself rate-limits the login endpoint as defense-in-depth on top of that.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.