Skip to main content
Glama
hledger MCP

hledger MCP

hledger MCP

MCP server for hledger — plain-text accounting. It gives AI agents read/write access to your journals. Works with any MCP client (OpenCode, Claude Desktop, Cursor, …).

Quick start

# Run directly (no install needed)
uvx hledger-mcp --journal /path/to/main.journal

# Or install globally
uv tool install hledger-mcp
hledger-mcp --journal /path/to/main.journal

The journal path can also come from the LEDGER_FILE environment variable.

Related MCP server: ledgerkit-mcp

MCP client setup

OpenCode (~/.config/opencode/opencode.json):

{
  "mcp": {
    "hledger": {
      "type": "local",
      "command": ["uvx", "hledger-mcp", "--journal", "/path/to/main.journal"],
      "enabled": true
    }
  }
}

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "hledger": {
      "command": "uvx",
      "args": ["hledger-mcp", "--journal", "/path/to/main.journal"]
    }
  }
}

Example

"How much did I spend on groceries last month?"

The agent calls hledger_balance(account="expenses:groceries", monthly=True).

"Record a 15 euro grocery purchase at Esselunga paid with my bank card."

The agent calls hledger_add_transaction() with:

2026-07-28 Esselunga
    expenses:groceries    15.00 EUR
    assets:bank

Say "check if it is valid first" and the agent will validate with dry_run=True before touching your journal.

Tools

Tool

Description

hledger_balance

Account balances, with filters and output_format (text/csv/json)

hledger_register

Transaction register, with filters and output_format (text/csv/json)

hledger_print

Transactions as JSON (default) or plain text

hledger_accounts, hledger_payees, hledger_commodities, hledger_tags

Names used in the journal

hledger_stats, hledger_files

Journal statistics; files behind include directives

hledger_incomestatement, hledger_balancesheet, hledger_cashflow

Financial reports, with output_format (text/csv/json)

hledger_add_transaction, hledger_edit_transaction, hledger_delete_transaction

Add, replace, or remove a transaction (edit/delete match exactly one)

hledger_add_price, hledger_add_account

Add a P price directive or an account directive

hledger_check

Validate the journal with hledger check

Safety

Every write is backed up, validated with hledger check, and rolled back on failure. dry_run=True validates against a temp file and never touches your journal.

Requirements

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with local Beancount accounting ledgers through structured tools for viewing accounts, balances, and transactions, as well as inserting/removing transactions and answering natural-language questions via BeanQuery. Provides deterministic, validated, and auditable financial data operations with offline-first functionality.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to interact with a double-entry ledger, offering tools for account management, balanced journal entries, balance queries, trial balance, and penny-perfect allocation. Built with safety by construction: no update/delete tools, idempotent posting, and an append-only journal.
      7
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables an agent to query local financial ledgers for expenses, investments, and income, with tools for savings rate, accounts, sync, and reconciliation.
      18
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to perform exact-decimal double-entry accounting by calling tools that compute money, validate and post entries, verify equations, and produce deterministic audit hashes and citation-grounded artifacts.
      60 npm
      1
      MIT