bankstatementparser-mcp 0.0.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ # Copyright (C) 2023-2026 Bank Statement Parser. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+ # implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """MCP server exposing the bankstatementparser library as agent tools.
17
+
18
+ Install with ``pip install bankstatementparser-mcp`` and run
19
+ ``bankstatementparser-mcp`` (stdio transport).
20
+ """
21
+
22
+ __version__ = "0.0.10"
@@ -0,0 +1,334 @@
1
+ # Copyright (C) 2023-2026 Bank Statement Parser. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+ # implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """BankStatementParser MCP server (stdio transport).
17
+
18
+ Tools, the resource, and the prompt are thin adapters over the
19
+ bankstatementparser parser core. The tools take **inline content**
20
+ (the raw text of a statement) plus a filename hint, because an MCP
21
+ client does not share the server's filesystem. Each call materialises
22
+ the content in a private temporary file, runs the same
23
+ ``create_parser`` pipeline the CLI uses, and returns plain
24
+ JSON-serialisable data.
25
+
26
+ Run it with::
27
+
28
+ bankstatementparser-mcp
29
+ """
30
+
31
+ from __future__ import annotations
32
+
33
+ import os
34
+ import tempfile
35
+ from collections.abc import Iterator
36
+ from contextlib import contextmanager
37
+ from pathlib import Path
38
+ from typing import Any
39
+
40
+ from bankstatementparser.additional_parsers import (
41
+ create_parser,
42
+ detect_statement_format,
43
+ )
44
+ from mcp.server.fastmcp import FastMCP
45
+
46
+ mcp = FastMCP("bankstatementparser")
47
+
48
+ _FORMAT_SUFFIX: dict[str, str] = {
49
+ "camt": ".xml",
50
+ "pain001": ".xml",
51
+ "csv": ".csv",
52
+ "ofx": ".ofx",
53
+ "qfx": ".qfx",
54
+ "mt940": ".mt940",
55
+ }
56
+
57
+
58
+ def _require_format(format_name: str) -> None:
59
+ """Reject an unsupported statement format.
60
+
61
+ Args:
62
+ format_name: The statement format to check.
63
+
64
+ Raises:
65
+ ValueError: If the format is not supported.
66
+ """
67
+ if format_name not in _FORMAT_SUFFIX:
68
+ supported = ", ".join(_FORMAT_SUFFIX)
69
+ raise ValueError(
70
+ f"Unsupported format '{format_name}'. Supported: {supported}"
71
+ )
72
+
73
+
74
+ def _suffix_for(filename: str | None, format_name: str | None) -> str:
75
+ """Choose the temp-file suffix for an inline payload.
76
+
77
+ Args:
78
+ filename: Optional original filename whose extension is reused
79
+ when it is one the parser accepts.
80
+ format_name: Optional explicit format, used when no usable
81
+ filename extension is available.
82
+
83
+ Returns:
84
+ A file suffix (including the leading dot) for the temp file.
85
+
86
+ Raises:
87
+ ValueError: If neither a usable extension nor a supported
88
+ format is provided.
89
+ """
90
+ if filename:
91
+ suffix = Path(filename).suffix.lower()
92
+ if suffix in set(_FORMAT_SUFFIX.values()) | {".sta"}:
93
+ return suffix
94
+ if format_name:
95
+ _require_format(format_name)
96
+ return _FORMAT_SUFFIX[format_name]
97
+ raise ValueError(
98
+ "Provide a 'filename' with a supported extension "
99
+ "(.xml/.csv/.ofx/.qfx/.mt940/.sta) or an explicit 'format'."
100
+ )
101
+
102
+
103
+ @contextmanager
104
+ def _materialise(content: str, suffix: str) -> Iterator[Path]:
105
+ """Write inline content to a private temp file for one call.
106
+
107
+ A closed-then-reopened temp file (via :func:`tempfile.mkstemp`) is
108
+ used rather than an open ``NamedTemporaryFile`` so the file-based
109
+ parsers can reopen the path by name.
110
+
111
+ Args:
112
+ content: The raw statement text supplied by the client.
113
+ suffix: The file suffix to give the temp file.
114
+
115
+ Yields:
116
+ The path to the temporary file (removed on exit).
117
+ """
118
+ fd, name = tempfile.mkstemp(suffix=suffix)
119
+ try:
120
+ with os.fdopen(fd, "w", encoding="utf-8") as handle:
121
+ handle.write(content)
122
+ yield Path(name)
123
+ finally:
124
+ os.unlink(name)
125
+
126
+
127
+ def _summary_to_jsonable(summary: dict[str, Any]) -> dict[str, Any]:
128
+ """Coerce a summary record to JSON-serialisable primitives.
129
+
130
+ Args:
131
+ summary: The raw summary record from a parser.
132
+
133
+ Returns:
134
+ The same mapping with non-primitive values stringified.
135
+ """
136
+ jsonable: dict[str, Any] = {}
137
+ for key, value in summary.items():
138
+ if value is None or isinstance(value, str | int | bool):
139
+ jsonable[key] = value
140
+ else:
141
+ jsonable[key] = str(value)
142
+ return jsonable
143
+
144
+
145
+ @mcp.tool()
146
+ def list_supported_formats() -> list[str]:
147
+ """List every bank statement format the parser can read.
148
+
149
+ Returns:
150
+ The supported format identifiers.
151
+ """
152
+ return list(_FORMAT_SUFFIX)
153
+
154
+
155
+ @mcp.tool()
156
+ def detect_format(content: str, filename: str = "statement.xml") -> str:
157
+ """Detect which statement format a payload is.
158
+
159
+ Args:
160
+ content: The raw statement text.
161
+ filename: Original filename; its extension is the primary hint.
162
+
163
+ Returns:
164
+ The detected format identifier.
165
+
166
+ Raises:
167
+ ValueError: If the format cannot be detected.
168
+ """
169
+ suffix = _suffix_for(filename, None)
170
+ with _materialise(content, suffix) as path:
171
+ return detect_statement_format(path)
172
+
173
+
174
+ @mcp.tool()
175
+ def parse_statement(
176
+ content: str,
177
+ filename: str = "statement.xml",
178
+ format: str | None = None,
179
+ limit: int | None = None,
180
+ ) -> dict[str, Any]:
181
+ """Parse a statement into structured transactions and a summary.
182
+
183
+ Args:
184
+ content: The raw statement text.
185
+ filename: Original filename; its extension selects the format
186
+ when ``format`` is omitted.
187
+ format: Explicit format override.
188
+ limit: Optional cap on returned transaction rows.
189
+
190
+ Returns:
191
+ A dict with the resolved ``format``, ``columns``, full
192
+ ``transaction_count``, the (possibly truncated) ``transactions``
193
+ as row dicts, and the statement ``summary``.
194
+
195
+ Raises:
196
+ ValueError: If the format is unsupported or cannot be detected.
197
+ """
198
+ if format is not None:
199
+ _require_format(format)
200
+ suffix = _suffix_for(filename, format)
201
+ with _materialise(content, suffix) as path:
202
+ parser = create_parser(path, format)
203
+ frame = parser.parse()
204
+ summary = _summary_to_jsonable(dict(parser.get_summary()))
205
+ records = frame.to_dict("records")
206
+ total = len(records)
207
+ if limit is not None:
208
+ records = records[:limit]
209
+ return {
210
+ "format": format or detect_statement_format(path),
211
+ "columns": list(frame.columns),
212
+ "transaction_count": total,
213
+ "transactions": [
214
+ {k: (v if v is None else str(v)) for k, v in row.items()}
215
+ for row in records
216
+ ],
217
+ "summary": summary,
218
+ }
219
+
220
+
221
+ @mcp.tool()
222
+ def validate_statement(
223
+ content: str,
224
+ filename: str = "statement.xml",
225
+ format: str | None = None,
226
+ ) -> dict[str, Any]:
227
+ """Check whether a statement parses cleanly (a dry run).
228
+
229
+ Args:
230
+ content: The raw statement text.
231
+ filename: Original filename; its extension selects the format.
232
+ format: Explicit format override.
233
+
234
+ Returns:
235
+ A dict with ``is_valid``, the resolved ``format``, the
236
+ ``transaction_count`` on success, and an ``error`` on failure.
237
+ """
238
+ if format is not None:
239
+ _require_format(format)
240
+ try:
241
+ suffix = _suffix_for(filename, format)
242
+ with _materialise(content, suffix) as path:
243
+ resolved = format or detect_statement_format(path)
244
+ parser = create_parser(path, format)
245
+ frame = parser.parse()
246
+ return {
247
+ "is_valid": True,
248
+ "format": resolved,
249
+ "transaction_count": len(frame),
250
+ "error": None,
251
+ }
252
+ except Exception as exc:
253
+ return {
254
+ "is_valid": False,
255
+ "format": format,
256
+ "transaction_count": 0,
257
+ "error": str(exc),
258
+ }
259
+
260
+
261
+ @mcp.tool()
262
+ def summarize_statement(
263
+ content: str,
264
+ filename: str = "statement.xml",
265
+ format: str | None = None,
266
+ ) -> dict[str, Any]:
267
+ """Return only the statement summary (no per-transaction rows).
268
+
269
+ Args:
270
+ content: The raw statement text.
271
+ filename: Original filename; its extension selects the format.
272
+ format: Explicit format override.
273
+
274
+ Returns:
275
+ The summary record with Decimal values stringified.
276
+
277
+ Raises:
278
+ ValueError: If the format is unsupported or cannot be detected.
279
+ """
280
+ if format is not None:
281
+ _require_format(format)
282
+ suffix = _suffix_for(filename, format)
283
+ with _materialise(content, suffix) as path:
284
+ parser = create_parser(path, format)
285
+ return _summary_to_jsonable(dict(parser.get_summary()))
286
+
287
+
288
+ @mcp.resource("bankstatementparser://formats")
289
+ def formats_resource() -> str:
290
+ """Describe each supported statement format and its file extensions.
291
+
292
+ Returns:
293
+ A human-readable catalogue of the supported formats.
294
+ """
295
+ lines = [
296
+ "BankStatementParser supported input formats:",
297
+ "",
298
+ "- camt : ISO 20022 CAMT.053 statements (.xml)",
299
+ "- pain001 : ISO 20022 pain.001 credit-transfer (.xml)",
300
+ "- csv : delimited statement exports (.csv)",
301
+ "- ofx : Open Financial Exchange (.ofx)",
302
+ "- qfx : Quicken Financial Exchange (.qfx)",
303
+ "- mt940 : SWIFT MT940 statement messages (.mt940, .sta)",
304
+ ]
305
+ return "\n".join(lines)
306
+
307
+
308
+ @mcp.prompt()
309
+ def analyze_statement(filename: str = "statement.xml") -> str:
310
+ """Guided prompt for reading and reconciling a bank statement.
311
+
312
+ Args:
313
+ filename: The statement filename being analysed.
314
+
315
+ Returns:
316
+ A prompt string instructing the model how to proceed.
317
+ """
318
+ return (
319
+ f"Help me analyse the bank statement '{filename}'. First call "
320
+ "detect_format with its content to confirm the format, then "
321
+ "validate_statement to make sure it parses, then parse_statement "
322
+ "to read the transactions and summarize_statement for the "
323
+ "opening/closing balances. Reconcile the transaction total "
324
+ "against the balances and flag anything that looks off."
325
+ )
326
+
327
+
328
+ def main() -> None: # pragma: no cover - process entry point
329
+ """Run the BankStatementParser MCP server over stdio."""
330
+ mcp.run()
331
+
332
+
333
+ if __name__ == "__main__": # pragma: no cover
334
+ main()
@@ -0,0 +1,309 @@
1
+ Metadata-Version: 2.4
2
+ Name: bankstatementparser-mcp
3
+ Version: 0.0.10
4
+ Summary: Model Context Protocol (MCP) server exposing the bankstatementparser bank statement parsing library as agent tools.
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Author: Sebastien Rousseau
8
+ Author-email: sebastian.rousseau@gmail.com
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Dist: bankstatementparser (>=0.0.9)
18
+ Requires-Dist: mcp (>=1.2)
19
+ Project-URL: Homepage, https://bankstatementparser.com
20
+ Project-URL: Repository, https://github.com/sebastienrousseau/bankstatementparser-mcp
21
+ Description-Content-Type: text/markdown
22
+
23
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
24
+
25
+ <p align="center">
26
+ <img
27
+ src="https://cloudcdn.pro/bankstatementparser/v1/logos/bankstatementparser.svg"
28
+ alt="bankstatementparser-mcp logo"
29
+ width="120"
30
+ height="120"
31
+ />
32
+ </p>
33
+
34
+ <h1 align="center">bankstatementparser-mcp</h1>
35
+
36
+ <p align="center">
37
+ <b>Model Context Protocol server exposing the bankstatementparser library as first-class agent tools for reading bank statements.</b>
38
+ </p>
39
+
40
+ <p align="center">
41
+ <a href="https://pypi.org/project/bankstatementparser-mcp/"><img src="https://img.shields.io/pypi/v/bankstatementparser-mcp?style=for-the-badge" alt="PyPI version" /></a>
42
+ <a href="https://pypi.org/project/bankstatementparser-mcp/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser-mcp.svg?style=for-the-badge" alt="Python versions" /></a>
43
+ <a href="https://pypi.org/project/bankstatementparser-mcp/"><img src="https://img.shields.io/pypi/dm/bankstatementparser-mcp.svg?style=for-the-badge" alt="PyPI downloads" /></a>
44
+ <a href="https://github.com/sebastienrousseau/bankstatementparser-mcp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser-mcp/ci.yml?branch=main&label=Tests&style=for-the-badge" alt="Tests" /></a>
45
+ <a href="https://github.com/sebastienrousseau/bankstatementparser-mcp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser-mcp/ci.yml?branch=main&label=Coverage&style=for-the-badge" alt="Coverage" /></a>
46
+ <a href="#license"><img src="https://img.shields.io/pypi/l/bankstatementparser-mcp?style=for-the-badge" alt="License" /></a>
47
+ <a href="https://glama.ai/mcp/servers/sebastienrousseau/bankstatementparser-mcp"><img src="https://glama.ai/mcp/servers/sebastienrousseau/bankstatementparser-mcp/badges/score.svg" alt="Glama MCP server score" /></a>
48
+ </p>
49
+
50
+ ---
51
+
52
+ ## Contents
53
+
54
+ **Getting started**
55
+
56
+ - [What is bankstatementparser-mcp?](#what-is-bankstatementparser-mcp) — the problem it solves
57
+ - [Install](#install) — PyPI, virtualenv, Docker
58
+ - [Quick start](#quick-start) — register with Claude Desktop in 30 seconds
59
+
60
+ **Library reference**
61
+
62
+ - [Tools](#tools) — the five tools, one resource, one prompt
63
+ - [Using the tools](#using-the-tools) — call them in-process from Python
64
+
65
+ **Operational**
66
+
67
+ - [When not to use bankstatementparser-mcp](#when-not-to-use-bankstatementparser-mcp) — honest boundaries
68
+ - [Development](#development) — gates, make targets
69
+ - [Security](#security) — sandboxing posture
70
+ - [Documentation](#documentation) — examples, guides
71
+ - [Contributing](#contributing) — how to get changes in
72
+ - [License](#license) — Apache-2.0
73
+
74
+ ---
75
+
76
+ ## What is bankstatementparser-mcp?
77
+
78
+ The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is
79
+ an open standard that lets AI agents discover and call external tools in
80
+ a uniform way. **bankstatementparser-mcp** is the MCP server that turns the
81
+ [`bankstatementparser`](https://github.com/sebastienrousseau/bankstatementparser)
82
+ library into first-class agent tools — so an assistant can read,
83
+ validate, and summarise **bank statements** in formats such as ISO 20022
84
+ CAMT.053, SWIFT MT940, OFX/QFX, and CSV directly from a conversation.
85
+
86
+ Every tool is a thin wrapper over the `bankstatementparser` parser core
87
+ (`create_parser`, `detect_statement_format`), so the results behave
88
+ identically to the CLI. Because an MCP client does not share the
89
+ server's filesystem, the tools take **inline statement content** (plus a
90
+ filename hint) and materialise it in a private temporary file for the
91
+ duration of a single call. Tools return JSON-serialisable data.
92
+
93
+ | Concern | How bankstatementparser-mcp handles it |
94
+ | :--- | :--- |
95
+ | Transport | stdio (FastMCP default); zero config beyond the client manifest |
96
+ | Input model | Inline content + filename hint; no shared filesystem required |
97
+ | Format fidelity | Tools delegate to `bankstatementparser`'s `create_parser` pipeline |
98
+ | Format detection | `detect_format` mirrors the library's `detect_statement_format` |
99
+ | Validation | `validate_statement` is a dry run that returns structured results |
100
+ | Isolation | Each call writes to a private temp file that is deleted on exit |
101
+
102
+ ---
103
+
104
+ ## Install
105
+
106
+ | Channel | Command | Notes |
107
+ | :--- | :--- | :--- |
108
+ | PyPI | `pip install bankstatementparser-mcp` | Pulls in `bankstatementparser >= 0.0.9` + MCP SDK |
109
+ | Source | `git clone https://github.com/sebastienrousseau/bankstatementparser-mcp && cd bankstatementparser-mcp && poetry install` | For development |
110
+ | Docker (GHCR) | `docker pull ghcr.io/sebastienrousseau/bankstatementparser-mcp:latest` | Multi-arch (linux/amd64, linux/arm64); runs `bankstatementparser-mcp` over stdio |
111
+
112
+ Requires Python 3.10 or later. Works on macOS, Linux, and Windows.
113
+
114
+ <details>
115
+ <summary>Using an isolated virtual environment (recommended)</summary>
116
+
117
+ ```sh
118
+ python -m venv venv
119
+ source venv/bin/activate # macOS/Linux
120
+ venv\Scripts\activate # Windows
121
+ python -m pip install -U bankstatementparser-mcp
122
+ ```
123
+
124
+ </details>
125
+
126
+ ---
127
+
128
+ ## Quick start
129
+
130
+ Register the server with any MCP client (Claude Desktop shown):
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "bankstatementparser": { "command": "bankstatementparser-mcp" }
136
+ }
137
+ }
138
+ ```
139
+
140
+ That's it. Restart the client and the tools are available to the agent.
141
+
142
+ The server speaks JSON-RPC over stdin/stdout — it is meant to be
143
+ launched by an MCP client, not used interactively.
144
+
145
+ ---
146
+
147
+ ## Tools
148
+
149
+ All tools delegate to the `bankstatementparser` parser core, so they
150
+ behave identically to the library.
151
+
152
+ | Tool | Purpose |
153
+ | :--- | :--- |
154
+ | `list_supported_formats` | List every bank statement format the parser can read |
155
+ | `detect_format` | Detect which statement format an inline payload is |
156
+ | `parse_statement` | Parse a statement into structured transactions plus a summary |
157
+ | `validate_statement` | Dry-run check whether a statement parses cleanly |
158
+ | `summarize_statement` | Return only the statement summary (no per-transaction rows) |
159
+
160
+ Plus one resource and one prompt:
161
+
162
+ | Kind | Name | Purpose |
163
+ | :--- | :--- | :--- |
164
+ | Resource | `bankstatementparser://formats` | Read-only catalogue of supported formats and their file extensions |
165
+ | Prompt | `analyze_statement` | Guided multi-step prompt that walks an agent through reading and reconciling a statement |
166
+
167
+ Supported formats: `camt` (ISO 20022 CAMT.053, `.xml`), `pain001`
168
+ (ISO 20022 pain.001, `.xml`), `csv` (`.csv`), `ofx` (`.ofx`), `qfx`
169
+ (`.qfx`), and `mt940` (SWIFT MT940, `.mt940` / `.sta`).
170
+
171
+ ---
172
+
173
+ ## Using the tools
174
+
175
+ The tools are plain functions on the `bankstatementparser_mcp.server`
176
+ module, so you can call them in-process:
177
+
178
+ ```python
179
+ from bankstatementparser_mcp.server import (
180
+ detect_format,
181
+ parse_statement,
182
+ summarize_statement,
183
+ )
184
+
185
+ csv = (
186
+ "date,description,amount,currency,balance\n"
187
+ "2023-01-02,Salary,500.00,EUR,1500.00\n"
188
+ "2023-01-03,Groceries,-40.50,EUR,1459.50\n"
189
+ )
190
+
191
+ # 1. Detect the format from the filename hint + content.
192
+ print(detect_format(csv, "statement.csv"))
193
+ # -> csv
194
+
195
+ # 2. Parse the statement into structured rows + a summary.
196
+ parsed = parse_statement(csv, "statement.csv")
197
+ print(parsed["transaction_count"], parsed["columns"])
198
+
199
+ # 3. Read just the opening/closing balances.
200
+ print(summarize_statement(csv, "statement.csv"))
201
+ ```
202
+
203
+ The resource and prompt are plain functions too: `formats_resource`
204
+ backs `bankstatementparser://formats`, and `analyze_statement` returns
205
+ the guided multi-step prompt.
206
+
207
+ ```python
208
+ from bankstatementparser_mcp.server import (
209
+ analyze_statement,
210
+ formats_resource,
211
+ )
212
+
213
+ print(formats_resource()) # the supported-formats catalogue
214
+ print(analyze_statement("statement.csv")) # the guided analysis prompt
215
+ ```
216
+
217
+ See the [`examples/`](examples/) folder for runnable walkthroughs,
218
+ including [`04_resource_and_prompt.py`](examples/04_resource_and_prompt.py).
219
+
220
+ ---
221
+
222
+ ## When not to use bankstatementparser-mcp
223
+
224
+ - **You're not driving an MCP-aware agent.** Use the
225
+ [`bankstatementparser`](https://pypi.org/project/bankstatementparser/)
226
+ CLI or library directly — it exposes the same surface with less
227
+ indirection.
228
+ - **You need to parse files already on disk in bulk.** The library's
229
+ CLI reads paths directly and avoids the inline-content round-trip the
230
+ MCP tools use.
231
+
232
+ ---
233
+
234
+ ## Development
235
+
236
+ `bankstatementparser-mcp` uses [Poetry](https://python-poetry.org/) and
237
+ [mise](https://mise.jdx.dev/).
238
+
239
+ ```bash
240
+ git clone https://github.com/sebastienrousseau/bankstatementparser-mcp.git
241
+ cd bankstatementparser-mcp
242
+ mise install
243
+ poetry install
244
+ ```
245
+
246
+ A `Makefile` orchestrates the quality gates (kept in lockstep with CI):
247
+
248
+ | Target | What it runs |
249
+ | :--- | :--- |
250
+ | `make check` | All gates (REQUIRED before commit) |
251
+ | `make test` | `pytest --cov=bankstatementparser_mcp --cov-branch --cov-fail-under=100` |
252
+ | `make lint` | `ruff check` + `black --check` |
253
+ | `make type-check` | `mypy --strict` |
254
+ | `make docs` | `interrogate --fail-under=100` (docstring coverage) |
255
+
256
+ Current state (v0.0.10): **100% line + branch coverage** against a 100%
257
+ enforced floor, mypy `--strict` clean, interrogate 100%.
258
+
259
+ ---
260
+
261
+ ## Security
262
+
263
+ - **No persistent filesystem writes from tools.** Each call writes the
264
+ inline content to a private temporary file that is deleted as soon as
265
+ the call returns.
266
+ - **Validation failures** from `validate_statement` are returned as
267
+ structured `{"is_valid": false, "error": ...}` payloads — never as
268
+ stack traces.
269
+ - **Dependencies** are pinned via `poetry.lock` and audited by
270
+ `pip-audit` and Bandit in CI.
271
+
272
+ To report a vulnerability, please use
273
+ [GitHub private vulnerability reporting](https://github.com/sebastienrousseau/bankstatementparser-mcp/security)
274
+ rather than a public issue.
275
+
276
+ ---
277
+
278
+ ## Documentation
279
+
280
+ - **Runnable examples:** [`examples/`](https://github.com/sebastienrousseau/bankstatementparser-mcp/tree/main/examples)
281
+ - **Release history:** [CHANGELOG.md](https://github.com/sebastienrousseau/bankstatementparser-mcp/blob/main/CHANGELOG.md)
282
+ - **MCP specification:** [modelcontextprotocol.io](https://modelcontextprotocol.io)
283
+
284
+ ---
285
+
286
+ ## Contributing
287
+
288
+ Contributions are welcome — see the
289
+ [contributing instructions](https://github.com/sebastienrousseau/bankstatementparser-mcp/blob/main/CONTRIBUTING.md).
290
+ Thanks to all the
291
+ [contributors](https://github.com/sebastienrousseau/bankstatementparser-mcp/graphs/contributors)
292
+ who have helped build `bankstatementparser-mcp`.
293
+
294
+ ---
295
+
296
+ ## License
297
+
298
+ Licensed under the [Apache License, Version 2.0](https://opensource.org/license/apache-2-0/).
299
+ Any contribution submitted for inclusion shall be licensed as above,
300
+ without additional terms.
301
+
302
+ ---
303
+
304
+ <p align="center">
305
+ <a href="https://bankstatementparser.com">bankstatementparser.com</a> ·
306
+ <a href="https://pypi.org/project/bankstatementparser-mcp/">PyPI</a> ·
307
+ <a href="https://github.com/sebastienrousseau/bankstatementparser-mcp">GitHub</a>
308
+ </p>
309
+
@@ -0,0 +1,7 @@
1
+ bankstatementparser_mcp/__init__.py,sha256=xo5GNbytX1OmD6GrWqDAL3sefGXjA9EQ5DDYR4vtQdQ,823
2
+ bankstatementparser_mcp/server.py,sha256=VJZ0kS_YM1LGgswe42ZMoEnFlrYcQyZhuwEn_2GRloI,10317
3
+ bankstatementparser_mcp-0.0.10.dist-info/METADATA,sha256=MAXursIJ_Xtf5z1mK1OrUDqhAEBC1quGlMcsE-n8n4k,11860
4
+ bankstatementparser_mcp-0.0.10.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
5
+ bankstatementparser_mcp-0.0.10.dist-info/entry_points.txt,sha256=0fMgDHFjvHlg3k_otbSQKvpyNm0jFtklb_J6B29BDLE,79
6
+ bankstatementparser_mcp-0.0.10.dist-info/licenses/LICENSE,sha256=BhsQ65IVGLlScIgEHcMm2leCnoRbQqwPcLd7N2c8Gt0,10244
7
+ bankstatementparser_mcp-0.0.10.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.4.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ bankstatementparser-mcp=bankstatementparser_mcp.server:main
3
+
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to the Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by the Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding any notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ Copyright 2023-2026 Sebastien Rousseau
178
+
179
+ Licensed under the Apache License, Version 2.0 (the "License");
180
+ you may not use this file except in compliance with the License.
181
+ You may obtain a copy of the License at
182
+
183
+ http://www.apache.org/licenses/LICENSE-2.0
184
+
185
+ Unless required by applicable law or agreed to in writing, software
186
+ distributed under the License is distributed on an "AS IS" BASIS,
187
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
+ See the License for the specific language governing permissions and
189
+ limitations under the License.