countbean-mcp
v0.7.0MCP server for Beancount plain-text accounting: double-entry transactions written by an AI agent, validated with bean-check and committed to git.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
connect_book Connect a hosted book
Connect this plugin to a hosted Countbean book, permanently. Give it the key shown once on your book's page (`cbk_…`) and the book id (`bok_…`). Verifies the pair against the live book BEFORE saving, then stores it in ~/.countbean/credentials.json (0600). Takes effect immediately — no restart, no environment variables. Paste both on one line and this tool sorts them out; the `bok_…` id can be omitted if you have already connected to that book before.
| Parameter | Type | Description |
|---|---|---|
api_key * | string | |
book_id | string | |
control_url | string |
start_device_authorization Start connecting a hosted book
Step 1 of connecting a hosted book: get a code for the user to approve. Returns IMMEDIATELY with a short code and a link. Show both to the user, then call `await_device_approval` to wait for them to approve it. Deliberately two tools and not one. An MCP tool returns a single result, at the end — so a tool that fetched the code and then waited for approval could never show the code to the person who has to type it. It could only ever expire. That was the first version of this, and it was unusable.
| Parameter | Type | Description |
|---|---|---|
control_url | string |
await_device_approval Finish connecting a hosted book
Step 2: wait for the user to approve the code from `start_device_authorization`. Blocks until they approve, decline, or the code expires. On success the connection is saved and every countbean tool switches to that book.
disconnect_book Forget the saved connection
Forget the saved hosted-book connection (the key stays valid; revoke it on the book's page if you want it dead).
connection_status Which book am I connected to
Show which book this plugin is talking to, and which config chose it. Answers the question that actually gets asked when something looks wrong: not "is it configured" but "WHICH of my configs won". Environment beats a .env, which beats the saved connection.
create_book Create a local book
Initialise a new, empty cloud book (git-backed Beancount ledger). Safe to call once per book; errors if a book already exists at the location.
| Parameter | Type | Description |
|---|---|---|
currency | string | |
name | string |
book_status Book summary
Summarise the current book: location, account count, balances, last commits.
add_transactions Record transactions
Append one or more transactions (raw Beancount syntax) to the book. The text is validated with bean-check and only committed if valid; on failure nothing is written and the validation errors are returned. Postings must balance. Open any new accounts first (open_accounts).
| Parameter | Type | Description |
|---|---|---|
beancount_text * | string |
open_accounts Open accounts
Add account `open` (or close/commodity) directives to the book. Example: `2026-01-01 open Assets:Checking USD`
| Parameter | Type | Description |
|---|---|---|
beancount_text * | string |
add_directives Write ledger entries
Append arbitrary Beancount directives (auto-routed by kind) and commit. Use for batch setup ("set up my whole situation"): opens, balances, transactions and prices in one validated commit.
| Parameter | Type | Description |
|---|---|---|
beancount_text * | string | |
message | string |
list_accounts List accounts
List every account currently open in the book.
get_ledger Read the whole ledger
Return the full plain-text ledger (accounts, transactions, prices).
run_query Run a query
Run a Beancount Query Language (BQL) query and return CSV-style rows. Example: `SELECT account, sum(position) WHERE account ~ 'Expenses' GROUP BY account`
| Parameter | Type | Description |
|---|---|---|
bql * | string |
balances Account balances
Show balances grouped by account, optionally filtered by a regex. `account_filter` is a BQL regex like 'Assets' or 'Expenses:Food'.
| Parameter | Type | Description |
|---|---|---|
account_filter | string |
assess_book Review the book
Review the book and return COMPUTED facts about it as JSON. Coverage, monthly income/expense, cash, run rate and runway, category shares, month-over-month movers, unusually large postings, and data-quality flags. Read this and report it. Do NOT compute your own figures from it, do not extrapolate past the coverage window, and do not turn a `sufficient: false` into a number with a caveat — that field means the data cannot support the figure, and the honest answer is to say which data is missing. Every month is marked `complete`. Only complete months are aver…
propose_transactions Propose a statement import
Parse a bank statement (CSV or OFX/QFX) into a PROPOSAL. Writes nothing. Give `statement_id` when you were given one (`stm_…`): the statement is already stored on the book, so do NOT ask for or copy the file. Otherwise give `content` — the statement's bytes, base64-encoded, or its text pasted straight in. NOT a path. `account` is required: the book account the statement belongs to, e.g. 'Assets:Checking' or 'Liabilities:Visa'. Every row is one side of it and the file never says which. Returns a SUMMARY, not the rows: `proposal_id`, `counts`, `date_range`,…
| Parameter | Type | Description |
|---|---|---|
account | string | |
amount_shape | string | |
columns | string | |
content | string | |
content_encoding | string | |
counter_account | string | |
currency | string | |
date_format | string | |
decimal_separator | string | |
delimiter | string | |
file_format | string | |
filename | string | |
opening_balance | string | |
sign | string | |
statement_id | string |
commit_proposal Write a proposed import
Write a proposal from `propose_transactions` into the book, as ONE commit. `overrides` is a JSON object with the accounts you chose: {"payees": {"REWE MARKT GMBH": "Expenses:Groceries", "SALARY ACME LTD": "Income:Salary"}, "rows": {"cb1:0123abcd4567ef89": "Expenses:Travel"}} Payee keys are the `payee` values the proposal listed. `rows` overrides a single row by its import_id, and "skip" leaves that row (or that payee) out. Anything you do not name stays on Expenses:Unclassified / Income:Unclassified — say so to the customer rather than gu…
| Parameter | Type | Description |
|---|---|---|
proposal_id * | string | |
open_new_accounts | boolean | |
overrides | string |
generate_report Make a report
Generate a financial report from the book. format: 'html' (the paper report page, self-contained) or 'xlsx' (Excel workbook with Balance sheet, Income statement, Transactions and To check sheets). as_of: balance-sheet date, YYYY-MM-DD (default today). period_start: first day of the income statement, YYYY-MM-DD (default 1 January of the as_of year — the income statement is year to date). Returns the path to the written file — or, when you are answering a customer's chat from inside their hosted book, a note that the report will follow; the file is then s…
| Parameter | Type | Description |
|---|---|---|
as_of | string | |
format | string | |
period_start | string |
stage_receipt Store a receipt
Store a receipt photo or PDF as evidence and return a reference to it. Call this FIRST, before proposing anything. A receipt is the source document for the entry it becomes, and an entry whose evidence was thrown away is a promise we cannot keep two years from now. Give it EITHER `file_path` (a photo or PDF on this machine — the plugin path) OR `content_base64` (raw bytes, for a chat agent that has no filesystem in common with the book). `declared_name` is recorded in the reply for your convenience and is used for NOTHING else — never for the file type, ne…
| Parameter | Type | Description |
|---|---|---|
content_base64 | string | |
declared_name | string | |
file_path | string |
propose_receipt_transaction Propose an entry from a receipt
Turn what you read off a staged receipt into a PROPOSED transaction. You supply the reading and, for every field, how sure you are of it on a 0.0-1.0 scale. Be honest about the confidences — they are the whole mechanism. **Anything below the floor comes back flagged rather than as a value**, and the floor can be raised by argument but never lowered, so a low confidence is not a suggestion. `expense_account` and `paid_from_account` are yours to choose: categorisation is the part of this a model is genuinely good at. The book's `open` directives are read here…
| Parameter | Type | Description |
|---|---|---|
receipt_sha256 * | string | |
confidence_floor | number | |
currency | string | |
currency_confidence | number | |
date | string | |
date_confidence | number | |
exchange_rate | string | |
expense_account | string | |
extracted_text | string | |
line_items_json | string | |
merchant | string | |
merchant_confidence | number | |
operating_currency | string | |
paid_from_account | string | |
receipt_key | string | |
tax | string | |
tax_confidence | number | |
total | string | |
total_confidence | number |
history Change history
Show the book's git history (each AI or human change is one commit).
| Parameter | Type | Description |
|---|---|---|
limit | integer |
revert Undo a change
Revert a specific commit (undo a change), creating a new commit.
| Parameter | Type | Description |
|---|---|---|
commit * | string |