Commit Graph

2 Commits

Author SHA1 Message Date
Víctor Falcón fcf5e6e46f refactor(mcp): address review feedback
- Keep PR1 strictly read-only: drop the scope selector, the read_write
  request rule and mcp:write granting from the UI/controller (the write scope
  returns with the write tools in PR2). Removes a token that could be minted
  over-privileged with a false "can edit data" UI promise.
- Gate via User::canUseFeature(PlanFeature::McpAccess) instead of hasProPlan()
  directly, matching the existing feature-gating convention.
- Confirm token rotation behind an AlertDialog (it breaks connected clients),
  matching revoke; drop the silent on-load clipboard auto-copy.
- Give the data-egress disclaimer a destructive variant for visual weight.
- Extract the duplicated token-ownership check; document the controller-reuse
  coupling and the shared-tenant space-scoping model; fix ListSpaces N+1 and a
  duplicate output key.
2026-07-17 15:32:10 +02:00
Víctor Falcón 14ab73dcfb feat(mcp): add read-only MCP server for Pro accounts
Expose a remote (streamable HTTP) MCP server so users can connect Whisper
Money to their own AI assistant (Claude web/desktop, Claude Code, ChatGPT)
to analyse their finances.

- Auth via Sanctum personal access tokens with MCP-only abilities
  (mcp:read / mcp:write); tokens are created, rotated and revoked from a new
  Settings -> MCP access page, with per-client connection instructions and a
  one-time secret reveal.
- Read tools: search_transactions, spending_by_category, get_cashflow,
  get_net_worth, list_accounts, list_categories, list_spaces. Transaction and
  listing tools are space-scoped (optional space arg, defaults to personal);
  the analytics tools reuse the existing user-scoped services/controllers.
- Pro-plan gating is enforced per request inside the tools, so a lapsed
  subscription stops working without the user revoking the token. Free users
  can still create tokens (marked PRO in the UI).

Write tools are intentionally out of scope for this PR (follow-up).
2026-07-17 15:17:40 +02:00