Skip to main content
Glama
Saldima MCP

Saldima MCP

README.md
# Saldima MCP

An [MCP](https://modelcontextprotocol.io) server over local GnuCash-compatible
`.gnucash` files (plain or gzip-compressed XML, the format written by desktop
GnuCash and by [Saldima](https://github.com/johnarleyburns/saldima)). It lets
an MCP client -- Claude Code, Claude Desktop, opencode, etc. -- read and write
your books directly: categorize a bank statement, answer questions about your
accounts, help build out a tax summary.

This is a local, stdio-transport server. It never talks to a network; it only
reads and writes the book files you point it at.

## Setup

1. Create a book registry, by default at `~/.config/saldima-mcp/books.json`
   (override with the `SALDIMA_MCP_BOOKS` environment variable):

   ```json
   {
     "books": [
       { "id": "personal", "path": "/home/alice/books/personal.gnucash", "label": "Personal" }
     ]
   }
   ```

2. Point your MCP client at this server over stdio, e.g. in Claude Code's
   `~/.claude.json` (or an equivalent opencode/Claude Desktop config):

   ```json
   {
     "mcpServers": {
       "saldima": {
         "command": "npx",
         "args": ["-y", "saldima-mcp"]
       }
     }
   }
   ```

   or, from a local checkout: `"command": "node", "args": ["/path/to/saldima-mcp/dist/server.js"]`.

3. Ask your assistant to list your books, look up accounts, or post a
   transaction. A write tool like `create_transaction` accepts `dry_run: true`
   to preview without saving -- ask your assistant to try a dry run first if
   you want to see the effect before it's written to disk.

## Tools

| Tool                  | Purpose                                                    |
| --------------------- | ---------------------------------------------------------- |
| `list_books`          | List configured books and basic stats.                     |
| `list_accounts`       | List a book's accounts with full paths.                    |
| `find_account`        | Fuzzy-find an account by name/path/code substring.         |
| `search_transactions` | Search transactions by text, account or date range.        |
| `get_account_balance` | One account's cumulative balance, optionally as of a date. |
| `trial_balance`       | Trial balance report.                                      |
| `balance_sheet`       | Balance sheet as of a date.                                |
| `income_statement`    | Revenue/expenses over a date range.                        |
| `create_account`      | Add a new account to the chart of accounts.                |
| `create_transaction`  | Post a transaction (splits must balance to zero).          |
| `reconcile_split`     | Set a split's reconcile state.                             |

Every tool takes a `book_id` (see `list_books`). Write tools take an optional
`dry_run` flag.

## Scope

This server wraps `@saldima/gnucash`'s `GncXmlDocument`, the same engine
[Saldima](https://github.com/johnarleyburns/saldima) uses to read and write
real GnuCash XML books. It does not implement scheduled transactions,
budgets, multi-currency conversion or invoices/bills yet -- those read
through fine if already in the file, but there's no dedicated tool for them
in this first version.

## License

AGPL-3.0-only. See `LICENSE` and `NOTICE`.