Installation · Python 3.10+ · pip · Apache-2.0

Install bankstatementparser and parse your first statement

Get the core parser from PyPI, run a quick start against a CAMT, MT940 or CSV file, then add loaders, an Excel writer and the LSP/MCP integrations as you need them. Everything is open source and private by default.

Requirements

bankstatementparser is a pure-Python toolkit that runs wherever Python does.

  • Python 3.10 or newer. Check your version with python --version.
  • pip (or a compatible installer such as pipx or uv) to install from PyPI.
  • Linux, macOS or Windows. No system services or network access are required for the deterministic parsers.

The whole suite is released under the Apache-2.0 licence.

Install the core

Install the core parser (currently v0.0.11) from PyPI:

pip install bankstatementparser

Optional extras pull in heavier dependencies only when you need them — for example PDF handling or local-LLM support. Extras are declared like this:

# illustrative — check the README for the exact extra names
pip install "bankstatementparser[pdf]"

The extra names above are illustrative. The authoritative list of extras lives in the GitHub README and the package metadata on PyPI.

Quick start

Point the parser at a statement file — CAMT, MT940 or CSV — and iterate the resulting Transaction objects. Every format collapses to the same shape, so your downstream code is written once.

from bankstatementparser import parse

# Works the same way across CAMT, MT940 and CSV inputs.
statement = parse("statement.camt.xml")

for txn in statement.transactions:
    print(
        txn.date,
        txn.amount,
        txn.currency,
        txn.counterparty,
        txn.reference,
    )

Each Transaction exposes normalised fields such as date, amount, currency, counterparty and reference. The snippet above is deliberately generic — the exact function and class signatures are documented in the GitHub README.

PDFs & privacy

Structured formats are parsed deterministically on-device. PDFs fall through to a configurable local large language model — Ollama by default, or any provider that LiteLLM supports — with a local vision model handling scanned documents. Nothing leaves your machine unless you explicitly configure an external provider.

Configuration is illustrative below; see the README for the current environment variables and options:

# illustrative environment configuration
export BSP_LLM_PROVIDER="ollama"
export BSP_LLM_MODEL="llama3.1"
export BSP_LLM_BASE_URL="http://localhost:11434"

# a local vision model handles scanned PDFs
export BSP_VISION_MODEL="llama3.2-vision"

By default your statements never touch a third-party service. Pointing BSP_LLM_BASE_URL at a remote endpoint is an explicit, opt-in choice.

Loaders

Loaders extend the parser to extra statement formats, feeding the same unified Transaction model.

# BAI2 cash-management and lockbox files
pip install bankstatementparser-loader-bai2

# SWIFT MT942 interim transaction reports
pip install bankstatementparser-loader-mt942
  • bankstatementparser-loader-bai2 (v0.0.14) — use it for BAI2 cash-management and lockbox files. PyPI · GitHub
  • bankstatementparser-loader-mt942 (v0.0.14) — use it for SWIFT MT942 interim transaction reports. PyPI · GitHub

Export to Excel

The XLSX writer (v0.0.13) turns parsed statements into clean, formatted workbooks for analysts and auditors.

pip install bankstatementparser-writer-xlsx
from bankstatementparser import parse
from bankstatementparser_writer_xlsx import write_xlsx

statement = parse("statement.mt940")
write_xlsx(statement.transactions, "statement.xlsx")

See the writer on PyPI and GitHub. The exact writer API is documented in its README.

Editor & agent integrations

Two optional packages plug the parser into your editor and your AI agents.

# Language Server for editor tooling
pip install bankstatementparser-lsp

# Model Context Protocol server for agents
pip install bankstatementparser-mcp
  • bankstatementparser-lsp (v0.0.13) — an LSP server for editor tooling over statement files and mappings. PyPI · GitHub
  • bankstatementparser-mcp (v0.0.14) — an MCP server exposing the parser as tools for agents such as Claude, Cursor and Zed. PyPI · GitHub

Illustrative MCP client configuration

Most MCP-aware clients register servers under an mcpServers key. A minimal entry looks like this:

{
  "mcpServers": {
    "bankstatementparser": {
      "command": "bankstatementparser-mcp",
      "args": []
    }
  }
}

The exact configuration path and options depend on your client; check the MCP server README for details.

Next steps

You are installed and parsing. Dig into the docs, or explore how the suite fits together.