Skip to main content

The Beancount MCP Server is an experimental implementation that utilizes the Model Context Protocol (MCP) to enable AI assistants to query and analyze Beancount ledger files using Beancount Query Language (BQL) and the beanquery tool.

Project description

Beanquery MCP

The Beancount MCP Server is an experimental implementation of the Model Context Protocol (MCP) designed to interface with Beancount ledger files. Leveraging the Beancount Query Language (BQL) and the beanquery tool, this server enables seamless querying and analysis of financial data stored in Beancount format. By integrating MCP, the server facilitates standardized communication between AI assistants and Beancount ledgers, enhancing the accessibility and utility of financial data.

Note: This server is experimental and may undergo significant changes. It is recommended to use it in a development environment and provide feedback for further improvements.

A generated sample ledger can be found in sample.bean

Available Resources and Tools

  • Tools:
    • set_ledger_file: Set the Beancount ledger file to use for queries (if not set via environment variable).
    • run_query: Run a BQL query against the loaded Beancount file.
  • Resources:
    • beanquery://tables: Get a list of tables that BQL can access.
    • beanquery://accounts: Get a list of accounts in the loaded Beancount file.

Example using Claude.ai

screenshot

For a screenshot with expanded MCP interactions, see here.

⚠️ Privacy Warning

This tool interfaces with language model providers (LLMs) via the Model Context Protocol (MCP), and as such may transmit parts of your Beancount ledger—including potentially confidential or private financial information—to third-party services.

Please use this tool with caution, especially when:

  • Your ledger contains sensitive data (e.g., client names, salary details, health-related expenses).
  • You are using a cloud-hosted or non-self-hosted LLM backend.

Recommendations:

  • Mask or redact sensitive data in test ledgers.
  • Use self-hosted LLMs when possible.
  • Review the data being sent via MCP to ensure compliance with your privacy and security requirements.

[!CAUTION] You are responsible for the protection of your financial data. Do not share ledgers you would not be comfortable exposing.

Setup

Prerequisites

  • Python 3.10 or later
  • uv for managing Python projects (recommended)

Usage

Running the Server

  1. Development Mode: Use the MCP Inspector to test and debug your server:

    mcp dev server.py
    
  2. Claude Desktop Integration: Install the server into Claude Desktop:

    mcp install server.py
    
    • Quick Start:

      uv run mcp install server.py -v BEANCOUNT_LEDGER=$(pwd)/sample.bean --with beancount --with beanquery
      
    • Custom Name:

      uv run mcp install server.py --name "Beanquery MCP Server" --with beancount --with beanquery
      
    • Environment Variables:

      uv run mcp install server.py -v BEANCOUNT_LEDGER=/path/to/your/ledger.bean --with beancount --with beanquery
      uv run mcp install server.py -f .env --with beancount --with beanquery
      

Testing

Run the test suite using pytest:

pytest server_test.py

Contributing

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature-name
    
  3. Commit your changes:
    git commit -m "Add feature description"
    
  4. Push to your branch:
    git push origin feature-name
    
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mseep_beanquery_mcp-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mseep_beanquery_mcp-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file mseep_beanquery_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: mseep_beanquery_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mseep_beanquery_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c595dd89cb39bd00316fcef5d73db6ae4e546d5a2421cc04ce167927c74a1cd
MD5 53be1409dc054d51b0a479640e0de3ce
BLAKE2b-256 3539bf2c2b9b2b167769fcdbda4200bfbc26861f1a642703cf8d48aa2b7564e5

See more details on using hashes here.

File details

Details for the file mseep_beanquery_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mseep_beanquery_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43f77af665e13d8a285c250aa642da0c6a762194e874619fc557a5fb9fab67e1
MD5 a49ee405ad9dc048c382c73b89e11e0d
BLAKE2b-256 6702f3c38713c65a32d0ce4c3b9fb5ef77bdfc597683633cf5186b1b8dc1ee1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page