mcp-server

v0.24.0
@rustledger/mcp-server Checked 3 hours ago Published 2 months ago

MCP server for rustledger - validate, query, and format Beancount ledgers

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

validate

Validate a Beancount ledger — the same checks the `rledger check` CLI runs, including booking, balance assertions and per-transaction zero-sum. Returns validation errors and warnings if any issues are found.

ParameterTypeDescription
source *stringThe Beancount ledger source text to validate

query

Run a BQL (Beancount Query Language) query on a ledger. Use this for account balances, filtering transactions, aggregations, etc.

ParameterTypeDescription
query *stringThe BQL query to execute (e.g., "SELECT account, sum(position) GROUP BY account")
source *stringThe Beancount ledger source text

balances

Get account balances from a ledger. This is a shorthand for running a BALANCES query.

ParameterTypeDescription
source *stringThe Beancount ledger source text

format

Format a Beancount ledger with consistent alignment and spacing.

ParameterTypeDescription
source *stringThe Beancount ledger source text to format

parse

Parse a Beancount ledger and return the directives as structured data.

ParameterTypeDescription
source *stringThe Beancount ledger source text to parse

completions

Get BQL query completions at a cursor position. Useful for building query editors.

ParameterTypeDescription
cursor_pos *numberThe cursor position (character offset) in the query
partial_query *stringThe partial BQL query text

list_plugins

List available native plugins that can process ledgers.

run_plugin

Run a native plugin on a ledger.

ParameterTypeDescription
plugin_name *stringThe name of the plugin to run (use list_plugins to see available plugins)
source *stringThe Beancount ledger source text

editor_completions

Get context-aware completions for Beancount source at a given position. Returns account names, currencies, directives, etc. When `file_path` is given, `include` directives are resolved so completions also offer accounts/commodities defined in included files.

ParameterTypeDescription
character *numberCharacter position in the line (0-indexed)
line *numberLine number (0-indexed)
file_pathstringPath to the ledger file under the cursor. Read from disk when `source` is omitted, and used to resolve `include` directives (relative to its directory) so the result reflects the whole ledger, not jus…
sourcestringThe Beancount ledger source text. Optional when `file_path` is given; if both are provided, `source` is the (unsaved) buffer contents and wins, while `file_path` still anchors include resolution.

editor_hover

Get hover information for a symbol at the given position. Returns documentation for accounts, currencies, and directives. When `file_path` is given, `include` directives are resolved so an account's balance and transaction count reflect the whole ledger, not just the edited file.

ParameterTypeDescription
character *numberCharacter position in the line (0-indexed)
line *numberLine number (0-indexed)
file_pathstringPath to the ledger file under the cursor. Read from disk when `source` is omitted, and used to resolve `include` directives (relative to its directory) so the result reflects the whole ledger, not jus…
sourcestringThe Beancount ledger source text. Optional when `file_path` is given; if both are provided, `source` is the (unsaved) buffer contents and wins, while `file_path` still anchors include resolution.

editor_definition

Get the definition location for a symbol (account or currency). Returns the location of the Open or Commodity directive. Operates on the edited document only (cross-file definitions are not resolved).

ParameterTypeDescription
character *numberCharacter position in the line (0-indexed)
line *numberLine number (0-indexed)
file_pathstringPath to the ledger file to read when `source` is omitted. This tool operates on the edited document only; `include` directives are not followed (its result is a location within this file).
sourcestringThe Beancount ledger source text. Optional when `file_path` is given; if both are provided, `source` is the (unsaved) buffer contents and wins, while `file_path` still anchors include resolution.

editor_document_symbols

Get all symbols in the document for an outline/structure view. Returns all directives with their positions. Operates on the edited document only (included files are not inlined).

ParameterTypeDescription
file_pathstringPath to the ledger file to read when `source` is omitted. This tool operates on the edited document only; `include` directives are not followed (its result is a location within this file).
sourcestringThe Beancount ledger source text. Optional when `file_path` is given; if both are provided, `source` is the (unsaved) buffer contents and wins, while `file_path` still anchors include resolution.

editor_references

Find all references to a symbol (account, currency, or payee) at the given position. Returns all locations where the symbol is used. Operates on the edited document only (cross-file references are not resolved).

ParameterTypeDescription
character *numberCharacter position in the line (0-indexed)
line *numberLine number (0-indexed)
file_pathstringPath to the ledger file to read when `source` is omitted. This tool operates on the edited document only; `include` directives are not followed (its result is a location within this file).
sourcestringThe Beancount ledger source text. Optional when `file_path` is given; if both are provided, `source` is the (unsaved) buffer contents and wins, while `file_path` still anchors include resolution.

ledger_stats

Get statistics about a ledger: counts of directives, accounts, currencies, date range, etc.

ParameterTypeDescription
source *stringThe Beancount ledger source text

list_accounts

List all accounts in the ledger with their open/close dates and currencies.

ParameterTypeDescription
source *stringThe Beancount ledger source text

list_commodities

List all currencies/commodities used in the ledger.

ParameterTypeDescription
source *stringThe Beancount ledger source text

account_activity

Get activity summary for a specific account: first/last transaction, total transactions, currencies used.

ParameterTypeDescription
account *stringThe account name to analyze (e.g., 'Assets:Checking')
source *stringThe Beancount ledger source text

format_check

Check if a ledger is properly formatted. Returns differences if formatting would change the file.

ParameterTypeDescription
source *stringThe Beancount ledger source text

bql_tables

Get documentation for BQL tables (entries, postings, etc.) and their available columns.

directive_at_line

Get the directive at a specific line number in the source.

ParameterTypeDescription
line *numberLine number (1-indexed)
source *stringThe Beancount ledger source text

find_transactions

Find transactions matching criteria: payee, narration, tags, or date range.

ParameterTypeDescription
source *stringThe Beancount ledger source text
from_datestringFilter by start date (YYYY-MM-DD)
limitnumberMaximum number of results (default: 50)
narrationstringFilter by narration (substring match)
payeestringFilter by payee (substring match)
tagstringFilter by tag
to_datestringFilter by end date (YYYY-MM-DD)

report

Generate financial reports: balance sheet, income statement, holdings, or net worth.

ParameterTypeDescription
report_type *stringType of report to generate
source *stringThe Beancount ledger source text
currencystringConvert all amounts to this currency (optional)

validate_file

Validate a Beancount file from the filesystem — the same checks the `rledger check` CLI runs, including booking, balance assertions and per-transaction zero-sum. Handles includes automatically.

ParameterTypeDescription
file_path *stringPath to the Beancount file to validate

query_file

Run a BQL query on a Beancount file from the filesystem.

ParameterTypeDescription
file_path *stringPath to the Beancount file
query *stringThe BQL query to execute

format_file

Format a Beancount file. Can optionally write the formatted output back to the file.

ParameterTypeDescription
file_path *stringPath to the Beancount file to format
writebooleanIf true, write the formatted output back to the file

import_categorize

Suggest an expense/income account for a transaction based on its payee and description. Uses the ledger's existing accounts as candidates. Returns a prompt you can use to ask the LLM for categorization, along with the list of known accounts.

ParameterTypeDescription
date *stringThe transaction date (YYYY-MM-DD)
narration *stringThe transaction description/narration
source *stringThe beancount ledger source (to extract known accounts)
amountstringThe transaction amount (e.g., '-85.23')
currencystringThe currency (default: USD)
payeestringThe transaction payee (e.g., 'WHOLE FOODS MARKET')

import_review

Find transactions in the ledger that need import review (have import-confidence metadata). Returns transactions grouped by confidence level.

ParameterTypeDescription
source *stringThe beancount ledger source