SuperAPIAI Directory

mcp-server-ledger

github.com · AI developer platforms

Manage financial transactions and generate reports with ledger-cli.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux · API

About this tool

Purpose

mcp-server-ledger is a server based on the Model Context Protocol (MCP) for interacting with Ledger CLI. Ledger CLI is a powerful double-entry accounting system usable from the command line. This server enables large language models to query and analyze financial data through a standardized interface, allowing AI assistants to help with financial reporting, budget analysis, and accounting tasks.

The server exposes the functionality of Ledger CLI through a standardized interface, making it convenient for AI assistants to help users handle financial reporting, budget analysis, and accounting tasks.

Main Capabilities

The server provides the following tools corresponding to Ledger CLI commands:

  • ledger_balance: Displays account balances, with powerful filtering options. Inputs include query patterns, date ranges, and display options; returns a formatted balance report.
  • ledger_register: Displays transaction flows and detailed history. Inputs include query patterns, date ranges, and sorting options; returns a formatted register report.
  • ledger_accounts: Lists all accounts in the Ledger file. Input is an optional query pattern; returns a list of matching accounts.
  • ledger_payees: Lists all payees in transactions. Input is an optional query pattern; returns a list of matching payees.
  • ledger_commodities: Lists all commodities (currencies) used. Input is an optional query pattern; returns a list of matching commodities.
  • ledger_print: Prints transactions in Ledger format. Inputs include query patterns and date ranges; returns formatted Ledger entries.
  • ledger_stats: Displays statistics for the Ledger file. Input is an optional query pattern; returns a statistical summary from Ledger.
  • ledger_budget: Displays budget analysis. Inputs include query patterns, date ranges, and reporting periods; returns a budget report.
  • ledger_raw_command: Runs raw Ledger CLI commands. Input is a list of command arguments as strings; returns the command output as text.

Usage

The following conditions must be met before use:

  • Ledger CLI is installed and available in PATH.
  • You have a valid Ledger file containing financial data.

The server requires a Ledger file path, which can be provided in the following ways:

  • The LEDGER_FILE environment variable
  • Command-line arguments when starting the server

Installation and running methods:

  • Using Docker (recommended): You can use the Docker image from the minhyeoky/mcp-ledger repository. You can add it to claude_desktop_config.json and replace /path/to/your/ledger/file.ledger with the actual Ledger file path. (The original text does not provide a complete configuration snippet.)
  • Install via Smithery: You can automatically install the Ledger CLI MCP Server for Claude Desktop via Smithery. (The original text does not provide the specific installation command.)
  • Using uv: This is the simplest way to install and run the server. (The original text does not provide the specific command.)

Using with Claude Desktop

After configuration is complete, you can ask the AI assistant questions about financial data, such as:

  • "Show me my expenses for the last month"
  • "What's my current balance in all accounts?"
  • "List all transactions with Amazon"
  • "How much did I spend on groceries in 2023?"
  • "Show me my budget performance for Q1"

The AI will use the corresponding Ledger CLI commands through this server to obtain information.

Local Testing

The original text mentions that more detailed local testing can be performed, but does not provide specific commands.

Development Notes

This server is built on the Model Context Protocol Python SDK. For more information about MCP and how to develop MCP servers, refer to the official documentation.

Ways to contribute:

  1. Clone the repository
  2. Install development dependencies
  3. Make changes
  4. Use the MCP inspector or integrate into Claude Testing in Desktop

Security Considerations

This server runs Ledger CLI commands on the user's financial data. Although it includes basic validation to prevent command injection, you should still:

  • Use it only with trusted clients
  • Be cautious with the exposed file paths
  • Review all commands before execution

License

This MCP server is licensed under the MIT License. You may freely use, modify, and distribute it in accordance with the license terms.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools