Skip to main content
Glama
monarch-mcp

monarch-mcp

by bkichler

monarch-mcp

Claude(Desktop、Code、または任意のMCPクライアント)をMonarch Moneyに接続し、個人財務の分析や簡易的な編集を行うためのMCPサーバーです。

非公式のmonarchmoney Pythonクライアントをラップしています。

機能

グループ

ツール

取引

list_transactions (全フィルターセット付き), get_transaction, get_transactions_summary

タグ

list_tags, create_tag, set_transaction_tags

カテゴリ

list_categories, list_category_groups, create_category, delete_category

口座

list_accounts

純資産

get_net_worth_history, get_net_worth_by_type, get_account_history

キャッシュフロー

get_cash_flow, get_cash_flow_summary

予算 / 目標

get_budgets (v2目標を含む), set_budget

上流APIの制限

上流ライブラリで実装されていないため、以下の機能は公開されていません:

  • タグ:名前変更、削除は不可。

  • カテゴリ:名前変更は不可(削除はサポートされています)。

  • 目標:読み取り専用(get_budgetsと一緒に返されます)。作成/更新/削除は不可。

Related MCP server: monarch-mcp2

インストール

Python 3.10以上と、keyringパッケージが通信可能なOSキーチェーン(macOS Keychain、Windows Credential Manager、Linux上のD-Bus経由のGNOME Keyring / KWallet)が必要です。

推奨:pipx

pipxはパッケージを独自のvenvにインストールし、monarch-mcp / monarch-mcp-setup エントリポイントを $PATH に追加します:

pipx install .

代替案:venvでのpip

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

この方法をとる場合、Claude Desktopにはvenvの monarch-mcp バイナリへの絶対パスが必要になります(下記参照)。

Linuxに関する注意点

ヘッドレスLinux環境(またはデスクトップセッションのないWSL2)では、keyringはデフォルトでバックエンドを見つけられません。以下のいずれかを行ってください:

  • gnome-keyring をインストールし、dbus-launch を実行してデーモンにアクセスできるようにする。

  • keyrings.alt (pip install keyrings.alt) をインストールし、シークレットが ~/.local/share/python_keyring/ 配下のプレーンテキストファイルに保存されることを許容する(個人の開発環境では問題ありませんが、共有マシンでは推奨されません)。

認証情報の設定

一度実行して、Monarchのメールアドレス、パスワード、および(任意ですが推奨される)MFA TOTPシークレットをOSキーチェーンに保存します。これら3つはすべてサービス名 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 はデフォルトで set として動作します。

MFAシークレットについて

MonarchでMFAを有効にすると、設定画面にQRコードとbase32文字列(「シークレットキー」や「手動入力コード」とラベル付けされていることが多い)が表示されます。monarch-mcp-setup が求めているのはそのbase32文字列であり、6桁のコードではありません。

これを保存しておくことで、サーバーはTOTPコードを自身で計算し、セッションのpickleが期限切れになった後も自動的に再認証を行うことができます。これがない場合、セッションが切れるたびに認証情報をクリアし、新しいコードで set を再実行して手動でログインし直す必要があります。

最初に登録した際にシークレットを保存しなかった場合は、Monarchの設定で認証アプリを再登録することで再度確認できます。

セッション状態の保存場所

最初のログイン成功後、サーバーはセッションのpickleをキャッシュするため、以降のプロセス起動時にはログインの往復をスキップします:

  • デフォルト: ~/.config/monarch-mcp/session.pickle

  • 上書き: MONARCH_MCP_SESSION_DIR 環境変数を任意のディレクトリに設定してください

pickleが破損したりMonarchに拒否されたりした場合、サーバーは保存された認証情報を使用して自動的に新しいログインを試みます。手動でクリアする必要はありません。

Claude Desktopへの組み込み

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

mcpServers の下にエントリを追加します:

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

monarch-mcp がClaude Desktopから見える $PATH にない場合(pipxではなくvenvを使用した場合によくあります)、絶対パスを指定してください:

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

セッションpickleをデフォルト以外の場所に配置する場合:

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

Claude Desktopを再起動してください。MCPピッカーにツールが表示されるはずです。

Claude Codeへの組み込み

claude mcp add monarch monarch-mcp

ツールインターフェースに関する注意点

  • すべての日付引数はISO YYYY-MM-DD 形式の文字列です。

  • ID(カテゴリ、タグ、口座)は不透明な文字列です。フィルター付きエンドポイントを呼び出す前に、対応する list_* ツールで確認してください。

  • set_budget には category_id または category_group_id のいずれか一方が必須です。

  • list_transactions はページネーションを行います。デフォルトの100件を超える結果を取得するには limit と offset を渡してください。

開発とテスト

テストスイートは自己完結型です。パッケージがインストールされていない場合は keyring、monarchmoney、mcp.server.fastmcp をスタブ化するため、ネットワークアクセスやキーチェーンバックエンドなしで実行できます。

セットアップ

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

-e .[dev] はパッケージを編集可能状態でインストールし、さらに pytest と pytest-asyncio をインストールします。

実行

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の設定は pyproject.toml の [tool.pytest.ini_options] にあります:

  • pythonpath = ["src"] — 編集可能インストールなしで from monarch_mcp import ... を解決できるようにします(pip install を実行しないCIコンテナで便利です)。

  • asyncio_mode = "auto" — 非同期テスト関数に @pytest.mark.asyncio デコレータが不要になります。

  • testpaths = ["tests"] — pytest コマンドだけでテストスイートを検出します。

レイアウト

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

新しいツールの作成

  1. src/monarch_mcp/server.py に @mcp.tool() デコレータを付けた非同期関数を追加します。docstringがClaudeに見えるMCPツールの説明になるため、Claude向けに記述してください。

  2. 新しい MonarchMoney メソッドを呼び出す場合は、tests/conftest.py の _FAKE_METHODS にメソッド名を追加し、fake_mm_client がモック化できるようにします。

  3. tests/test_server.py に server_with_fake_client フィクスチャを使用したテストを追加し、client.<method>.await_args.kwargs をアサートして呼び出しの形式を確認します。

フィクスチャの役割

  • clean_keyring — 各テストの前にメモリ内のキーチェーンスタブをクリアします(実際のキーチェーンがインストールされている場合は何もしません)。

  • fake_mm_client — Monarchメソッドが {"called": <method_name>} を返す AsyncMock である MagicMock です。

  • server_with_fake_client — server._client をフェイクにモンキーパッチし、ツール呼び出しが _get_client() やログインフローを完全にバイパスするようにします。ログインを実際にテストするケース(test_get_client_*)では、_client を None にリセットし、server.MonarchMoney を直接パッチします。

Available Tools

18 tools
create_categoryC

Create a new category under the given group.

Inputs: group_id (required), name (required), icon, rollover_enabled. Returns: object

create_tagA

Create a new tag. Color is a hex string like '#ff0000'.

Inputs: name (required), color (required). Returns: object

delete_categoryB

Delete a category by ID.

Inputs: category_id (required). Returns: object

get_account_historyB

Historical balance snapshots for a single account.

Inputs: account_id (required). Returns: object

get_budgetsC

Budget plan vs. actuals for the date range. Includes v2 goals when present.

Inputs: start_date, end_date. Returns: object

get_cash_flowB

Cash flow aggregated by category, group, and merchant for the date range.

Inputs: limit, start_date, end_date. Returns: object

get_cash_flow_summaryA

Top-line cash flow numbers only (income, expense, savings).

Inputs: start_date, end_date. Returns: object

get_net_worth_by_typeC

Net worth broken down by account type. Timeframe: 'month' or 'year'.

Inputs: start_date (required), timeframe. Returns: object

get_net_worth_historyA

Daily net-worth snapshots aggregated across all accounts.

Optional account_type filters to a single type (e.g. 'brokerage'). Dates are ISO YYYY-MM-DD.

Inputs: start_date, end_date, account_type. Returns: object

get_transactionA

Return full detail for a single transaction (includes splits, tags, attachments).

Inputs: transaction_id (required). Returns: object

get_transactions_summaryB

Aggregate stats (count, sum, average, max) across all transactions.

Inputs: no named parameters. Returns: object

list_accountsA

List all configured accounts with current balances and metadata.

Inputs: no named parameters. Returns: object

list_categoriesA

List all transaction categories.

Inputs: no named parameters. Returns: object

list_category_groupsA

List all category groups (the parent groupings for categories).

Inputs: no named parameters. Returns: object

list_tagsA

List all transaction tags.

Inputs: no named parameters. Returns: object

list_transactionsA

List transactions with optional filters. Dates are ISO YYYY-MM-DD.

Use list_categories / list_tags / list_accounts to discover the IDs needed for the *_ids filter arguments.

Inputs: limit, offset, start_date, end_date, +9 more. Returns: object

set_budgetA

Set a budget amount. Provide exactly one of category_id or category_group_id.

timeframe: 'month' or 'year'. apply_to_future propagates the change forward.

Inputs: amount (required), category_id, category_group_id, timeframe, +2 more. Returns: object

set_transaction_tagsB

Replace the set of tags on a transaction with the given tag IDs.

Inputs: transaction_id (required), tag_ids (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 18 tools

    Disambiguation5/5

    Each tool targets a distinct financial entity or operation (e.g., categories, tags, budgets, transactions, cash flow, net worth). No two tools have overlapping functionality; even related tools like get_cash_flow and get_cash_flow_summary are clearly differentiated by detail level.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case (e.g., create_category, get_budgets, list_transactions). Verbs are uniformly chosen (create, delete, get, list, set) and nouns are plural or singular as appropriate.

    Tool Count5/5

    18 tools cover the major areas of personal finance management (accounts, transactions, categories, tags, budgets, cash flow, net worth) without being overwhelming. The count is within the optimal 3-15 range, though slightly above, but still well-scoped for the domain.

    Completeness2/5

    The tool surface has significant gaps: no update or delete for transactions, no delete for tags, no update for categories or tags. While core reads and some writes exist, essential lifecycle operations (especially delete and update for transactions) are missing, limiting agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that integrates with Monarch Money to provide financial data access and operations, including account management, transaction filtering, budget analysis, and goal tracking through natural language.
      -
    • A
      license
      C
      quality
      C
      maintenance
      Unofficial MCP server for Monarch Money that exposes tools for managing accounts, transactions, budgets, and other financial data through natural language.
      125
      1
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      A personal MCP server that gives Claude native access to YNAB budget data.
      46
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server that enables AI assistants to interact with your Monarch Money personal finance data. Manage accounts, transactions, budgets, and analyze your finances programmatically.
      MIT