Skip to main content
Glama
kristianfreeman

hledger MCP Server

README.md
# hledger MCP Server

MCP server that gives Claude access to [hledger](https://hledger.org/) commands for financial analysis.

*Built with Claude Code.*

## Setup

1. Install hledger: `brew install hledger`
2. Clone and build this repo
3. Set `LEDGER_FILE=path/to/your.journal`
4. Configure Claude Desktop (see below)

```bash
git clone https://github.com/kristianfreeman/hledger-mcp-server
cd hledger-mcp-server
npm install
npm run build
export LEDGER_FILE=/path/to/your/main.journal
```

## Available Commands

- `hledger_balance` - Account balances
- `hledger_register` - Transaction listing  
- `hledger_accounts` - List accounts
- `hledger_stats` - Journal statistics
- `hledger_balancesheet` - Balance sheet
- `hledger_incomestatement` - Income statement
- `hledger_cashflow` - Cash flow statement

## Claude Configuration

### Claude Code (CLI)
```bash
claude mcp add hledger-mcp-server -- node ./hledger-mcp-server/dist/index.js
```

### Claude Desktop
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "hledger": {
      "command": "node",
      "args": ["/absolute/path/to/hledger-mcp-server/dist/index.js"]
    }
  }
}
```

Then ask Claude: "Show me my account balances" or "What did I spend on groceries last month?"

## License

MIT License - see LICENSE file for details.

## Related Projects

- [hledger](https://hledger.org/) - Plain text accounting software
- [MCP Framework](https://github.com/QuantGeekDev/mcp-framework) - TypeScript MCP server framework
- [Model Context Protocol](https://modelcontextprotocol.io/) - Protocol specification