Metadata-Version: 2.5
Name: lekha-mcp
Version: 0.1.0
Summary: MCP server for Lekha API: parse Indian bank statement PDFs into transactions from Claude, Cursor, VS Code and other MCP clients.
Project-URL: Homepage, https://lekhaapi.com
Project-URL: Documentation, https://lekhaapi.com/api-docs
License-Expression: MIT
Keywords: bank statement,india,lekha,mcp,pdf
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<3,>=2.3
Description-Content-Type: text/markdown

# lekha-mcp

<!-- mcp-name: io.github.backstab319/lekha-mcp -->

An MCP server for [Lekha API](https://lekhaapi.com). It lets Claude, Cursor, VS Code, Gemini CLI, Codex and other
MCP clients turn Indian bank statement PDFs on your computer into transactions: dates, debits, credits and balances,
checked against the running balance.

Ask things like:

- "Convert ~/Downloads/kotak-april.pdf to a CSV in the same folder."
- "Parse these three SBI statements (password ABCD0101) and total the UPI debits per month."
- "How many Lekha credits do I have left?"

## Tools

| Tool | What it does |
|---|---|
| `parse_statement(pdf_path, password?, save_to?)` | Reads the PDF from disk, sends it to Lekha API and returns the statement. `save_to` writes `.csv` (transactions) or `.json` (everything). Statements over 100 transactions are saved beside the PDF as `<name>.lekha.json` and the reply has a summary. |
| `get_credits()` | Credits left on your account. Free. |

One credit is one PDF page, charged only when parsing succeeds. Supported: Kotak Mahindra Bank, Indian Bank, State
Bank of India, and other banks through a generic reader that answers only when every balance adds up.

## Setup

1. Sign in at [lekhaapi.com](https://lekhaapi.com/login) (new accounts get 50 free pages) and copy an API key from the
   dashboard.
2. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) if you don't have it (`uvx` comes with it).
3. Add the server to your client, replacing `your-key`:

**Claude Code**

```sh
claude mcp add lekha --env LEKHA_KEY=your-key -- uvx lekha-mcp
```

**Claude Desktop** (`claude_desktop_config.json`), **Cursor** (`~/.cursor/mcp.json`), **Gemini CLI**
(`~/.gemini/settings.json`), **Windsurf**:

```json
{
  "mcpServers": {
    "lekha": {
      "command": "uvx",
      "args": ["lekha-mcp"],
      "env": { "LEKHA_KEY": "your-key" }
    }
  }
}
```

**VS Code** (`.vscode/mcp.json`):

```json
{
  "servers": {
    "lekha": {
      "type": "stdio",
      "command": "uvx",
      "args": ["lekha-mcp"],
      "env": { "LEKHA_KEY": "your-key" }
    }
  }
}
```

**Codex CLI** (`~/.codex/config.toml`):

```toml
[mcp_servers.lekha]
command = "uvx"
args = ["lekha-mcp"]
env = { LEKHA_KEY = "your-key" }
```

The key sits in that config file, so don't commit it. `LEKHA_BASE_URL` overrides the API address (default
`https://lekhaapi.com`).

## Privacy

The PDF is read on your computer and sent only to Lekha API, which processes it in memory and stores nothing. The
parsed result goes back to your AI client, so it becomes part of that conversation and is handled under your AI
provider's terms. PDF passwords you give the assistant are sent once to open the file and never stored.

Docs: [lekhaapi.com/api-docs](https://lekhaapi.com/api-docs) · Support: support@lekhaapi.com
