mcp-einvoicing-be 0.1.0__tar.gz

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.
Files changed (36) hide show
  1. mcp_einvoicing_be-0.1.0/.github/workflows/ci.yml +67 -0
  2. mcp_einvoicing_be-0.1.0/.github/workflows/publish.yml +72 -0
  3. mcp_einvoicing_be-0.1.0/.gitignore +49 -0
  4. mcp_einvoicing_be-0.1.0/.python-version +1 -0
  5. mcp_einvoicing_be-0.1.0/CHANGELOG.md +28 -0
  6. mcp_einvoicing_be-0.1.0/CONTRIBUTING.md +67 -0
  7. mcp_einvoicing_be-0.1.0/LICENSE +174 -0
  8. mcp_einvoicing_be-0.1.0/PKG-INFO +325 -0
  9. mcp_einvoicing_be-0.1.0/README.md +289 -0
  10. mcp_einvoicing_be-0.1.0/pyproject.toml +83 -0
  11. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/__init__.py +3 -0
  12. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/models/__init__.py +25 -0
  13. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/models/invoice.py +86 -0
  14. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/models/party.py +49 -0
  15. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/server.py +44 -0
  16. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/standards/__init__.py +1 -0
  17. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/standards/mercurius.py +62 -0
  18. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/standards/peppol_bis_3.py +137 -0
  19. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/standards/pint_be.py +60 -0
  20. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/standards/ubl.py +191 -0
  21. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/tools/__init__.py +1 -0
  22. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/tools/generation.py +62 -0
  23. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/tools/lookup.py +125 -0
  24. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/tools/transformation.py +55 -0
  25. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/tools/validation.py +105 -0
  26. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/utils/__init__.py +1 -0
  27. mcp_einvoicing_be-0.1.0/src/mcp_einvoicing_be/utils/helpers.py +58 -0
  28. mcp_einvoicing_be-0.1.0/tests/__init__.py +0 -0
  29. mcp_einvoicing_be-0.1.0/tests/conftest.py +81 -0
  30. mcp_einvoicing_be-0.1.0/tests/fixtures/invoice_invalid.xml +9 -0
  31. mcp_einvoicing_be-0.1.0/tests/fixtures/invoice_valid_peppol.xml +107 -0
  32. mcp_einvoicing_be-0.1.0/tests/fixtures/invoice_valid_pint_be.xml +104 -0
  33. mcp_einvoicing_be-0.1.0/tests/test_tools/__init__.py +0 -0
  34. mcp_einvoicing_be-0.1.0/tests/test_tools/test_generation.py +50 -0
  35. mcp_einvoicing_be-0.1.0/tests/test_tools/test_transformation.py +40 -0
  36. mcp_einvoicing_be-0.1.0/tests/test_tools/test_validation.py +44 -0
@@ -0,0 +1,67 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test — Python ${{ matrix.python-version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python-version: ["3.11", "3.12", "3.13"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v4
23
+ with:
24
+ enable-cache: true
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ run: uv python install ${{ matrix.python-version }}
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --all-extras
31
+
32
+ - name: Run tests
33
+ run: uv run pytest --cov=mcp_einvoicing_be --cov-report=xml
34
+
35
+ - name: Upload coverage
36
+ uses: codecov/codecov-action@v4
37
+ if: matrix.python-version == '3.11'
38
+ with:
39
+ files: coverage.xml
40
+ fail_ci_if_error: false
41
+
42
+ lint:
43
+ name: Lint & type check
44
+ runs-on: ubuntu-latest
45
+
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - name: Install uv
50
+ uses: astral-sh/setup-uv@v4
51
+ with:
52
+ enable-cache: true
53
+
54
+ - name: Set up Python
55
+ run: uv python install 3.11
56
+
57
+ - name: Install dependencies
58
+ run: uv sync --all-extras
59
+
60
+ - name: Ruff check
61
+ run: uv run ruff check src tests
62
+
63
+ - name: Ruff format check
64
+ run: uv run ruff format --check src tests
65
+
66
+ - name: Mypy
67
+ run: uv run mypy src
@@ -0,0 +1,72 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write # required for trusted publishing
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distribution
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+ with:
21
+ enable-cache: true
22
+
23
+ - name: Set up Python
24
+ run: uv python install 3.11
25
+
26
+ - name: Build package
27
+ run: uv build
28
+
29
+ - name: Store distribution packages
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ publish-pypi:
36
+ name: Publish to PyPI
37
+ needs: build
38
+ runs-on: ubuntu-latest
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/project/mcp-einvoicing-be/
42
+
43
+ steps:
44
+ - name: Download distributions
45
+ uses: actions/download-artifact@v4
46
+ with:
47
+ name: python-package-distributions
48
+ path: dist/
49
+
50
+ - name: Publish to PyPI
51
+ uses: pypa/gh-action-pypi-publish@release/v1
52
+
53
+ publish-testpypi:
54
+ name: Publish to TestPyPI
55
+ needs: build
56
+ runs-on: ubuntu-latest
57
+ environment:
58
+ name: testpypi
59
+ url: https://test.pypi.org/project/mcp-einvoicing-be/
60
+ if: github.event.release.prerelease
61
+
62
+ steps:
63
+ - name: Download distributions
64
+ uses: actions/download-artifact@v4
65
+ with:
66
+ name: python-package-distributions
67
+ path: dist/
68
+
69
+ - name: Publish to TestPyPI
70
+ uses: pypa/gh-action-pypi-publish@release/v1
71
+ with:
72
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,49 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # uv
18
+ .uv/
19
+ uv.lock
20
+
21
+ # Testing
22
+ .pytest_cache/
23
+ .coverage
24
+ coverage.xml
25
+ htmlcov/
26
+ .tox/
27
+
28
+ # Type checking
29
+ .mypy_cache/
30
+ .dmypy.json
31
+
32
+ # Editors
33
+ .vscode/
34
+ .idea/
35
+ *.swp
36
+ *.swo
37
+ *~
38
+
39
+ # OS
40
+ .DS_Store
41
+ Thumbs.db
42
+
43
+ # Environment
44
+ .env
45
+ .env.local
46
+ *.env
47
+
48
+ # Claude Code (local settings, memory, session data)
49
+ .claude/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ### Added
13
+ - Initial scaffolding and project structure
14
+ - `validate_invoice_be` tool: UBL 2.1 validation against Peppol BIS 3.0, PINT-BE, and Mercurius profiles
15
+ - `validate_pint_be` tool: PINT-BE specific Schematron rules (NBB)
16
+ - `generate_invoice_be` tool: UBL 2.1 invoice generation from structured data
17
+ - `transform_to_ubl` tool: JSON-to-UBL 2.1 XML transformation
18
+ - `lookup_vat_be` tool: BCE/KBO enterprise number lookup
19
+ - `check_peppol_participant_be` tool: Peppol SMP/SML participant lookup
20
+ - `get_invoice_types_be` tool: supported Belgian e-invoice document types
21
+
22
+ ---
23
+
24
+ ## [0.1.0] — TBD
25
+
26
+ _Initial release._
27
+
28
+ [Unreleased]: https://github.com/cmendezs/mcp-einvoicing-be/compare/HEAD
@@ -0,0 +1,67 @@
1
+ # Contributing to mcp-einvoicing-be
2
+
3
+ Thank you for your interest in contributing. This document explains the workflow and expectations.
4
+
5
+ ## Development setup
6
+
7
+ ```bash
8
+ git clone https://github.com/cmendezs/mcp-einvoicing-be.git
9
+ cd mcp-einvoicing-be
10
+ uv sync --all-extras
11
+ ```
12
+
13
+ ## Running the test suite
14
+
15
+ ```bash
16
+ uv run pytest
17
+ ```
18
+
19
+ Run with verbose output:
20
+
21
+ ```bash
22
+ uv run pytest -v
23
+ ```
24
+
25
+ ## Linting and type checking
26
+
27
+ ```bash
28
+ uv run ruff check src tests
29
+ uv run ruff format --check src tests
30
+ uv run mypy src
31
+ ```
32
+
33
+ To auto-fix lint issues:
34
+
35
+ ```bash
36
+ uv run ruff check --fix src tests
37
+ uv run ruff format src tests
38
+ ```
39
+
40
+ ## Pull request checklist
41
+
42
+ - [ ] All tests pass (`pytest`)
43
+ - [ ] No lint errors (`ruff check`)
44
+ - [ ] No type errors (`mypy src`)
45
+ - [ ] New or changed behaviour is covered by tests
46
+ - [ ] Validation fixes reference the relevant rule ID (e.g. `PINT-BE-R001`)
47
+ - [ ] `CHANGELOG.md` updated under `[Unreleased]`
48
+
49
+ ## Commit style
50
+
51
+ Use [Conventional Commits](https://www.conventionalcommits.org/):
52
+
53
+ ```
54
+ feat: add validate_pint_be tool
55
+ fix: normalize BE VAT numbers with leading zeros
56
+ docs: update README with Mercurius configuration
57
+ test: add fixture for PINT-BE credit note
58
+ ```
59
+
60
+ ## Reporting issues
61
+
62
+ Please open an issue at https://github.com/cmendezs/mcp-einvoicing-be/issues and include:
63
+
64
+ - The tool name and input you used
65
+ - The expected result
66
+ - The actual result (full error message or unexpected output)
67
+ - The Belgian e-invoicing standard or rule ID involved, if known
@@ -0,0 +1,174 @@
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 made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
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, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combined Work (and Derivative Works
78
+ thereof). If You institute patent litigation against any entity
79
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
80
+ the Work or any Contribution embodied within the Work constitutes
81
+ direct or contributory patent infringement, then any patent licenses
82
+ granted to You under this License for that Work shall terminate as of
83
+ the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the Work
86
+ or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You meet
88
+ the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative Works
91
+ a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works that
97
+ You distribute, all copyright, patent, trademark, and attribution
98
+ notices from the Source form of the Work, excluding those notices
99
+ that do not pertain to any part of the Derivative Works; and
100
+
101
+ (d) If the Work includes a "NOTICE" text file as part of its
102
+ distribution, You must include a readable copy of the attribution
103
+ notices contained within such NOTICE file, in at least one of the
104
+ following places: within a NOTICE text distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if
106
+ provided along with the Derivative Works; or, within a display
107
+ generated by the Derivative Works, if and wherever such third-party
108
+ notices normally appear. The contents of the NOTICE file are for
109
+ informational purposes only and do not modify the License. You may
110
+ add Your own attribution notices within Derivative Works that You
111
+ distribute, alongside or as an addendum to the NOTICE text from
112
+ the Work, provided that such additional attribution notices cannot
113
+ be construed as modifying the License.
114
+
115
+ You may add Your own license statement for Your modifications and may
116
+ provide additional grant of rights to use, copy, modify, merge,
117
+ publish, distribute, sublicense, and/or sell copies of the
118
+ Derivative Works.
119
+
120
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
121
+ any Contribution intentionally submitted for inclusion in the Work
122
+ by You to the Licensor shall be under the terms and conditions of
123
+ this License, without any additional terms or conditions.
124
+
125
+ 6. Trademarks. This License does not grant permission to use the trade
126
+ names, trademarks, service marks, or product names of the Licensor,
127
+ except as required for reasonable and customary use in describing the
128
+ origin of the Work and reproducing the content of the NOTICE file.
129
+
130
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed
131
+ to in writing, Licensor provides the Work (and each Contributor provides
132
+ its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
133
+ OF ANY KIND, either express or implied, including, without limitation,
134
+ any warranties or conditions of TITLE, NON-INFRINGEMENT,
135
+ MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
136
+ responsible for determining the appropriateness of using or reproducing
137
+ the Work and assume any risks associated with Your exercise of
138
+ permissions under this License.
139
+
140
+ 8. Limitation of Liability. In no event and under no legal theory, whether
141
+ in tort (including negligence), contract, or otherwise, unless required
142
+ by applicable law (such as deliberate and grossly negligent acts) or
143
+ agreed to in writing, shall any Contributor be liable to You for
144
+ damages, including any direct, indirect, special, incidental, or
145
+ consequential damages of any character arising as a result of this
146
+ License or out of the use or inability to use the Work (even if such
147
+ Contributor has been advised of the possibility of such damages).
148
+
149
+ 9. Accepting Warranty or Additional Liability. While redistributing the
150
+ Work or Derivative Works thereof, You may choose to offer, and charge
151
+ a fee for, acceptance of support, warranty, indemnity, or other
152
+ liability obligations and/or rights consistent with this License.
153
+ However, in accepting such obligations, You may offer such obligations
154
+ only on Your own behalf and on Your sole responsibility, not on behalf
155
+ of any other Contributor, and only if You agree to indemnify, defend,
156
+ and hold each Contributor harmless for any liability incurred by, or
157
+ claims asserted against, such Contributor by reason of your accepting
158
+ any such warranty or additional liability.
159
+
160
+ END OF TERMS AND CONDITIONS
161
+
162
+ Copyright 2024 Cristian Mendez
163
+
164
+ Licensed under the Apache License, Version 2.0 (the "License");
165
+ you may not use this file except in compliance with the License.
166
+ You may obtain a copy of the License at
167
+
168
+ http://www.apache.org/licenses/LICENSE-2.0
169
+
170
+ Unless required by applicable law or agreed to in writing, software
171
+ distributed under the License is distributed on an "AS IS" BASIS,
172
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
173
+ See the License for the specific language governing permissions and
174
+ limitations under the License.