Commit Graph

24 Commits

Author SHA1 Message Date
Ben
a229537599 fix: add graceful error handling for get_budgets API errors
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
Returns informative error message when Monarch Money API fails,
which may occur if budgets are not configured in the account.
2025-12-25 04:20:39 +00:00
Ben
4a309cbfb3 fix: update get_budgets to match actual monarchmoney API response structure
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 17s
The monarchmoney library's get_budgets() returns budgetData.monthlyAmountsByCategory
and categoryGroups, not a simple 'budgets' array. Updated parsing to correctly
extract budget data by category with monthly planned/actual/remaining amounts.
2025-12-25 04:17:48 +00:00
Ben
88bf8a60d5 fix: improve input validation, error logging, and env var handling
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 30s
- Add validate_account_id() for get_account_holdings input validation
- Fix double logging bug in retry_on_auth_error decorator
- Remove emojis from log messages for cleaner log parsing
- Make PORT and LOG_LEVEL environment variables functional
- Delete redundant requirements.txt (pyproject.toml is authoritative)
- Clarify MONARCH_PORT is for Docker Compose only in .env.example
2025-12-25 04:11:03 +00:00
Ben
e462c31907 fix: remove try-except blocks from MCP tools to allow auth-retry decorator to work
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
2025-12-24 21:48:34 +00:00
Ben
1e8d484389 fix: copy src directory before pip install
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
Dockerfile was failing because we tried to install in editable mode
before copying the src directory. Copy src/ first so that uv can
find the package structure properly.
2025-12-24 21:42:24 +00:00
Ben
1d2bf199e1 fix: update Dockerfile to use pyproject.toml for dependencies
Some checks failed
Build and Push Monarch MCP Docker Image / build (push) Failing after 10s
Change from requirements.txt to pyproject.toml as source of truth for
dependencies. This ensures pyotp is properly installed in the Docker image
when built. Using 'uv pip install -e .' will install the package
with all dependencies from pyproject.toml.
2025-12-24 21:41:04 +00:00
Ben
6fc09d956f feat: add automatic re-authentication with MFA support
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
Implement automatic token refresh using stored credentials and TOTP MFA secret. When an API call fails with a 401/unauthorized error, the system now transparently re-authenticates using MONARCH_EMAIL, MONARCH_PASSWORD, and MONARCH_MFA_SECRET, then retries the original request.

Changes:
- Add refresh_authentication() function in auth.py for credential-based login
- Create @retry_on_auth_error decorator to handle and retry failed auth calls
- Apply decorator to all MCP tools (get_accounts, get_transactions, etc.)
- Add MONARCH_MFA_SECRET to .env.example with documentation
- Update login_setup.py to instruct users about required env vars
- Replace PROBLEM.md with PLAN.md documenting the implementation
2025-12-24 15:45:43 +00:00
Ben
27ef7f0e1e fix: add optional reason parameter to all tools for MCP compatibility
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 10s
2025-12-24 05:20:30 +00:00
Ben
1210cbf6d2 fix: use correct Starlette mount pattern for MCP SSE routing
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
The previous implementation added health route directly to mcp_app and
returned it, which broke MCP's internal /mcp endpoint routing.

Now matches the working pattern from komodo-mcp-custom:
- Mount mcp_app at / inside a parent Starlette app
- Pass lifespan=mcp_app.lifespan for proper task group init
- Health check is a separate route in the parent app
2025-12-24 05:10:32 +00:00
Ben
65c79efc60 refactor: use simplified FastMCP app pattern with health check
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
2025-12-24 05:03:05 +00:00
Ben
92fa2c3f11 refactor: mount FastMCP app at root and retain /health for compatibility
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 04:56:33 +00:00
Ben
ebb571a7a6 refactor: mount FastMCP app at /mcp and re-add /health to root for compatibility
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
2025-12-24 04:55:05 +00:00
Ben
df492c8bb4 refactor: simplify ASGI app setup by mounting FastMCP app at root
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 04:52:24 +00:00
Ben
8fc4312685 refactor: mount FastMCP app at / and remove health_check from root to avoid overlap
Some checks failed
Build and Push Monarch MCP Docker Image / build (push) Has been cancelled
2025-12-24 04:52:17 +00:00
Ben
748cc5c711 fix: mount FastMCP app at /mcp to correctly route SSE traffic
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 04:50:48 +00:00
Ben
75ba3433e8 refactor: use FastMCP.http_app() for robust SSE and health check support
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 04:48:18 +00:00
Ben
177832053f fix: refactor handle_sse to standard ASGI to avoid Starlette TypeError
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
2025-12-24 04:43:06 +00:00
Ben
776b4b8cc8 fix: use correct underlying server attribute for SSE handling in FastMCP
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 9s
2025-12-24 04:41:06 +00:00
Ben
f5a5bb3fc4 fix: use correct internal lifespan attribute for FastMCP
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
2025-12-24 02:09:53 +00:00
Ben
14db8e67b3 fix: add missing fastmcp dependency
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
2025-12-24 02:09:01 +00:00
Ben
8ca4eae736 docs: add MONARCH_PORT to .env.example
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 02:05:13 +00:00
Ben
f17e485612 Refactor SSE endpoints to /mcp and fix library type errors
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 7s
2025-12-24 01:57:38 +00:00
Ben
7444fb9229 Add .gitignore and remove .env from tracking 2025-12-24 01:54:51 +00:00
Ben
714897276b Initial commit: Monarch MCP Custom SSE server 2025-12-24 01:54:42 +00:00