Skip to main content
Glama
ledgerbridge-mcp

ledgerbridge-mcp

ledgerbridge-mcp — Offline Multi-Bank, Alipay (GB18030) & WeChat Statement Reconciler + OFX 2.2 / Beancount / YNAB MCP Server, CLI & GitHub Action

z121245017-ai/ledgerbridge-mcp MCP server

Zero-dependency, 100% offline Model Context Protocol (MCP) Server, CLI, and GitHub Action enabling AI coding and finance agents (Claude Desktop, Claude Code, Cursor, Windsurf, Antigravity) and pull-request CI pipelines to deterministically reconcile Chase / Amex / Revolut / Wise / CMB bank CSVs, Alipay (GB18030 24-line header) CSVs, WeChat Pay CSVs (including embedded 已部分退款(¥X.XX) statuses), and copy-pasted PDF statement text using exact BigInt integer-cent math (0 IEEE-754 floating-point drift)—deduplicating cross-account credit card repayments and wallet withdrawals, netting full/partial refunds, and exporting lossless OFX 2.2 XML, Beancount (.bean), hledger (.journal), YNAB Import .csv, and QIF.

MCP Tools Exposed (stdio)

Tool

Purpose

Safety Annotations

reconcile_and_convert_statements

Parses one or more bank CSVs, Alipay (GB18030 / UTF-8) CSVs, WeChat Pay CSVs, or pasted PDF statement blocks offline, deduplicates 0–48h cross-account transfers, nets 30d partial/full refunds, proves SUM(postings) === 0, and exports ofx, beancount, hledger, ynab, qif, or csv.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

detect_cross_account_transfers_and_refunds

Inspects multi-account statement inputs to report matched cross-account transfer pairs (Assets <-> Liabilities / Wallet <-> Bank), linked refund adjustments, and exact BigInt Naive Outflow vs Gross Spend vs True Net Spend.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

audit_double_entry_ledger_balance

Audits Beancount (.bean) or hledger (.journal) ledger text offline to verify that every transaction's explicit postings sum to 0 minor units per currency without floating-point drift.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

generate_deterministic_ofx_fitids

Computes deterministic SHA-256 OFX 2.2 <FITID> keys (LB<22HEX>) for transaction lists so QuickBooks, Xero, Wave, and GnuCash never import duplicates while keeping identical same-day purchases distinct.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

Related MCP server: Statement Normalizer

Quick Start (MCP Client & Local CLI)

# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/ledgerbridge-mcp

# List MCP tool schemas from terminal
npx -y github:z121245017-ai/ledgerbridge-mcp --list

# Reconcile multiple bank / Alipay (GB18030) / WeChat files offline to Beancount or OFX 2.2
npx -y github:z121245017-ai/ledgerbridge-mcp --input ./alipay.csv --input ./cmb_debit.csv --export beancount --output ./2026.bean

# Audit a Beancount or hledger file for unbalanced postings (exits 2 if unbalanced)
npx -y github:z121245017-ai/ledgerbridge-mcp --audit-ledger ./books/2026.bean

# Invoke any MCP tool directly via --cli
npx -y github:z121245017-ai/ledgerbridge-mcp --cli generate_deterministic_ofx_fitids '{"account":"Assets:Bank:Chase","items":[{"date":"2026-11-15","amount":"-32.50","payee":"Starbucks"}]}'

Claude Desktop / Cursor / Windsurf / Antigravity Config

{
  "mcpServers": {
    "ledgerbridge": {
      "command": "npx",
      "args": ["-y", "github:z121245017-ai/ledgerbridge-mcp"]
    }
  }
}

Docker (node:22-alpine, non-root USER node)

docker build -t ledgerbridge-mcp .
docker run -i --rm ledgerbridge-mcp

GitHub Action (z121245017-ai/ledgerbridge-mcp@v1)

Enforce exact BigInt zero-cent trial-balance integrity across plain-text accounting repositories (.bean, .beancount, .journal, .hledger) and statement fixtures on every pull request:

name: LedgerBridge Double-Entry Gate

on:
  pull_request:
    paths:
      - '**/*.bean'
      - '**/*.beancount'
      - '**/*.journal'
      - '**/*.csv'

permissions:
  contents: read

jobs:
  ledgerbridge:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Verify zero-cent double-entry balance
        uses: z121245017-ai/ledgerbridge-mcp@v1
        with:
          paths: 'ledgers,fixtures'
          transfer-window-hours: '48'

Accounting Fidelity & Format Matrix

Capability

Deterministic Engine Guarantee

Downstream Software Compatibility

Binary Encoding (GB18030)

Automatic TextDecoder('gb18030') fallback + 24-line metadata stripper

Direct Alipay & Chinese bank .csv reads with 0 mojibake

Cross-Account Transfers

Pairs Account A -X & Account B +X within 0–48h into 1 balanced Transfer

Eliminates inflated double-counted credit card & wallet spend

Partial & Full Refunds

Links 退款 / chargebacks + WeChat 已部分退款(¥X.XX) to original purchase

Credits original Expenses:* category for exact True Net Spend

OFX 2.2 Idempotency

Deterministic SHA-256 FITID (LB<22HEX>) + same-day occurrence index

QuickBooks, Xero, Wave, GnuCash duplicate-safe import

Plain-Text Accounting

BigInt minor units (SUM(postings) === 0n verified per currency)

Beancount, hledger, YNAB, QIF, and BOM-prefixed Excel/WPS

Commercial Air-Gapped Browser Workbench & Multi-Account Closing Suite

Need a zero-install Bilingual Air-Gapped Browser Workbench (connect-src 'none') for drag-and-drop multi-file statement reconciliation, interactive OFX 2.2 / Beancount / YNAB / QIF tabs, BOM-prefixed Excel/WPS pivot tables, and 1080×1440 reconciliation sign-off cards without touching the command line?

Explore LedgerBridge Pro Workbench and our full offline engineering & finance utility catalog at https://z121245017-ai.github.io/.

Verification

npm test

License

MIT License — 0 external npm dependencies, 0 network calls, 100% local deterministic BigInt execution.

Available Tools

4 tools
audit_double_entry_ledger_balanceA
Read-onlyIdempotent

Audits Beancount (.bean) or hledger (.journal) double-entry ledger text offline using exact BigInt minor-unit math to verify that every transaction satisfies SUM(postings) === 0 without floating-point drift.

Inputs: filePath, filename, ledgerText.

detect_cross_account_transfers_and_refundsB
Read-onlyIdempotent

Analyzes multi-account bank, Alipay, and WeChat Pay statements offline to identify matched cross-account internal transfers, linked partial/full refunds, and exact BigInt Naive Outflow vs Gross Spend vs True Net Spend.

Inputs: content, statements, refundWindowDays, transferWindowHours.

generate_deterministic_ofx_fitidsA
Read-onlyIdempotent

Generates deterministic SHA-256 OFX 2.2 FITID keys (LB<22HEX>) for statement rows so QuickBooks, Xero, Wave, and GnuCash remain duplicate-safe across re-imports while preserving distinct IDs for identical same-day purchases.

Inputs: items (required), account, currency.

reconcile_and_convert_statementsA
Read-onlyIdempotent

Parses one or more bank CSVs (Chase, Amex, Revolut, Wise, CMB), Alipay (GB18030/UTF-8) CSVs, WeChat Pay CSVs, or pasted PDF statement blocks offline, deduplicates 0-48h cross-account transfers, nets 30d partial/full refunds, proves SUM(postings) === 0 in BigInt cents, and exports OFX 2.2, Beancount, hledger, YNAB, QIF, or Master CSV.

Inputs: content, filePaths, statements, exportFormat, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 4 tools

    Disambiguation3/5

    Tools 1-3 have clearly distinct, narrow purposes (transfer/refund detection, ledger balance auditing, FITID generation), but tool 4 (reconcile_and_convert_statements) explicitly performs all of those operations plus parsing and export, making it a superset that overlaps every other tool. An agent can reasonably be unsure whether to call the focused tools first or just use the composite one, and whether the focused tools are meant as standalone or internal steps.

    Naming Consistency4/5

    All names are snake_case and verb-first (detect_, audit_, generate_, reconcile_), so the convention is predictable. The minor deviation is structural: two names are multi-clause with 'and' conjunctions and qualifiers (detect_cross_account_transfers_and_refunds, reconcile_and_convert_statements) while the others are single verb-object phrases, making lengths and shapes less uniform.

    Tool Count4/5

    Four tools is a reasonable, well-scoped surface for a statement-reconciliation server, and each focus tool earns its place as a distinct analysis primitive. The only concern is granularity asymmetry: one tool bundles parsing, dedup, refund netting, balance proving, and multi-format export, so the effective surface is coarser than the count suggests.

    Completeness4/5

    Coverage is strong for the stated domain: multi-source ingestion (bank CSV, Alipay, WeChat, PDF blocks), dedup/refund netting, double-entry validation, stable FITIDs, and export to OFX/Beancount/hledger/YNAB/QIF/CSV. Minor gaps exist around multi-currency FX handling, ledger write/edit operations, and ongoing incremental (append to existing ledger) workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables local-first personal finance management through deterministic tools for importing, categorizing, and analyzing bank transactions.
      36
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Deterministic bank-statement parsing for AI agents: messy CSV/OFX exports to clean, categorized ledger rows. In-memory only, no storage, no external calls, no LLM in the loop.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Provides tools to read Money Lover account data and add transactions, with features for previewing, duplicate detection, reconciliation, and safe batch import of bank/card statement JSON via an MCP client.
      8
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables parsing of structured receipts, invoices, and bank statements and tolerance-based three-way reconciliation that detects tax calculation drift and duplicate claims, then synthesizes balanced double-entry bookkeeping journal entries. Exposes these capabilities as MCP tools (initialize, tools/list, tools/call) over a dependency-free JSON-RPC 2.0 stdio server.
      7
      MIT