Commit Graph

18 Commits

Author SHA1 Message Date
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