Skip to main content

Model Context Protocol (MCP) server exposing the bankstatementparser bank statement parsing library as agent tools.

Project description

bankstatementparser-mcp logo

bankstatementparser-mcp

Model Context Protocol server exposing the bankstatementparser library as first-class agent tools for reading bank statements.

PyPI version Python versions PyPI downloads Tests Coverage License Glama MCP server score


Contents

Getting started

Library reference

  • Tools — the five tools, one resource, one prompt
  • Using the tools — call them in-process from Python

Operational


What is bankstatementparser-mcp?

The Model Context Protocol (MCP) is an open standard that lets AI agents discover and call external tools in a uniform way. bankstatementparser-mcp is the MCP server that turns the bankstatementparser library into first-class agent tools — so an assistant can read, validate, and summarise bank statements in formats such as ISO 20022 CAMT.053, SWIFT MT940, OFX/QFX, and CSV directly from a conversation.

Every tool is a thin wrapper over the bankstatementparser parser core (create_parser, detect_statement_format), so the results behave identically to the CLI. Because an MCP client does not share the server's filesystem, the tools take inline statement content (plus a filename hint) and materialise it in a private temporary file for the duration of a single call. Tools return JSON-serialisable data.

Concern How bankstatementparser-mcp handles it
Transport stdio (FastMCP default); zero config beyond the client manifest
Input model Inline content + filename hint; no shared filesystem required
Format fidelity Tools delegate to bankstatementparser's create_parser pipeline
Format detection detect_format mirrors the library's detect_statement_format
Validation validate_statement is a dry run that returns structured results
Isolation Each call writes to a private temp file that is deleted on exit

Install

Channel Command Notes
PyPI pip install bankstatementparser-mcp Pulls in bankstatementparser >= 0.0.9 + MCP SDK
Source git clone https://github.com/sebastienrousseau/bankstatementparser-mcp && cd bankstatementparser-mcp && poetry install For development
Docker (GHCR) docker pull ghcr.io/sebastienrousseau/bankstatementparser-mcp:latest Multi-arch (linux/amd64, linux/arm64); runs bankstatementparser-mcp over stdio

Requires Python 3.10 or later. Works on macOS, Linux, and Windows.

Using an isolated virtual environment (recommended)
python -m venv venv
source venv/bin/activate        # macOS/Linux
venv\Scripts\activate           # Windows
python -m pip install -U bankstatementparser-mcp

Quick start

Register the server with any MCP client (Claude Desktop shown):

{
  "mcpServers": {
    "bankstatementparser": { "command": "bankstatementparser-mcp" }
  }
}

That's it. Restart the client and the tools are available to the agent.

The server speaks JSON-RPC over stdin/stdout — it is meant to be launched by an MCP client, not used interactively.


Tools

All tools delegate to the bankstatementparser parser core, so they behave identically to the library.

Tool Purpose
list_supported_formats List every bank statement format the parser can read
detect_format Detect which statement format an inline payload is
parse_statement Parse a statement into structured transactions plus a summary
validate_statement Dry-run check whether a statement parses cleanly
summarize_statement Return only the statement summary (no per-transaction rows)

Plus one resource and one prompt:

Kind Name Purpose
Resource bankstatementparser://formats Read-only catalogue of supported formats and their file extensions
Prompt analyze_statement Guided multi-step prompt that walks an agent through reading and reconciling a statement

Supported formats: camt (ISO 20022 CAMT.053, .xml), pain001 (ISO 20022 pain.001, .xml), csv (.csv), ofx (.ofx), qfx (.qfx), and mt940 (SWIFT MT940, .mt940 / .sta).


Using the tools

The tools are plain functions on the bankstatementparser_mcp.server module, so you can call them in-process:

from bankstatementparser_mcp.server import (
    detect_format,
    parse_statement,
    summarize_statement,
)

csv = (
    "date,description,amount,currency,balance\n"
    "2023-01-02,Salary,500.00,EUR,1500.00\n"
    "2023-01-03,Groceries,-40.50,EUR,1459.50\n"
)

# 1. Detect the format from the filename hint + content.
print(detect_format(csv, "statement.csv"))
# -> csv

# 2. Parse the statement into structured rows + a summary.
parsed = parse_statement(csv, "statement.csv")
print(parsed["transaction_count"], parsed["columns"])

# 3. Read just the opening/closing balances.
print(summarize_statement(csv, "statement.csv"))

The resource and prompt are plain functions too: formats_resource backs bankstatementparser://formats, and analyze_statement returns the guided multi-step prompt.

from bankstatementparser_mcp.server import (
    analyze_statement,
    formats_resource,
)

print(formats_resource())          # the supported-formats catalogue
print(analyze_statement("statement.csv"))  # the guided analysis prompt

See the examples/ folder for runnable walkthroughs, including 04_resource_and_prompt.py.


When not to use bankstatementparser-mcp

  • You're not driving an MCP-aware agent. Use the bankstatementparser CLI or library directly — it exposes the same surface with less indirection.
  • You need to parse files already on disk in bulk. The library's CLI reads paths directly and avoids the inline-content round-trip the MCP tools use.

Development

bankstatementparser-mcp uses Poetry and mise.

git clone https://github.com/sebastienrousseau/bankstatementparser-mcp.git
cd bankstatementparser-mcp
mise install
poetry install

A Makefile orchestrates the quality gates (kept in lockstep with CI):

Target What it runs
make check All gates (REQUIRED before commit)
make test pytest --cov=bankstatementparser_mcp --cov-branch --cov-fail-under=100
make lint ruff check + black --check
make type-check mypy --strict
make docs interrogate --fail-under=100 (docstring coverage)

Current state (v0.0.11): 100% line + branch coverage against a 100% enforced floor, mypy --strict clean, interrogate 100%.


Security

  • No persistent filesystem writes from tools. Each call writes the inline content to a private temporary file that is deleted as soon as the call returns.
  • Validation failures from validate_statement are returned as structured {"is_valid": false, "error": ...} payloads — never as stack traces.
  • Dependencies are pinned via poetry.lock and audited by pip-audit and Bandit in CI.

To report a vulnerability, please use GitHub private vulnerability reporting rather than a public issue.


Documentation


Contributing

Contributions are welcome — see the contributing instructions. Thanks to all the contributors who have helped build bankstatementparser-mcp.


License

Licensed under the Apache License, Version 2.0. Any contribution submitted for inclusion shall be licensed as above, without additional terms.


bankstatementparser.com · PyPI · GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bankstatementparser_mcp-0.0.11.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bankstatementparser_mcp-0.0.11-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file bankstatementparser_mcp-0.0.11.tar.gz.

File metadata

  • Download URL: bankstatementparser_mcp-0.0.11.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bankstatementparser_mcp-0.0.11.tar.gz
Algorithm Hash digest
SHA256 6b3f91b41e6d7331f689e1bb3e7f99ae6129155734b05d7619b109cd5e7444e5
MD5 d7d5c261afcbe11d765b50ddf2747c53
BLAKE2b-256 d160e7c8eedc70d6a7eb5d6aa5c83a763b4c0cd830a6a81a65061d088682d620

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankstatementparser_mcp-0.0.11.tar.gz:

Publisher: release.yml on sebastienrousseau/bankstatementparser-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bankstatementparser_mcp-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for bankstatementparser_mcp-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 94cbc649014e8718d5f511e4e08e31cd3c446a410886282f003b796b9ba1d15d
MD5 29e62a2305a2eae31603309700d40df2
BLAKE2b-256 406886857a6bef1e14b6ab5e09d0d15a61ac77b546a50baccac017da56c4e80c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankstatementparser_mcp-0.0.11-py3-none-any.whl:

Publisher: release.yml on sebastienrousseau/bankstatementparser-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page