An MCP (Model Context Protocol) server for GnuCash, allowing AI assistants to read and query your financial data.
This server uses the official GnuCash Python bindings, providing full compatibility with all GnuCash file formats including gzip-compressed XML and SQLite databases.
The GnuCash Python bindings must be installed on your system. These are part of GnuCash itself and cannot be installed via pip.
sudo apt install gnucash python3-gnucashsudo dnf install gnucash python3-gnucashsudo pacman -S gnucashpython3 -c "import gnucash; print('GnuCash bindings OK')"# Clone the repository
git clone https://github.com/jmceleney/gnucash-mcp.git
cd gnucash-mcp
# Create a virtual environment with access to system packages
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install mcp
# Run the server (GNUCASH_FILE is required)
GNUCASH_FILE=/path/to/your/finances.gnucash python3 server.pyclaude mcp add gnucash \
-e GNUCASH_FILE=/path/to/your/finances.gnucash \
-- /path/to/gnucash-mcp/.venv/bin/python3 /path/to/gnucash-mcp/server.pyTo enable write mode (allows creating transactions):
claude mcp add gnucash \
-e GNUCASH_FILE=/path/to/your/finances.gnucash \
-- /path/to/gnucash-mcp/.venv/bin/python3 /path/to/gnucash-mcp/server.py --writeAdd to your configuration file:
- Linux:
~/.config/claude/claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"gnucash": {
"command": "/path/to/gnucash-mcp/.venv/bin/python3",
"args": ["/path/to/gnucash-mcp/server.py"],
"env": {
"GNUCASH_FILE": "/path/to/your/finances.gnucash"
}
}
}
}For write mode, add "--write" to the args array.
| Tool | Description |
|---|---|
list_accounts() |
List all accounts with their types. |
get_account_balance(account_name) |
Get balance (supports partial name matching). |
get_transactions(account_name, limit) |
Get recent transactions (default: 20). |
search_accounts(query) |
Search accounts by name (case-insensitive). |
get_account_info(account_name) |
Get detailed account information. |
| Tool | Description |
|---|---|
add_transaction(from_account, to_account, amount, description, date, memo) |
Create a transaction between two accounts. |
commit() |
Save pending changes to disk (also auto-saves on exit). |
Use dot notation: Assets.Current Assets.Checking Account
Partial matching works:
Checking AccountmatchesAssets.Current Assets.Checking AccountelectricmatchesExpenses.Utilities.Electric
- "What's my checking account balance?"
- "Show recent transactions from savings"
- "List all expense accounts"
- "Search for accounts containing 'utilities'"
- "Transfer $50 from checking to savings" (write mode)
Install GnuCash Python bindings via your system package manager.
Activate the venv and install: pip install mcp
The server automatically removes stale lock files if GnuCash desktop app isn't running. If GnuCash is open, close it first.
The GNUCASH_FILE environment variable is required. Set it when running the server or in your MCP configuration.
These tools create isolated environments without access to system packages. The GnuCash Python bindings are only available as system packages, so we must use --system-site-packages.
- System dependency: Requires GnuCash installed system-wide
- Single file: One file open at a time
- Same-currency transactions: Write mode only supports transactions between accounts with the same currency
MIT