Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

beanquery-mcp

MCP.Pizza Chef: vanto

The beanquery-mcp server is an experimental MCP server that integrates with Beancount ledger files, allowing AI assistants to query and analyze financial data using the Beancount Query Language (BQL) and the beanquery tool. It standardizes communication between AI models and Beancount ledgers, facilitating real-time, structured financial data access and analysis. Ideal for developers working with financial ledgers and AI-driven workflows, it supports enhanced data querying and financial insights through MCP.

Use This MCP server To

Query Beancount ledger files using natural language and BQL Analyze financial transactions and balances programmatically Integrate AI assistants with Beancount for real-time data access Automate financial report generation from ledger data Validate and explore ledger entries via AI-driven queries Develop custom financial analytics tools using MCP and Beancount

README

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.

beanquery-mcp FAQ

How do I set up the beanquery-mcp server?
Clone the repository, install dependencies, and run the server as per the README instructions; ensure you have Beancount ledger files ready for querying.
Can I use beanquery-mcp with any Beancount ledger file?
Yes, the server is designed to work with standard Beancount ledger files, enabling queries across your financial data.
Is beanquery-mcp compatible with multiple LLM providers?
Yes, it supports integration with various LLMs like OpenAI, Anthropic Claude, and Google Gemini through the MCP protocol.
What kind of queries can I run with beanquery-mcp?
You can run Beancount Query Language (BQL) queries to extract transactions, balances, and other financial insights from your ledger.
Is beanquery-mcp production-ready?
It is currently experimental and recommended for development environments; feedback is encouraged for improvements.
How does beanquery-mcp enhance AI assistant capabilities?
It enables AI assistants to access and analyze structured financial data in real-time, improving financial decision-making workflows.
Can I extend beanquery-mcp with custom tools?
Yes, the server architecture allows adding custom tools and resources to tailor financial data interactions.