zerez-client 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.
- zerez_client-0.1.0/.gitignore +13 -0
- zerez_client-0.1.0/CHANGELOG.md +15 -0
- zerez_client-0.1.0/LICENSE +21 -0
- zerez_client-0.1.0/PKG-INFO +204 -0
- zerez_client-0.1.0/README.md +169 -0
- zerez_client-0.1.0/pyproject.toml +112 -0
- zerez_client-0.1.0/src/zerez/__init__.py +6 -0
- zerez_client-0.1.0/src/zerez/__main__.py +5 -0
- zerez_client-0.1.0/src/zerez/cli.py +346 -0
- zerez_client-0.1.0/src/zerez/client.py +418 -0
- zerez_client-0.1.0/src/zerez/mcp_server.py +209 -0
- zerez_client-0.1.0/src/zerez/py.typed +0 -0
- zerez_client-0.1.0/src/zerez/queries.py +164 -0
- zerez_client-0.1.0/tests/__init__.py +0 -0
- zerez_client-0.1.0/tests/test_client.py +248 -0
- zerez_client-0.1.0/tests/test_mcp_server.py +106 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Release notes are generated from the commit messages and published on the
|
|
4
|
+
[GitHub Releases page](https://github.com/the78mole/zerez-mcp/releases).
|
|
5
|
+
|
|
6
|
+
The project follows [Semantic Versioning](https://semver.org/) and uses
|
|
7
|
+
[Conventional Commits](https://www.conventionalcommits.org/).
|
|
8
|
+
|
|
9
|
+
## Unreleased
|
|
10
|
+
|
|
11
|
+
- Python client (`zerez.ZerezClient`) and CLI (`zerez`) for the public ZEREZ GraphQL backend:
|
|
12
|
+
unit search with several keywords (AND), unit details with technical data, certificates with revision chain, norms,
|
|
13
|
+
document download, raw GraphQL and schema introspection.
|
|
14
|
+
- MCP server over stdio (`zerez mcp`, `zerez-mcp`, extra `zerez-client[mcp]`) with read-only
|
|
15
|
+
tools for unit search, unit details, certificates, certificate chain, document links and norms.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Glaser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: zerez-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client and CLI for ZEREZ, the German central register of unit and component certificates (zerez.net)
|
|
5
|
+
Project-URL: Homepage, https://github.com/the78mole/zerez-mcp
|
|
6
|
+
Project-URL: Source, https://github.com/the78mole/zerez-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/the78mole/zerez-mcp/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/the78mole/zerez-mcp/releases
|
|
9
|
+
Author: Daniel Glaser
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: graphql,grid-code,inverter,mcp,unit-certificate,vde-ar-n-4105,vde-ar-n-4110,vde-ar-n-4120,zerez
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Natural Language :: German
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.10
|
|
31
|
+
Requires-Dist: httpx>=0.27
|
|
32
|
+
Provides-Extra: mcp
|
|
33
|
+
Requires-Dist: mcp<3,>=2.3; extra == 'mcp'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# zerez-mcp
|
|
37
|
+
|
|
38
|
+
[](https://github.com/the78mole/zerez-mcp/actions/workflows/ci.yml)
|
|
39
|
+
[](https://github.com/the78mole/zerez-mcp/actions/workflows/pypi.yml)
|
|
40
|
+
[](https://pypi.org/project/zerez-client/)
|
|
41
|
+
[](https://pypi.org/project/zerez-client/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](https://scorecard.dev/viewer/?uri=github.com/the78mole/zerez-mcp)
|
|
44
|
+
[](https://renovatebot.com)
|
|
45
|
+
[](https://github.com/astral-sh/uv)
|
|
46
|
+
[](https://github.com/astral-sh/ruff)
|
|
47
|
+
[](https://mypy-lang.org/)
|
|
48
|
+
|
|
49
|
+
A typed Python client and command line tool for **ZEREZ**, the German central register of unit
|
|
50
|
+
and component certificates (*Zentrales Register für Einheiten- und Komponentenzertifikate*,
|
|
51
|
+
<https://www.zerez.net/units-and-certificates>). Look up a unit by its ZEREZ ID and get its
|
|
52
|
+
certificate, grid codes and technical data (power, currents, short-circuit and flicker values),
|
|
53
|
+
or search the register by manufacturer, model, category, energy source or power.
|
|
54
|
+
|
|
55
|
+
The same calls are available as an **MCP server** for assistants such as Claude (stdio, see below).
|
|
56
|
+
|
|
57
|
+
- **Search units** like the table on zerez.net (`search_units`), with text, category, energy
|
|
58
|
+
source, norm, status and power filters, or a raw GraphQL filter.
|
|
59
|
+
- **Unit details** by ZEREZ ID or UUID (`get_unit`): overview plus all publicly visible technical
|
|
60
|
+
fields, discovered by schema introspection.
|
|
61
|
+
- **Certificates** by certificate code, unit ZEREZ ID, certificate number or UUID
|
|
62
|
+
(`get_certificates`), with norms, software versions, documents, linked units and the revision
|
|
63
|
+
chain (`get_certificate_chain`).
|
|
64
|
+
- **Download certificate documents** (PDF) with unique file names (`download_certificate_files`).
|
|
65
|
+
- **Explore the backend**: raw GraphQL queries and type introspection.
|
|
66
|
+
|
|
67
|
+
> This project is not affiliated with the operator of ZEREZ. It uses the same public, anonymous
|
|
68
|
+
> API as the zerez.net website. Please query it considerately.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uv tool install zerez-client # the `zerez` command
|
|
74
|
+
uvx --from zerez-client zerez … # or run it without installing
|
|
75
|
+
uv add zerez-client # as a library in a uv project
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The PyPI package is `zerez-client`, the Python module `zerez`, the command `zerez`.
|
|
79
|
+
|
|
80
|
+
## Command line
|
|
81
|
+
|
|
82
|
+
The CLI output is German, like the labels on zerez.net.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
zerez search Multiplus 5000 # keywords, all must match
|
|
86
|
+
zerez search -m SMA --category INVERTER --norm 4105 --take 50
|
|
87
|
+
zerez search --energy PV_WITH_STORAGE --min-power 3 --max-power 10
|
|
88
|
+
zerez unit ZE-KAXY-Z16S-0001 # overview and technical data
|
|
89
|
+
zerez unit ZE-KAXY-Z16S-0001 --all --json
|
|
90
|
+
zerez cert ZE-KAXY-Z16S --chain # certificate with revision chain
|
|
91
|
+
zerez download ZE-KAXY-Z16S -o ./pdf # certificate documents (PDF)
|
|
92
|
+
zerez norms
|
|
93
|
+
zerez schema UnitOverviewFilterInput # explore the schema
|
|
94
|
+
zerez query '{ unitOverview(take: 1) { totalCount } }' # raw GraphQL
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`--json` works with every command.
|
|
98
|
+
|
|
99
|
+
## Library
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from zerez import ZerezClient
|
|
103
|
+
|
|
104
|
+
with ZerezClient() as z:
|
|
105
|
+
page = z.search_units(manufacturer="Deye", take=10)
|
|
106
|
+
unit = z.get_unit("ZE-KAXY-Z16S-0001") # {"overview": ..., "technical": ...}
|
|
107
|
+
certs = z.get_certificates("ZE-KAXY-Z16S")
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## MCP server
|
|
111
|
+
|
|
112
|
+
The package contains an [MCP](https://modelcontextprotocol.io) server, so that assistants such as
|
|
113
|
+
Claude can query the register. It runs over **stdio** and needs the optional dependency `mcp`:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv tool install 'zerez-client[mcp]'
|
|
117
|
+
zerez mcp # or: zerez-mcp
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Claude Code:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
claude mcp add zerez -- uvx --from 'zerez-client[mcp]' zerez-mcp
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Claude Desktop (`claude_desktop_config.json`):
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"zerez": {
|
|
132
|
+
"command": "uvx",
|
|
133
|
+
"args": ["--from", "zerez-client[mcp]", "zerez-mcp"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
All tools are read-only:
|
|
140
|
+
|
|
141
|
+
| Tool | Purpose |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| `search_units` | search units by keywords (AND), manufacturer, model, category, energy source, grid code, status, power |
|
|
144
|
+
| `get_unit` | overview and technical data of a unit by ZEREZ ID or UUID |
|
|
145
|
+
| `get_certificates` | certificates with grid codes, software versions, documents and linked units |
|
|
146
|
+
| `get_certificate_chain` | revision and extension chain of a certificate |
|
|
147
|
+
| `get_document_links` | signed, short-lived download links of the certificate PDFs |
|
|
148
|
+
| `list_norms` | grid codes known to the register |
|
|
149
|
+
|
|
150
|
+
Raw GraphQL and schema introspection are not exposed as tools. An HTTP transport is planned.
|
|
151
|
+
|
|
152
|
+
## The ZEREZ backend
|
|
153
|
+
|
|
154
|
+
zerez.net is a single-page app on top of a **HotChocolate GraphQL gateway**:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
POST https://app-zerez-weeu-gatewaysvc-prod-01.azurewebsites.net/graphql/
|
|
158
|
+
Content-Type: application/json
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- Read queries work **without authentication**, and introspection is enabled.
|
|
162
|
+
- The overview table uses `unitOverview(skip, take, where, order)` (type `UnitOverview`).
|
|
163
|
+
- `unit(id: UUID!)` returns the technical data of a unit (type `Unit`, about 90 fields).
|
|
164
|
+
- `certificates(where, ...)` returns certificates with norms, software versions, documents and
|
|
165
|
+
units. Selecting `certificateBridgeUnits { unit }` fails unless `unitId` is selected as well.
|
|
166
|
+
- `certificateFileStorageLocation` is a **signed, short-lived** path `api/PublicDownload/...`
|
|
167
|
+
relative to the gateway that returns the PDF.
|
|
168
|
+
- Matrix and inertia parameters are released per role and are `null` for anonymous clients.
|
|
169
|
+
- Missing dates come back as `1900-01-01...`; the client turns them into `None`.
|
|
170
|
+
- Power values are in kW.
|
|
171
|
+
|
|
172
|
+
### ZEREZ ID
|
|
173
|
+
|
|
174
|
+
| Format | Meaning |
|
|
175
|
+
| --- | --- |
|
|
176
|
+
| `ZE-XXXX-XXXX-0001` | unit (`unitCode`) |
|
|
177
|
+
| `ZE-XXXX-XXXX` | certificate (`certificateCode`); its units append `-0001`, `-0002`, ... |
|
|
178
|
+
|
|
179
|
+
The first group of four is the code of the certificate holder (`tenantCode`).
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
zerez-mcp uses [uv](https://docs.astral.sh/uv/), Ruff, mypy (strict) and pytest.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
uv sync
|
|
187
|
+
uv run pytest # unit tests against a mocked backend
|
|
188
|
+
uv run pytest -m live # against the real ZEREZ backend
|
|
189
|
+
uv run pre-commit install # once, sets up the Git hook
|
|
190
|
+
uv run pre-commit run --all-files
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for commit conventions.
|
|
194
|
+
|
|
195
|
+
## Releases
|
|
196
|
+
|
|
197
|
+
Releases are cut by hand: publishing a [GitHub Release](https://github.com/the78mole/zerez-mcp/releases)
|
|
198
|
+
with a tag `vX.Y.Z` runs [`pypi.yml`](.github/workflows/pypi.yml), which sets the version from the
|
|
199
|
+
tag, runs CI, builds and uploads to PyPI with Trusted Publishing (environment `pypi`, no API
|
|
200
|
+
token). See [CHANGELOG.md](CHANGELOG.md).
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
zerez-mcp is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# zerez-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/the78mole/zerez-mcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/the78mole/zerez-mcp/actions/workflows/pypi.yml)
|
|
5
|
+
[](https://pypi.org/project/zerez-client/)
|
|
6
|
+
[](https://pypi.org/project/zerez-client/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://scorecard.dev/viewer/?uri=github.com/the78mole/zerez-mcp)
|
|
9
|
+
[](https://renovatebot.com)
|
|
10
|
+
[](https://github.com/astral-sh/uv)
|
|
11
|
+
[](https://github.com/astral-sh/ruff)
|
|
12
|
+
[](https://mypy-lang.org/)
|
|
13
|
+
|
|
14
|
+
A typed Python client and command line tool for **ZEREZ**, the German central register of unit
|
|
15
|
+
and component certificates (*Zentrales Register für Einheiten- und Komponentenzertifikate*,
|
|
16
|
+
<https://www.zerez.net/units-and-certificates>). Look up a unit by its ZEREZ ID and get its
|
|
17
|
+
certificate, grid codes and technical data (power, currents, short-circuit and flicker values),
|
|
18
|
+
or search the register by manufacturer, model, category, energy source or power.
|
|
19
|
+
|
|
20
|
+
The same calls are available as an **MCP server** for assistants such as Claude (stdio, see below).
|
|
21
|
+
|
|
22
|
+
- **Search units** like the table on zerez.net (`search_units`), with text, category, energy
|
|
23
|
+
source, norm, status and power filters, or a raw GraphQL filter.
|
|
24
|
+
- **Unit details** by ZEREZ ID or UUID (`get_unit`): overview plus all publicly visible technical
|
|
25
|
+
fields, discovered by schema introspection.
|
|
26
|
+
- **Certificates** by certificate code, unit ZEREZ ID, certificate number or UUID
|
|
27
|
+
(`get_certificates`), with norms, software versions, documents, linked units and the revision
|
|
28
|
+
chain (`get_certificate_chain`).
|
|
29
|
+
- **Download certificate documents** (PDF) with unique file names (`download_certificate_files`).
|
|
30
|
+
- **Explore the backend**: raw GraphQL queries and type introspection.
|
|
31
|
+
|
|
32
|
+
> This project is not affiliated with the operator of ZEREZ. It uses the same public, anonymous
|
|
33
|
+
> API as the zerez.net website. Please query it considerately.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv tool install zerez-client # the `zerez` command
|
|
39
|
+
uvx --from zerez-client zerez … # or run it without installing
|
|
40
|
+
uv add zerez-client # as a library in a uv project
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The PyPI package is `zerez-client`, the Python module `zerez`, the command `zerez`.
|
|
44
|
+
|
|
45
|
+
## Command line
|
|
46
|
+
|
|
47
|
+
The CLI output is German, like the labels on zerez.net.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
zerez search Multiplus 5000 # keywords, all must match
|
|
51
|
+
zerez search -m SMA --category INVERTER --norm 4105 --take 50
|
|
52
|
+
zerez search --energy PV_WITH_STORAGE --min-power 3 --max-power 10
|
|
53
|
+
zerez unit ZE-KAXY-Z16S-0001 # overview and technical data
|
|
54
|
+
zerez unit ZE-KAXY-Z16S-0001 --all --json
|
|
55
|
+
zerez cert ZE-KAXY-Z16S --chain # certificate with revision chain
|
|
56
|
+
zerez download ZE-KAXY-Z16S -o ./pdf # certificate documents (PDF)
|
|
57
|
+
zerez norms
|
|
58
|
+
zerez schema UnitOverviewFilterInput # explore the schema
|
|
59
|
+
zerez query '{ unitOverview(take: 1) { totalCount } }' # raw GraphQL
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`--json` works with every command.
|
|
63
|
+
|
|
64
|
+
## Library
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from zerez import ZerezClient
|
|
68
|
+
|
|
69
|
+
with ZerezClient() as z:
|
|
70
|
+
page = z.search_units(manufacturer="Deye", take=10)
|
|
71
|
+
unit = z.get_unit("ZE-KAXY-Z16S-0001") # {"overview": ..., "technical": ...}
|
|
72
|
+
certs = z.get_certificates("ZE-KAXY-Z16S")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## MCP server
|
|
76
|
+
|
|
77
|
+
The package contains an [MCP](https://modelcontextprotocol.io) server, so that assistants such as
|
|
78
|
+
Claude can query the register. It runs over **stdio** and needs the optional dependency `mcp`:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv tool install 'zerez-client[mcp]'
|
|
82
|
+
zerez mcp # or: zerez-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Claude Code:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
claude mcp add zerez -- uvx --from 'zerez-client[mcp]' zerez-mcp
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Claude Desktop (`claude_desktop_config.json`):
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"zerez": {
|
|
97
|
+
"command": "uvx",
|
|
98
|
+
"args": ["--from", "zerez-client[mcp]", "zerez-mcp"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
All tools are read-only:
|
|
105
|
+
|
|
106
|
+
| Tool | Purpose |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `search_units` | search units by keywords (AND), manufacturer, model, category, energy source, grid code, status, power |
|
|
109
|
+
| `get_unit` | overview and technical data of a unit by ZEREZ ID or UUID |
|
|
110
|
+
| `get_certificates` | certificates with grid codes, software versions, documents and linked units |
|
|
111
|
+
| `get_certificate_chain` | revision and extension chain of a certificate |
|
|
112
|
+
| `get_document_links` | signed, short-lived download links of the certificate PDFs |
|
|
113
|
+
| `list_norms` | grid codes known to the register |
|
|
114
|
+
|
|
115
|
+
Raw GraphQL and schema introspection are not exposed as tools. An HTTP transport is planned.
|
|
116
|
+
|
|
117
|
+
## The ZEREZ backend
|
|
118
|
+
|
|
119
|
+
zerez.net is a single-page app on top of a **HotChocolate GraphQL gateway**:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
POST https://app-zerez-weeu-gatewaysvc-prod-01.azurewebsites.net/graphql/
|
|
123
|
+
Content-Type: application/json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- Read queries work **without authentication**, and introspection is enabled.
|
|
127
|
+
- The overview table uses `unitOverview(skip, take, where, order)` (type `UnitOverview`).
|
|
128
|
+
- `unit(id: UUID!)` returns the technical data of a unit (type `Unit`, about 90 fields).
|
|
129
|
+
- `certificates(where, ...)` returns certificates with norms, software versions, documents and
|
|
130
|
+
units. Selecting `certificateBridgeUnits { unit }` fails unless `unitId` is selected as well.
|
|
131
|
+
- `certificateFileStorageLocation` is a **signed, short-lived** path `api/PublicDownload/...`
|
|
132
|
+
relative to the gateway that returns the PDF.
|
|
133
|
+
- Matrix and inertia parameters are released per role and are `null` for anonymous clients.
|
|
134
|
+
- Missing dates come back as `1900-01-01...`; the client turns them into `None`.
|
|
135
|
+
- Power values are in kW.
|
|
136
|
+
|
|
137
|
+
### ZEREZ ID
|
|
138
|
+
|
|
139
|
+
| Format | Meaning |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `ZE-XXXX-XXXX-0001` | unit (`unitCode`) |
|
|
142
|
+
| `ZE-XXXX-XXXX` | certificate (`certificateCode`); its units append `-0001`, `-0002`, ... |
|
|
143
|
+
|
|
144
|
+
The first group of four is the code of the certificate holder (`tenantCode`).
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
zerez-mcp uses [uv](https://docs.astral.sh/uv/), Ruff, mypy (strict) and pytest.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv sync
|
|
152
|
+
uv run pytest # unit tests against a mocked backend
|
|
153
|
+
uv run pytest -m live # against the real ZEREZ backend
|
|
154
|
+
uv run pre-commit install # once, sets up the Git hook
|
|
155
|
+
uv run pre-commit run --all-files
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for commit conventions.
|
|
159
|
+
|
|
160
|
+
## Releases
|
|
161
|
+
|
|
162
|
+
Releases are cut by hand: publishing a [GitHub Release](https://github.com/the78mole/zerez-mcp/releases)
|
|
163
|
+
with a tag `vX.Y.Z` runs [`pypi.yml`](.github/workflows/pypi.yml), which sets the version from the
|
|
164
|
+
tag, runs CI, builds and uploads to PyPI with Trusted Publishing (environment `pypi`, no API
|
|
165
|
+
token). See [CHANGELOG.md](CHANGELOG.md).
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
zerez-mcp is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "zerez-client"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python client and CLI for ZEREZ, the German central register of unit and component certificates (zerez.net)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Daniel Glaser" }]
|
|
10
|
+
keywords = [
|
|
11
|
+
"zerez", "vde-ar-n-4105", "vde-ar-n-4110", "vde-ar-n-4120", "unit-certificate",
|
|
12
|
+
"inverter", "grid-code", "graphql", "mcp",
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Natural Language :: German",
|
|
20
|
+
"Natural Language :: English",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Programming Language :: Python :: 3.14",
|
|
29
|
+
"Programming Language :: Python :: 3.15",
|
|
30
|
+
"Topic :: Scientific/Engineering",
|
|
31
|
+
"Typing :: Typed",
|
|
32
|
+
]
|
|
33
|
+
dependencies = ["httpx>=0.27"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/the78mole/zerez-mcp"
|
|
37
|
+
Source = "https://github.com/the78mole/zerez-mcp"
|
|
38
|
+
Issues = "https://github.com/the78mole/zerez-mcp/issues"
|
|
39
|
+
Changelog = "https://github.com/the78mole/zerez-mcp/releases"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
zerez = "zerez.cli:main"
|
|
43
|
+
zerez-mcp = "zerez.mcp_server:main"
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
mcp = [
|
|
47
|
+
"mcp>=2.3,<3",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[dependency-groups]
|
|
51
|
+
dev = [
|
|
52
|
+
"mcp>=2.3,<3",
|
|
53
|
+
"mypy>=1.18",
|
|
54
|
+
"pre-commit>=4.3",
|
|
55
|
+
"pytest>=8.4",
|
|
56
|
+
"pytest-cov>=7.0",
|
|
57
|
+
"respx>=0.21",
|
|
58
|
+
"ruff>=0.14",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[build-system]
|
|
62
|
+
requires = ["hatchling>=1.27"]
|
|
63
|
+
build-backend = "hatchling.build"
|
|
64
|
+
|
|
65
|
+
[tool.hatch.build.targets.wheel]
|
|
66
|
+
packages = ["src/zerez"]
|
|
67
|
+
|
|
68
|
+
[tool.hatch.build.targets.sdist]
|
|
69
|
+
include = ["src/zerez", "tests", "README.md", "LICENSE", "CHANGELOG.md"]
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 100
|
|
73
|
+
target-version = "py310"
|
|
74
|
+
extend-exclude = ["*.md"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF", "DTZ"]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint.per-file-ignores]
|
|
80
|
+
# GraphQL documents: long selection sets read better on one line than wrapped.
|
|
81
|
+
"src/zerez/queries.py" = ["E501"]
|
|
82
|
+
|
|
83
|
+
[tool.ruff.lint.isort]
|
|
84
|
+
known-first-party = ["zerez"]
|
|
85
|
+
# Explicit, because the checkout directory zerez-mcp can make Ruff guess "mcp" as first-party.
|
|
86
|
+
known-third-party = ["mcp"]
|
|
87
|
+
|
|
88
|
+
[tool.mypy]
|
|
89
|
+
python_version = "3.10"
|
|
90
|
+
strict = true
|
|
91
|
+
mypy_path = ["src"]
|
|
92
|
+
explicit_package_bases = true
|
|
93
|
+
files = ["src", "tests"]
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
testpaths = ["tests"]
|
|
97
|
+
addopts = ["-ra", "-m", "not live"]
|
|
98
|
+
filterwarnings = [
|
|
99
|
+
"error::DeprecationWarning",
|
|
100
|
+
"error::FutureWarning",
|
|
101
|
+
]
|
|
102
|
+
markers = [
|
|
103
|
+
"live: queries the real ZEREZ backend (run with -m live)",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[tool.coverage.run]
|
|
107
|
+
source = ["zerez"]
|
|
108
|
+
branch = true
|
|
109
|
+
|
|
110
|
+
[tool.coverage.report]
|
|
111
|
+
show_missing = true
|
|
112
|
+
skip_covered = false
|