Ben 6fc09d956f
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 8s
feat: add automatic re-authentication with MFA support
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

Monarch Money Custom MCP Server

A custom Model Context Protocol (MCP) server for Monarch Money, designed for Docker deployment with SSE (Server-Sent Events) support.

🚀 Setup

1. Obtain Authentication Token

Run the setup script locally to authenticate and generate a token:

python login_setup.py

Follow the prompts to log in. Once successful, copy the MONARCH_TOKEN printed in the terminal.

2. Configure Environment

Create a .env file based on .env.example and paste your token:

cp .env.example .env
# Edit .env and set MONARCH_TOKEN=your_token_here

3. Deploy with Docker

Start the server using Docker Compose:

docker-compose up -d

🔌 Connection

The server will be available at:

  • MCP Endpoint: http://localhost:8000/mcp
  • Health Check: http://localhost:8000/health

🛠️ Tools Included

  • get_accounts: View all financial accounts.
  • get_transactions: Fetch recent transactions with filtering.
  • get_budgets: View budget status.
  • get_account_holdings: Detailed investment holdings.
  • refresh_accounts: Trigger a refresh of account data.
Description
No description provided
Readme 1 MiB
Languages
Python 94.8%
Dockerfile 5.2%