feat(mcp): add practical financial CRUD tools
KR
11d ago+3762+3762+0123456789012345678901234567890123456789-1299-1299-0123456789012345678901234567890123456789
Summary
- add practical MCP CRUD for transactions, manual accounts, transfers, goals, categories, and tags
- expose account types and valid subtype values for reliable account creation
- keep destructive MCP-only tools out of Sure's builtin assistant registry
- return stable IDs and writable/permission metadata for safe multi-step agent workflows
- make transaction and transfer creation retry-safe with caller-provided idempotency keys and conflict detection
Safety model
- every tool is scoped to the authenticated user's family
- financial writes resolve only accounts writable by that user and recheck permissions while holding row locks where needed
- taxonomy and goal references are family-scoped
- transaction and transfer retries return the existing record only when the canonical request fingerprint matches
- preview tools remain user-scoped and cannot be invoked by guessing a hidden tool name
- destructive operations use Sure's existing soft-deletion lifecycle where the underlying model supports it
Scope
This PR is intentionally limited to the MCP CRUD contract. It does not include the unrelated accounting, sharing, REST API authorization, or self-hosting changes carried by the downstream fork, and it keeps upstream's current update_budget implementation unchanged.
Verification
- Docker image build
bundle exec rubocop— no offensesbundle exec brakeman --no-pager --quiet— no warnings
Discussion
https://github.com/we-promise/sure/discussions/3026
Summary by CodeRabbit
- New Features
- Added assistant tools to create, view, update, and delete accounts, goals, tags, transactions, and transfers.
- Added account-type discovery and more detailed account and goal-funding information.
- Added stable-ID goal funding and idempotent transaction and transfer creation.
- Expanded transfer editing, including amounts, dates, notes, and exchange rates.
- Improvements
- Improved permission checks and safeguards for financial changes, account linking, and record deletion.
- Updated MCP hosting documentation with available tools and their behavior.