--- name: beankeeper-desktop description: Work with the user's encrypted local Beankeeper Desktop workspace over authenticated MCP. --- # Beankeeper Desktop ## Install and set up Beankeeper on this machine Run the commands below from an authorized shell in the owner's logged-in OS session. Choose the setup path for your client first. - **Claude Desktop chat.** Use the verified `.mcpb` extension. [Claude Desktop setup](https://github.com/Govcraft/beankeeper-desktop/blob/main/docs/claude-desktop.md) - **Claude Code, local Codex, and Grok Build.** Follow the steps below when running on the owner's machine. - **ChatGPT Work with local shell access.** Run setup, then check for the local Beankeeper MCP tools in this session. If they are unavailable, continue in local Codex on the same machine. [ChatGPT MCP](https://learn.chatgpt.com/docs/extend/mcp) - **Grok Bot with approved local execution.** Run setup, then connect through Grok Build or another supported local client. Grok Bot's Command MCP runs on its cloud computer. [Grok Bot computer access](https://docs.x.ai/grok-bot/computer-and-apps) - **Clients without local shell access.** If the owner uses Claude Desktop, offer the verified `.mcpb` extension. Otherwise ask them to continue in a supported local client. If they have no local client that can run setup, give them the signed installation instructions below for their OS. [Claude Desktop extension work](https://github.com/Govcraft/beankeeper-desktop/issues/43) Run `bk service status --json` in the owner's logged-in user session. If `bk` is missing from PATH, check the per-user install location first. That is `$HOME/.local/bin/bk` on Linux and macOS, and `$env:LOCALAPPDATA/Programs/Beankeeper Desktop/bk.exe` on Windows. Use the installed binary when it supports `bk service install --help` and `bk agents connect --help`. If `running` is true and `company_list` responds, continue with `setup_status`. If `installed` is true and `running` is false, run `bk service start` and check again. If `installed` is false, run `bk service install --no-agents` with the installed binary. For a running service with no agent connection, run `bk agents connect --all --json` and reload the client. If `bk` is missing or lacks the setup commands, use the signed installation commands for this operating system and processor below. If a supported command fails, report and repair that step before continuing. Use [Sigstore's cosign installation instructions](https://docs.sigstore.dev/cosign/system_config/installation/) if `cosign` is missing. Install it through the owner's trusted package channel or stop and explain what is missing. Guided setup selects the highest published version with signature bundles for this machine and checks that it provides managed service and agent registration commands. On Linux and macOS, install `jq` through the owner's trusted package channel for automatic selection. If the shell already has `GH_TOKEN` or `GITHUB_TOKEN`, the installers use it for the GitHub release listing. If GitHub limits anonymous requests, the installer retries when the wait is short. Set `BK_VERSION` to a known signed release to bypass discovery if the limit persists. ### Linux and macOS Run this from the desktop login, with the regular user account. The installer detects Linux versus macOS and x86-64 versus Arm64. ```sh ( set -eu bk_bin="$HOME/.local/bin" bk_download="$(mktemp -d)" trap 'rm -rf "$bk_download"' EXIT mkdir -p "$bk_bin" curl -fsSL https://raw.githubusercontent.com/Govcraft/beankeeper-desktop/main/install.sh -o "$bk_download/install.sh" BK_REQUIRE_SIGNATURES=1 BK_REQUIRE_AGENT_SETUP=1 BK_INSTALL="$bk_bin" BK_NO_SERVICE=1 \ sh "$bk_download/install.sh" "$bk_bin/bk" service install --no-agents "$bk_bin/bk" agents connect --all --json "$bk_bin/bk" service status --json ) ``` ### Windows Run this in PowerShell 5.1 or later as the logged-in user. The installer checks for x64 Windows before downloading the release. ```powershell & { $ErrorActionPreference = 'Stop' $bkDir = Join-Path $env:LOCALAPPDATA 'Programs\Beankeeper Desktop' $bkSetup = Join-Path ([IO.Path]::GetTempPath()) ("bk-install-" + [guid]::NewGuid() + ".ps1") try { Invoke-WebRequest -UseBasicParsing -Uri 'https://raw.githubusercontent.com/Govcraft/beankeeper-desktop/main/install.ps1' -OutFile $bkSetup & $bkSetup -RequireSignatures -RequireAgentSetup -NoService -InstallDir $bkDir $bk = Join-Path $bkDir 'bk.exe' & $bk service install --no-agents if ($LASTEXITCODE -ne 0) { throw 'Beankeeper service installation failed' } & $bk agents connect --all --json if ($LASTEXITCODE -ne 0) { throw 'Beankeeper agent registration failed' } & $bk service status --json if ($LASTEXITCODE -ne 0) { throw 'Could not read Beankeeper service status' } } finally { Remove-Item -LiteralPath $bkSetup -Force -ErrorAction SilentlyContinue } } ``` Both installers require SHA-256 and Sigstore verification of the release archive and checksum list, using the exact Govcraft release workflow and tag and GitHub Actions OIDC issuer. If verification fails, stop before executing the downloaded binary. Explain what failed, such as a missing signed release, unavailable cosign, or a checksum mismatch. If the service or registration fails, report the status and the specific step. Repair that step before resuming installation. Explain where the private recovery kit was created on first installation. Ask the owner to open the kit directly and keep an offline copy. Only the owner handles the key. Use the installed location or restart the agent client when it needs to reload its connection. If MCP tools are temporarily unavailable, `bk agents doctor --json` checks the registrations and makes an authenticated read-only MCP call. Confirm with `company_list` in the connected client, then call `setup_status` to begin conversational onboarding. Tell the owner that the books are encrypted locally, give the exact books path from `bk service status --json`, and explain that `bk agents disconnect` and `bk service uninstall` remove the connection and background service while preserving the books. The binary can then be removed from its install directory. ## Manage background hosting Installers normally configure encrypted local books and background hosting. Use `service_status` on the separate `beankeeper-service` MCP connection to check readiness. `service_start`, `service_stop`, `service_install` and `service_uninstall` manage the per-user host, even when its HTTP server is stopped. These local tools have OS-user service authority, separate from ledger grants; use them only when the owner's request authorizes that lifecycle action. They accept no arguments and return named errors or structured status with a plain-language message, running version, MCP endpoint and optional Desktop link. When running, `service_status` also reports the managed credential's `agent_access`, including its `preset`, `write_mode` and a plain-language note. Answer in plain words first. Offer the Desktop view only when useful. The ledger MCP entry runs `bk mcp bridge --service`, discovering the current loopback port and using the private agent-token file. If unavailable, use `service_status` to diagnose and `service_start` when authorized. Reconnect the ledger MCP client after restarting hosting. CLI equivalents are `bk service install | uninstall | start | stop | status --json`. Pass `file_store: true` to `service_install` to use a private passphrase file for new books, or `no_agents: true` to leave client configurations alone. If status reports `SERVICE_NOT_RUNNING`, use `service_start`. If starting returns `SERVICE_NOT_INSTALLED`, use `service_install`. On Linux, Beankeeper discovers the owner's session bus for lifecycle commands when Claude Desktop or another launcher omits it. `service_status` checks the live local endpoint directly. If you get `SESSION_ENV_UNAVAILABLE`, ask the owner to retry from an active login session or pass its `XDG_RUNTIME_DIR` and `DBUS_SESSION_BUS_ADDRESS` to the launcher. `bk agents connect` and `bk agents doctor` can report this code. Managed agent configs need no hand-edited session variables. Uninstall removes hosting while preserving all books and credentials. See [background hosting](docs/service.md) for storage and recovery details. ## Connect a local agent Installers register Beankeeper with detected clients by default. Run `bk agents detect --json` to see which clients are available. To repair the connection, use `bk agents connect --all` or select one client, such as `bk agents connect codex`. Restart the client to load the updated configuration. Use `bk agents doctor --json` to check the managed configuration and make a read-only tool call through the local service. Supported clients are Claude Desktop, Claude Code, Codex CLI, Cursor, Gemini CLI, VS Code with Copilot, and Grok Build. An installed Beankeeper extension manages its own Claude Desktop connection. For local Codex in the ChatGPT desktop app, run `bk agents connect codex --json`, then restart the servers from **Settings → MCP servers**. Confirm that `company_list` responds in a local Codex chat. [ChatGPT MCP settings](https://learn.chatgpt.com/docs/extend/mcp) For Grok Build, run `bk agents connect grok-build --json` and restart the client. For Claude Code, run `bk agents connect claude-code --json`. The command can adopt entries with the managed command and arguments even if they specify stdio transport or an empty environment. If it reports a custom `env`, tell the owner which entry needs attention and let them decide whether to remove the overrides or keep them by renaming the entry. Configuration changes leave other server entries in place and keep a private `.beankeeper-backup` beside the original. `bk agents disconnect ` removes the managed entries and skill for that client. Remove the Beankeeper extension from Claude Desktop Settings to remove an extension-managed connection. To install without changing agent settings, use `BK_NO_AGENTS=1` or the shell installer's `--no-agents` option. PowerShell accepts `-NoAgents`. The Windows setup executable accepts `/NOAGENTS=1`. The background service can still run and you can connect a client later. For manual foreground hosting, the owner can still run `bk --db /path/to/books.db setup` once in a terminal. It creates encrypted books, stores the passphrase in the OS keychain, prepares a private recovery kit and merges the `beankeeper` MCP server into Claude Desktop, Claude Code and Codex configs. Restart the agent client afterward. Standalone `bk setup` defaults to read-only. Its optional `--preset bookkeeper` records transactions directly without Desktop-provisioned spend limits. See the [standalone setup options](docs/setup.md#options). Never ask for, read, print, copy or attach the recovery kit, passphrase store or owner-token file. The owner controls recovery, credential changes and reversal authority. Manual setup configs invoke `bk mcp bridge` with an explicit endpoint and a private agent-token file path. This bridge connects to the running `bk serve`. For manual hosting, the owner can start `bk --db /path/to/books.db serve` or rerun `setup --force`. Stored passphrases are resolved automatically for enrolled ledgers; explicit upstream secret sources take precedence. `setup --force` resumes without deleting data, rotating the root or changing an existing preset. Capability changes and token renewal use upstream commands under the owner's control. ## Record transactions and explain undo Fresh managed installs give the agent the bookkeeper preset with `write_mode: direct`. When asked to record a transaction, use `txn_post` over the managed connection or `bk txn post` with the same agent credential. After the ledger posts it, tell the owner what was recorded and give them the book and transaction ID. Offer the optional transaction detail link through `ui_get_link`. If the owner wants to undo a posting, give them `bk --db BOOKS --company COMPANY txn reverse ID` or the equivalent `txn_reverse` arguments `company` and `id` for a connection they control with `ledger/reverse`. Upstream appends an offsetting transaction linked to the original and records the owner's action in the audit trail. For ongoing sign-off, the owner can choose `ProposeOnly` for a grant. Ask them to follow the [owner credential steps](docs/service.md#choose-a-write-mode) from their own terminal. The replacement grant applies across companies in that ledger. Use a separate ledger for a book that needs its own grant policy, or use `txn_propose` (`bk txn propose`) for individual entries the owner wants to sign off within a shared ledger. A `propose-only` post returns a pending proposal ID. Report it as pending and give the owner its optional review link. Reinstall preserves existing grants, including older read-only credentials. If `agent_access.preset` is `read-only` and the owner wants the agent to post, point them to the owner credential steps for issuing a direct bookkeeper grant. ## Guide the owner through book setup Start with `setup_status` over MCP or `bk --db BOOKS setup status --json`. For a managed ledger, use the `books` path from `bk service status --json` as `BOOKS`. For a manually enrolled ledger, use its enrolled path. The status gives the counts of books, accounts and posted transactions, and whether an owner key exists. Use `next_step` as a starting point and `agent_access` to explain what the authenticated credential can do. Find the books with `company_list` or `bk --db BOOKS company list --json`, then read each book's profile and accounts before asking questions the owner may already have answered. 1. Ask whether the owner keeps personal books, business books, or both. Confirm the reporting currency and the start of the financial year for each book. 2. Ask for the names of their real accounts and the dates and amounts of any opening balances. Confirm which balances are already recorded. 3. Ask which statements they want to import and which have already been entered. Transaction currencies and existing postings alone leave those settings and import history unconfirmed. Summarize what is already recorded, what the owner has confirmed, and what still needs an answer or a statement. Begin a setup session when the installed version supports the next confirmed step. On a local shell, `bk setup --help` lists the available setup commands without opening a session. The owner can authorize a session through `ledger_setup_begin` or `bk setup begin`, using their own `ledger/admin` access on the selected encrypted ledger. For the CLI, reuse the same `--db BOOKS` path. Give the owner the setup agent's Ed25519 public key and ask them to deliver the short-lived `ledger/setup` credential through their local secret store. Keep the agent's private key and bearer token out of chat and logs. Use a separate MCP connection for the setup credential. For a local stdio client, read `mcp_endpoint` from `bk service status --json` and run `bk mcp bridge --url ENDPOINT --token-file PRIVATE_FILE`. Point `PRIVATE_FILE` at the private setup-token file and keep the regular ledger connection. Use `ledger_setup_book_show` to confirm the current profile and accounts for each existing book. Use `ledger_setup_book_initialize` to save the first profile for an existing book, including the default Personal book. Use `ledger_setup_book_create` for each new book the owner wants. Supply its purpose, base currency and the first day of its financial year as `MM-DD`. If a saved profile needs a correction, use `ledger_setup_book_update` with the current profile revision. For a new chart, confirm the matching template (`personal-v1` or `business-v1`) and apply it with `ledger_setup_chart_apply`. For a book that already has accounts, review those accounts before proposing any additions. Use `ledger_setup_account_add` for each confirmed real account with its own available account code. Read the book again to confirm the changes. Before previewing opening balances, confirm which amounts are still missing, the opening date, and the currency. Call `ledger_setup_opening_preview` with the book, active setup generation, and balanced debit and credit lines using the confirmed account codes. Send amounts as decimal strings in the currency's major units. Show the owner the preview's date, account names and amounts. A preview leaves the ledger unchanged. After the owner confirms the preview, reserve it with `ledger_setup_opening_reserve`. Send the unchanged preview inputs under `opening`, the returned `fingerprint`, and a stable `reference`. Share the pending proposal for review by the owner with approval authority, then check whether it posted. If the inputs change, preview them again and confirm the changes with the owner before reserving. Before importing a statement, confirm the book, bank account, currency, statement dates, and which transactions the owner has already recorded. Look up known statement batches with `ledger_setup_statement_receipt`. Ask the owner to confirm the source of any earlier activity you cannot account for. Confirm the suspense account for entries that still need categorization. Call `ledger_setup_statement_preview` with the active setup generation, the account codes, and a stable reference. Use `csv` for CSV and `ofx` for OFX or QFX. Supply the UTF-8 statement to the local tool and describe its preview in plain words so the owner can review the proposed entries. After review, have the owner use a separate live approval credential to call `ledger_setup_statement_commit` with the book, `batch_id`, and `preview_sha256` returned by the preview. Retry with the same ID and digest if the result is uncertain. Call `ledger_setup_statement_receipt` to confirm which transactions were created and which already existed. Give the owner those counts and identify any entries still awaiting categorization. For writes that take a setup target, send the company, setup generation and a stable request reference. Reuse the same reference and inputs when retrying. Stop and explain what needs to be resolved if a tool reports a conflict. After summarizing the outcome, have the owner finish the session or revoke it if they want to cancel access. Both actions deactivate the setup grant. Use normal ledger reversals to correct posted entries. For an unused account or an empty book created by mistake, the owner can use the audited admin controls. See the [ledger setup commands](https://github.com/Govcraft/beankeeper/blob/04e0c68e42be7a6c12f8997b6fbe5a2a3630beec/docs/beankeeper/references/commands.md#setup-sessions) for the CLI flags and MCP arguments. Setup opens the UI origin. Ask the human to open the one-time pairing URL from the private `.desktop.log`, or run `bk serve` in the foreground to see it in the terminal, then select **Pair this browser** on that page within five minutes. Opening or refreshing the page leaves the link usable; only the confirmation POST consumes it. A paired browser can browse the financial snapshot, accounts, transactions, financial reports, tax summaries and read-only reconciliation. Use the stable view IDs and query filters in [docs/reports.md](docs/reports.md) for saved report links. Tax CSV/JSON downloads require the human browser session; agent bearer tokens cannot authorize them. These summaries are not filed tax forms. Answer the financial question in plain words before offering a view. Use the structured numbers and chartable series from ledger tools to draw charts in the conversation when useful. The owner never needs Desktop to understand the answer. Offer a deep link only when a chart or detailed view helps the owner. Call `ui_get_link` on the managed ledger connection (`ledger/read`) with the same `view_id` and `state` used by `ui_show_view`. This tool succeeds without a paired browser, UI credential or live tab, works under `--read-only`, and never navigates. Put its `url` in your answer as an optional detail link. Do not call `ui_show_view` merely to obtain a URL. The CLI equivalent is `bk --json ui link --view-id VIEW --company SLUG ...`. It finds the running instance for the managed books or for the file selected by `--db` or `BEANKEEPER_DB`. Success returns the same `url`, `path`, `view_id` and `state`. Invalid selectors return `VALIDATION`. If `DESKTOP_BOOKS_NOT_SERVED` is returned, answer in words and say that Desktop is unavailable for those books. If `DESKTOP_MULTIPLE_INSTANCES` is returned, select the intended listener with `--bind` when its address is known. Always carry the answer's exact company slug, currency, account code and date bounds into the link. Spending categories identified by expense accounts map to `state.account`. `state.category` means an exact entry tax-category tag; `state.payee` means the exact `metadata.payee` string, preserving case. Both are register filters. Use inclusive `from`/`to` and optional inclusive `compare_from`/`compare_to` bounds for two periods, or `compare_to` alone for a balance-sheet snapshot comparison; see supported views and all identifiers in the [deep-link contract](docs/deep-links.md). Do not substitute a category's display name for its identifier or a fuzzy text search for a payee. For a financial summary, pass `desktop_view.link` to `ui_get_link` when it is present. Preserve the date bounds and complete account selections in summary and cash-flow chart links. See [summary and chart link fields](docs/deep-links.md#shared-upstream-identifiers). Example after answering an October spending question: ```json {"name":"ui_get_link","arguments":{"view_id":"transactions","state":{"company":"acme","account":"5000","currency":"USD","from":"2026-10-01","to":"2026-10-31","compare_from":"2026-09-01","compare_to":"2026-09-30"}}} ``` Each running Desktop listener serves one books file. Use the ledger connection for the books being discussed. A browser paired with that listener can open its detail links for the life of the session. A separate listener needs an initial pairing. If the browser is unpaired, the human opens the terminal's one-time pairing URL in that same browser and confirms pairing. Desktop then restores the requested view. Keep pairing and bearer credentials out of shared detail URLs. A saved view URL conveys no authority. Use `ui_show_view` only when the owner wants you to change their connected tab, with the separate navigation connection described below. Browser monetary values are formatted in major units with currency symbols and grouping. Reports use the currency carried by ledger amounts. Register `min_amount`/`max_amount` filters still use integer minor units; JSON/CSV downloads and raw audit/proposal payloads retain their original units. Income statements default to January 1 of the end year through today when dates are omitted. The form shows the effective dates, and empty ranges include a note and a link to company transactions across all dates. For historical books, pass explicit `from` and `to` dates, such as `2025-01-01` and `2025-12-31` for the 2025 demo. Zero totals alone do not mean the company has no activity. The review queue at `/review?company=SLUG` lists pending agent proposals. Link the human to `/review/PROPOSAL_ID?company=SLUG` to inspect entries, metadata and current spend caps, then approve or reject using their paired browser session. The queue also shows the last full ledger verification and a recheck button. For navigation, configure a second MCP connection with a separate `ui/navigate` token issued by the human owner. Ledger and UI grants cannot share a token. Current setup presets provide ledger tokens only. Call `ui_status`, give its association link to the human to open in an already paired browser, then call `ui_show_view` with a supported `view_id` and URL-addressable `state`. If several tabs are connected, supply a `tab_id` from status. `ui_highlight` accepts exact DOM IDs listed by status and never clicks or submits a control. Missing rows are a no-op. Reports and reconciliation accept the stable view IDs and filters in [docs/reports.md](docs/reports.md), either directly or via `view_id: "reports"` and `state.report_kind`. Use `report-filters` or `report-results` from status to highlight those regions. When no matching live tab is available, `ui_show_view` and `ui_highlight` return `isError: true`, code `NO_CONNECTED_TAB`, `queued: false`, a message and a `pairing_url`. Tell the human nothing was displayed, provide the connection link, and retry after association and tab connection. `ui_status` succeeds even without tabs, so use it to check readiness. Browser pairing alone does not associate your UI credential. A queued result is not browser confirmation; use `ui_status` to inspect the loaded view. `--read-only` removes navigation/highlight mutations. See the [navigation catalog](docs/navigation.md) for arguments and examples. Desktop's supported workflow is agent proposes, human approves in the browser. Do not ask for approval tokens or call MCP approval tools on the human's behalf. On enforced ledgers, Desktop uses the private owner-token file to issue short-lived approval authority for the paired human. If the review page says approval is unavailable, tell the human to check their private owner credential and restart Desktop. Keep owner and approval credentials out of agent sessions. See [docs/setup.md](docs/setup.md) for the full command reference, all config and credential paths, headless test options, lifecycle and recovery instructions. Ledger, library and schema work belongs in Govcraft/beankeeper. Desktop license and update state is available to the human at `/settings` in a paired browser. Cached update results show readable UTC attempt times and explain failed or incomplete checks; reading Settings does not contact the feed. Results are tied to the running Desktop version. A version change, or a legacy cache without a version, hides stale results until the next check refreshes them. The daily retry limit, including failures, applies within each version. The human can activate a downloaded file with `bk license activate FILE`, inspect it with `bk license`, check the signed release feed with `bk update-check`, and explicitly install an eligible release with `bk self-update`. Verified licenses explicitly show `active and valid`; the separate open/ended update window is informational and never expires perpetual use. Update eligibility uses the signed release date. Missing activations and verification failures show their specific reason. Stable builds check stable releases; RC builds check stable and `-rc.N` releases among the 100 most recent GitHub release records. All updates require the signed manifest and bundles from the selected exact tag. License files, claim codes and recovery tokens are human-owned; never ask for them or perform activation on the human's behalf. Normal ledger and agent work does not require online license verification. Automatic update checks can be disabled with `BEANKEEPER_NO_UPDATE_CHECK=1`. See [license and update commands](docs/license-updates.md).