monarch-mcp

monarch-mcp

MCP server that bridges Claude to Monarch Money for personal-finance analysis and lightweight edits.

Category
访问服务器

README

monarch-mcp

MCP server bridging Claude (Desktop, Code, or any MCP client) to Monarch Money for personal-finance analysis and lightweight edits.

Wraps the unofficial monarchmoney Python client.

Features

Group Tools
Transactions list_transactions (with full filter set), get_transaction, get_transactions_summary
Tags list_tags, create_tag, set_transaction_tags
Categories list_categories, list_category_groups, create_category, delete_category
Accounts list_accounts
Net worth get_net_worth_history, get_net_worth_by_type, get_account_history
Cash flow get_cash_flow, get_cash_flow_summary
Budgets / goals get_budgets (includes v2 goals), set_budget

Upstream API gaps

The following are not exposed because the upstream library does not implement them:

  • Tags: no rename, no delete.
  • Categories: no rename (delete is supported).
  • Goals: read-only (returned alongside get_budgets); no create/update/delete.

Install

Requires Python 3.10+ and an OS keychain that the keyring package can talk to (macOS Keychain, Windows Credential Manager, GNOME Keyring / KWallet via D-Bus on Linux).

Recommended: pipx

pipx installs the package into its own venv and puts the monarch-mcp / monarch-mcp-setup entry points on your $PATH:

pipx install .

Alternative: pip in a venv

python3 -m venv .venv
source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install .

If you go this route, Claude Desktop will need the absolute path to the venv's monarch-mcp binary (see below).

Linux note

On a headless Linux box (or WSL2 without a desktop session), keyring won't find a backend by default. Either:

  • install gnome-keyring and run dbus-launch so the daemon is reachable, or
  • install keyrings.alt (pip install keyrings.alt) and accept that secrets land in a plaintext file under ~/.local/share/python_keyring/ — fine for a personal dev box, not fine for shared machines.

Configure credentials

Run once to store your Monarch email, password, and (optional but recommended) MFA TOTP secret in the OS keychain. All three live under service name monarch-mcp.

monarch-mcp-setup set       # interactive prompts (password + MFA are hidden input)
monarch-mcp-setup show      # report which fields are stored (values not echoed)
monarch-mcp-setup clear     # wipe all three fields

monarch-mcp-setup with no subcommand defaults to set.

About the MFA secret

When you enable MFA in Monarch, the setup screen shows a QR code and a base32 string (often labelled "secret key" or "manual entry code"). That base32 string is what monarch-mcp-setup is asking for — not a 6-digit code.

Storing it lets the server compute TOTP codes itself and re-authenticate unattended after the session pickle expires. Without it, every session expiry forces you to manually re-login by clearing credentials and running set again with a fresh code.

If you didn't capture the secret when you first enrolled, you can re-enroll your authenticator in Monarch's settings to see it again.

Where session state lives

After the first successful login, the server caches a session pickle so subsequent process starts skip the login round-trip:

  • Default: ~/.config/monarch-mcp/session.pickle
  • Override: set the MONARCH_MCP_SESSION_DIR env var to a directory of your choice

If the pickle gets corrupted or rejected by Monarch, the server silently falls back to a fresh login using the stored credentials — you don't need to clear it manually.

Wire into Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add an entry under mcpServers:

{
  "mcpServers": {
    "monarch": {
      "command": "monarch-mcp"
    }
  }
}

If monarch-mcp isn't on the $PATH Claude Desktop sees (common when you used a venv rather than pipx), give it the absolute path:

{
  "mcpServers": {
    "monarch": {
      "command": "/Users/you/code/monarch-mcp/.venv/bin/monarch-mcp"
    }
  }
}

To park the session pickle somewhere non-default:

{
  "mcpServers": {
    "monarch": {
      "command": "monarch-mcp",
      "env": { "MONARCH_MCP_SESSION_DIR": "/Users/you/.local/share/monarch-mcp" }
    }
  }
}

Restart Claude Desktop. The tools should appear in the MCP picker.

Wire into Claude Code

claude mcp add monarch monarch-mcp

Notes on the tool surface

  • All date arguments are ISO YYYY-MM-DD strings.
  • IDs (category, tag, account) are opaque strings — discover them via the corresponding list_* tool before calling filtered endpoints.
  • set_budget requires exactly one of category_id or category_group_id.
  • list_transactions paginates: pass limit and offset to walk results larger than the default 100.

Development & tests

The test suite is hermetic — it stubs keyring, monarchmoney, and mcp.server.fastmcp when those packages aren't installed, so you can run it without network access or a keychain backend.

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'

-e .[dev] installs the package editable plus pytest and pytest-asyncio.

Run

pytest                              # full suite (~80ms, 43 tests)
pytest tests/test_server.py         # one module
pytest -k "set_budget"              # one keyword
pytest -v                           # verbose, lists each test

Pytest config lives in pyproject.toml under [tool.pytest.ini_options]:

  • pythonpath = ["src"] — lets from monarch_mcp import ... resolve without an editable install (handy in CI containers that don't run pip install).
  • asyncio_mode = "auto" — async test functions don't need a @pytest.mark.asyncio decorator.
  • testpaths = ["tests"] — bare pytest finds the suite.

Layout

src/monarch_mcp/
  auth.py     — keychain wrapper (get/set/delete + require_login_credentials)
  setup.py    — monarch-mcp-setup CLI (set / show / clear)
  server.py   — FastMCP server, lazy-login client, all tool definitions
tests/
  conftest.py — third-party stubs + clean_keyring / fake_mm_client / server_with_fake_client fixtures
  test_auth.py
  test_setup.py
  test_server.py

Writing a new tool

  1. Add an @mcp.tool()-decorated async function to src/monarch_mcp/server.py. The docstring becomes the MCP tool description Claude sees, so write it for Claude.
  2. If it calls a new MonarchMoney method, add the method name to _FAKE_METHODS in tests/conftest.py so fake_mm_client mocks it out.
  3. Add a test in tests/test_server.py using the server_with_fake_client fixture — assert on client.<method>.await_args.kwargs to confirm the call shape.

What the fixtures do

  • clean_keyring — clears the in-memory keyring stub before each test (no-op when real keyring is installed).
  • fake_mm_clientMagicMock whose Monarch methods are AsyncMocks returning {"called": <method_name>}.
  • server_with_fake_client — monkeypatches server._client to the fake, so tool calls bypass _get_client() and the login flow entirely. Tests that do exercise login (test_get_client_*) reset _client to None and patch server.MonarchMoney directly.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选