zont-mcp 1.3.2__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.
zont_mcp-1.3.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zont-mcp contributors
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,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: zont-mcp
3
+ Version: 1.3.2
4
+ Summary: MCP server for ZONT heating system control via AI / MCP-сервер для управления системой отопления ZONT через ИИ
5
+ Author: MAB2908
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 zont-mcp contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/MAB2908/zont-mcp
29
+ Project-URL: Issues, https://github.com/MAB2908/zont-mcp/issues
30
+ Project-URL: Changelog, https://github.com/MAB2908/zont-mcp/blob/main/CHANGELOG.md
31
+ Keywords: zont,mcp,heating,smart-home,baxi,opentherm,claude
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: End Users/Desktop
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Topic :: Home Automation
40
+ Requires-Python: >=3.11
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: mcp[cli]<2,>=1.3.0
44
+ Requires-Dist: httpx>=0.27.0
45
+ Requires-Dist: python-dotenv>=1.0.0
46
+ Dynamic: license-file
47
+
48
+ # zont-mcp
49
+
50
+ **[README на русском](README.ru.md)**
51
+
52
+ A local MCP server that gives AI assistants natural-language control over ZONT heating systems (BAXI Connect+ and compatible controllers) — reading state, switching modes, boiler telemetry, diagnostics and configuration writes.
53
+
54
+ ## Demo
55
+
56
+ A conversation once the server is connected to any MCP client (Claude, Cursor, VS Code, …):
57
+
58
+ ```
59
+ You: Any boiler errors right now? If yes — what should I do?
60
+ Assistant: (calls get_boiler_errors)
61
+ No active faults. Fault flags: none.
62
+ Telemetry: flow temp 54.2 °C, setpoint 55 °C, modulation 34%, status: ch, flame.
63
+
64
+ You: We're cold. Run a diagnosis.
65
+ Assistant: (calls diagnose_heating)
66
+ Status: warning. The "Boiler circuit" has no active mode — it was
67
+ lost after a controller reboot. Fix: enable the mode.
68
+ (calls set_heating_mode, then get_device_state to verify)
69
+ Done — mode "Comfort" is active, target 21.5 °C.
70
+ ```
71
+
72
+ How it works:
73
+
74
+ ```
75
+ ┌─────────────┐ MCP (stdio) ┌──────────┐ HTTPS ┌─────────────────┐
76
+ │ AI assistant │ ◄──────────────► │ zont-mcp │ ─────────► │ ZONT cloud API │
77
+ └─────────────┘ └──────────┘ └────────┬────────┘
78
+ │
79
+ ┌────────▼────────┐
80
+ │ ZONT controller │
81
+ │ + boiler (bus) │
82
+ └─────────────────┘
83
+ ```
84
+
85
+ The server runs locally, opens no network ports and talks to exactly two official
86
+ ZONT endpoints over HTTPS (`my.zont.online/api` and `lk.zont-online.ru/api`).
87
+
88
+ ## Quick start
89
+
90
+ Requirements: Python 3.11+, a ZONT account (zont-online.ru) with a registered device,
91
+ any MCP-compatible client.
92
+
93
+ ```bash
94
+ pip install zont-mcp # from PyPI (Python Package Index)
95
+ # — or from source —
96
+ git clone https://github.com/MAB2908/zont-mcp.git && cd zont-mcp
97
+ python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
98
+ pip install -e .
99
+ ```
100
+
101
+ Get your API token: set `ZONT_LOGIN` + `ZONT_PASSWORD`, run `zont-mcp` once —
102
+ the token is printed to stderr; then keep only the token.
103
+
104
+ Add to your MCP client (Claude Desktop `claude_desktop_config.json` shown; Cursor,
105
+ VS Code and others use the same fields — see [docs/setup.md](docs/setup.md) for all snippets):
106
+
107
+ ```json
108
+ {
109
+ "mcpServers": {
110
+ "zont": {
111
+ "command": "zont-mcp",
112
+ "env": {
113
+ "ZONT_CLIENT_EMAIL": "your@email.com",
114
+ "ZONT_TOKEN": "your_token"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ Ask your assistant:
122
+
123
+ ```
124
+ Show the list of my ZONT devices.
125
+ ```
126
+
127
+ Credentials live only in environment variables / a local `.env` file — never in
128
+ code. Full installation and configuration guide: [docs/setup.md](docs/setup.md)
129
+ ([по-русски](docs/setup.ru.md)).
130
+
131
+ ## Features
132
+
133
+ - **38 tools in 7 groups**: device state, heating control, I/O and guard zones, history, analytics, configuration, commands & archives
134
+ - **Boiler OpenTherm telemetry** — flow temperature, setpoint, burner modulation, status flags
135
+ - **Diagnostics with recommendations** — known failure signatures: lost bus connection, mode reset after reboot, low pressure, dead radio sensors
136
+ - **Configuration writes at web-cabinet level** — circuits, modes, sensors, weather-compensation curve; every write is backed up and verified by re-reading
137
+ - **Works with any MCP client** — Claude Desktop, Claude Code, Cursor, VS Code, ZCode
138
+ - **Safety by design** — dangerous firmware commands (restart, deletion, SMS/calls) deliberately excluded; device passwords masked in responses
139
+
140
+ ## Comparison
141
+
142
+ The closest analogue is [`defanator/zont_api`](https://github.com/defanator/zont_api) —
143
+ a Python library for the ZONT API. `zont-mcp` used it as a knowledge source for the
144
+ `z3k_boiler_adapter` data format.
145
+
146
+ | Aspect | defanator/zont_api | zont-mcp |
147
+ |--------|--------------------|----------|
148
+ | Purpose | Python library for developers | MCP server for AI assistants |
149
+ | Interface | `import zont_api` in code | Natural language via any MCP client |
150
+ | Boiler control | No | Yes — modes, temperatures, relays |
151
+ | Configuration writes | No | Yes — circuits, modes, sensors, weather curve |
152
+ | Radio sensor history | No | Yes |
153
+ | Diagnostics & analytics | No | Yes |
154
+ | Event journal | No | Yes |
155
+ | Prometheus exporter / CSV | Yes | No |
156
+ | Tests | pytest, tox, CI | unittest + GitHub Actions |
157
+
158
+ Choose `zont-mcp` when you want to *talk* to your heating system; choose
159
+ `zont_api` when you build your own Python software against the API.
160
+
161
+ ## Documentation & more examples
162
+
163
+ | Document | Purpose |
164
+ |----------|---------|
165
+ | [docs/setup.md](docs/setup.md) | Full installation guide: token, all MCP clients, troubleshooting ([по-русски](docs/setup.ru.md)) |
166
+ | [AGENTS.md](AGENTS.md) | Working rules for AI agents (English + [Russian](AGENTS.ru.md)) |
167
+ | [CAPABILITIES.md](CAPABILITIES.md) | Everything the server can and cannot do; z3k command dictionary |
168
+ | [examples/heating-check/](examples/heating-check/) | Example: full diagnostic session |
169
+ | [examples/vacation-mode/](examples/vacation-mode/) | Example: "leaving for a week" scenario |
170
+ | [examples/python-client/](examples/python-client/) | Example: use the API client directly from Python |
171
+ | [CHANGELOG.md](CHANGELOG.md) | Release history (English + Russian) |
172
+ | [SECURITY.md](SECURITY.md) | Credential handling, vulnerability reporting |
173
+
174
+ ## Badges
175
+
176
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://python.org)
177
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
178
+ [![Tests](https://github.com/MAB2908/zont-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/MAB2908/zont-mcp/actions/workflows/tests.yml)
179
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io)
180
+
181
+ ## Contributing
182
+
183
+ See [CONTRIBUTING.md](CONTRIBUTING.md) — how to set up the project, run tests and
184
+ submit changes. Simple starter tasks are marked
185
+ [`good first issue`](https://github.com/MAB2908/zont-mcp/labels/good%20first%20issue).
186
+
187
+ ## License
188
+
189
+ MIT — see [LICENSE](LICENSE). This is an independent project, not affiliated with
190
+ ZONT or Micro Line; it uses only the official public ZONT API.
@@ -0,0 +1,143 @@
1
+ # zont-mcp
2
+
3
+ **[README на русском](README.ru.md)**
4
+
5
+ A local MCP server that gives AI assistants natural-language control over ZONT heating systems (BAXI Connect+ and compatible controllers) — reading state, switching modes, boiler telemetry, diagnostics and configuration writes.
6
+
7
+ ## Demo
8
+
9
+ A conversation once the server is connected to any MCP client (Claude, Cursor, VS Code, …):
10
+
11
+ ```
12
+ You: Any boiler errors right now? If yes — what should I do?
13
+ Assistant: (calls get_boiler_errors)
14
+ No active faults. Fault flags: none.
15
+ Telemetry: flow temp 54.2 °C, setpoint 55 °C, modulation 34%, status: ch, flame.
16
+
17
+ You: We're cold. Run a diagnosis.
18
+ Assistant: (calls diagnose_heating)
19
+ Status: warning. The "Boiler circuit" has no active mode — it was
20
+ lost after a controller reboot. Fix: enable the mode.
21
+ (calls set_heating_mode, then get_device_state to verify)
22
+ Done — mode "Comfort" is active, target 21.5 °C.
23
+ ```
24
+
25
+ How it works:
26
+
27
+ ```
28
+ ┌─────────────┐ MCP (stdio) ┌──────────┐ HTTPS ┌─────────────────┐
29
+ │ AI assistant │ ◄──────────────► │ zont-mcp │ ─────────► │ ZONT cloud API │
30
+ └─────────────┘ └──────────┘ └────────┬────────┘
31
+ │
32
+ ┌────────▼────────┐
33
+ │ ZONT controller │
34
+ │ + boiler (bus) │
35
+ └─────────────────┘
36
+ ```
37
+
38
+ The server runs locally, opens no network ports and talks to exactly two official
39
+ ZONT endpoints over HTTPS (`my.zont.online/api` and `lk.zont-online.ru/api`).
40
+
41
+ ## Quick start
42
+
43
+ Requirements: Python 3.11+, a ZONT account (zont-online.ru) with a registered device,
44
+ any MCP-compatible client.
45
+
46
+ ```bash
47
+ pip install zont-mcp # from PyPI (Python Package Index)
48
+ # — or from source —
49
+ git clone https://github.com/MAB2908/zont-mcp.git && cd zont-mcp
50
+ python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
51
+ pip install -e .
52
+ ```
53
+
54
+ Get your API token: set `ZONT_LOGIN` + `ZONT_PASSWORD`, run `zont-mcp` once —
55
+ the token is printed to stderr; then keep only the token.
56
+
57
+ Add to your MCP client (Claude Desktop `claude_desktop_config.json` shown; Cursor,
58
+ VS Code and others use the same fields — see [docs/setup.md](docs/setup.md) for all snippets):
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "zont": {
64
+ "command": "zont-mcp",
65
+ "env": {
66
+ "ZONT_CLIENT_EMAIL": "your@email.com",
67
+ "ZONT_TOKEN": "your_token"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ Ask your assistant:
75
+
76
+ ```
77
+ Show the list of my ZONT devices.
78
+ ```
79
+
80
+ Credentials live only in environment variables / a local `.env` file — never in
81
+ code. Full installation and configuration guide: [docs/setup.md](docs/setup.md)
82
+ ([по-русски](docs/setup.ru.md)).
83
+
84
+ ## Features
85
+
86
+ - **38 tools in 7 groups**: device state, heating control, I/O and guard zones, history, analytics, configuration, commands & archives
87
+ - **Boiler OpenTherm telemetry** — flow temperature, setpoint, burner modulation, status flags
88
+ - **Diagnostics with recommendations** — known failure signatures: lost bus connection, mode reset after reboot, low pressure, dead radio sensors
89
+ - **Configuration writes at web-cabinet level** — circuits, modes, sensors, weather-compensation curve; every write is backed up and verified by re-reading
90
+ - **Works with any MCP client** — Claude Desktop, Claude Code, Cursor, VS Code, ZCode
91
+ - **Safety by design** — dangerous firmware commands (restart, deletion, SMS/calls) deliberately excluded; device passwords masked in responses
92
+
93
+ ## Comparison
94
+
95
+ The closest analogue is [`defanator/zont_api`](https://github.com/defanator/zont_api) —
96
+ a Python library for the ZONT API. `zont-mcp` used it as a knowledge source for the
97
+ `z3k_boiler_adapter` data format.
98
+
99
+ | Aspect | defanator/zont_api | zont-mcp |
100
+ |--------|--------------------|----------|
101
+ | Purpose | Python library for developers | MCP server for AI assistants |
102
+ | Interface | `import zont_api` in code | Natural language via any MCP client |
103
+ | Boiler control | No | Yes — modes, temperatures, relays |
104
+ | Configuration writes | No | Yes — circuits, modes, sensors, weather curve |
105
+ | Radio sensor history | No | Yes |
106
+ | Diagnostics & analytics | No | Yes |
107
+ | Event journal | No | Yes |
108
+ | Prometheus exporter / CSV | Yes | No |
109
+ | Tests | pytest, tox, CI | unittest + GitHub Actions |
110
+
111
+ Choose `zont-mcp` when you want to *talk* to your heating system; choose
112
+ `zont_api` when you build your own Python software against the API.
113
+
114
+ ## Documentation & more examples
115
+
116
+ | Document | Purpose |
117
+ |----------|---------|
118
+ | [docs/setup.md](docs/setup.md) | Full installation guide: token, all MCP clients, troubleshooting ([по-русски](docs/setup.ru.md)) |
119
+ | [AGENTS.md](AGENTS.md) | Working rules for AI agents (English + [Russian](AGENTS.ru.md)) |
120
+ | [CAPABILITIES.md](CAPABILITIES.md) | Everything the server can and cannot do; z3k command dictionary |
121
+ | [examples/heating-check/](examples/heating-check/) | Example: full diagnostic session |
122
+ | [examples/vacation-mode/](examples/vacation-mode/) | Example: "leaving for a week" scenario |
123
+ | [examples/python-client/](examples/python-client/) | Example: use the API client directly from Python |
124
+ | [CHANGELOG.md](CHANGELOG.md) | Release history (English + Russian) |
125
+ | [SECURITY.md](SECURITY.md) | Credential handling, vulnerability reporting |
126
+
127
+ ## Badges
128
+
129
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://python.org)
130
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
131
+ [![Tests](https://github.com/MAB2908/zont-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/MAB2908/zont-mcp/actions/workflows/tests.yml)
132
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io)
133
+
134
+ ## Contributing
135
+
136
+ See [CONTRIBUTING.md](CONTRIBUTING.md) — how to set up the project, run tests and
137
+ submit changes. Simple starter tasks are marked
138
+ [`good first issue`](https://github.com/MAB2908/zont-mcp/labels/good%20first%20issue).
139
+
140
+ ## License
141
+
142
+ MIT — see [LICENSE](LICENSE). This is an independent project, not affiliated with
143
+ ZONT or Micro Line; it uses only the official public ZONT API.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zont-mcp"
7
+ version = "1.3.2"
8
+ description = "MCP server for ZONT heating system control via AI / MCP-сервер для управления системой отопления ZONT через ИИ"
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "MAB2908" }]
13
+ keywords = ["zont", "mcp", "heating", "smart-home", "baxi", "opentherm", "claude"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: End Users/Desktop",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Home Automation",
23
+ ]
24
+ dependencies = [
25
+ "mcp[cli]>=1.3.0,<2",
26
+ "httpx>=0.27.0",
27
+ "python-dotenv>=1.0.0",
28
+ ]
29
+
30
+ [project.scripts]
31
+ zont-mcp = "server:main"
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/MAB2908/zont-mcp"
35
+ Issues = "https://github.com/MAB2908/zont-mcp/issues"
36
+ Changelog = "https://github.com/MAB2908/zont-mcp/blob/main/CHANGELOG.md"
37
+
38
+ [tool.setuptools]
39
+ py-modules = ["server", "zont_client"]
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [tool.ruff]
45
+ line-length = 100
46
+ target-version = "py311"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,127 @@
1
+ r"""
2
+ ZONT MCP Server
3
+ ===============
4
+ MCP server for controlling the ZONT heating system via AI assistants.
5
+ MCP-сервер для управления системой отопления ZONT через ИИ.
6
+
7
+ Transport: stdio (standard for local MCP servers)
8
+ Authentication: ZONT auth token via environment variables
9
+
10
+ Environment variables:
11
+ ZONT_CLIENT_EMAIL — account email address (required)
12
+ ZONT_TOKEN — auth token (preferred; avoids login on each run)
13
+ ZONT_LOGIN — login (used only for initial token retrieval)
14
+ ZONT_PASSWORD — password (used only for initial token retrieval)
15
+
16
+ Claude Desktop configuration (add to claude_desktop_config.json):
17
+ {
18
+ "mcpServers": {
19
+ "zont": {
20
+ "command": "/path/to/.venv/bin/python",
21
+ "args": ["/path/to/zont-mcp/src/server.py"],
22
+ "env": {
23
+ "ZONT_CLIENT_EMAIL": "your@email.com",
24
+ "ZONT_TOKEN": "your_token"
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ Windows note: Claude Desktop installed from the Microsoft Store (MSIX) reads its
31
+ config from a virtualised path, NOT from %APPDATA%\Claude\:
32
+ %LOCALAPPDATA%/Packages/Claude_pzs8sxrjxfjjc/LocalCache/Roaming/Claude/claude_desktop_config.json
33
+ """
34
+
35
+ import logging
36
+ import os
37
+ import sys
38
+ from pathlib import Path
39
+
40
+ from dotenv import load_dotenv
41
+
42
+ # Load .env from project root (one level above src/)
43
+ load_dotenv(Path(__file__).parent.parent / ".env")
44
+
45
+ # Add src/ to sys.path so tool modules can import zont_client without a package install
46
+ sys.path.insert(0, os.path.dirname(__file__))
47
+
48
+ from mcp.server.fastmcp import FastMCP
49
+
50
+ from tools import analytics, commands, config, control, devices, heating, history
51
+ from zont_client import ZontAPIError, ZontClient
52
+
53
+ logging.basicConfig(
54
+ level=logging.INFO,
55
+ format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
56
+ stream=sys.stderr,
57
+ )
58
+ logger = logging.getLogger("zont-mcp")
59
+
60
+
61
+ def create_server() -> FastMCP:
62
+ """
63
+ Initialise and configure the MCP server.
64
+
65
+ Creates the FastMCP instance, authenticates the ZONT client, and registers
66
+ all tool groups. Exits with status 1 if authentication fails.
67
+ """
68
+ mcp = FastMCP(
69
+ name="zont-mcp",
70
+ instructions=(
71
+ "MCP server for controlling the ZONT heating system via AI. "
72
+ "Supports all ZONT devices: BAXI Connect+, H-2000+, SMART NEW, Climatic, etc. "
73
+ "Tools: state reading, heating control, history, guard zones, diagnostics."
74
+ ),
75
+ )
76
+
77
+ # Initialise the API client from environment variables
78
+ try:
79
+ client = ZontClient.from_env()
80
+ except ZontAPIError as e:
81
+ logger.error("Failed to initialise ZONT client: %s", e)
82
+ sys.exit(1)
83
+
84
+ # Obtain token via login/password if no token is configured
85
+ if not client.token:
86
+ if client.login and client.password:
87
+ logger.info("No token set, requesting via get_authtoken...")
88
+ try:
89
+ token = client.get_authtoken()
90
+ logger.info("Token obtained successfully.")
91
+ # Print to stderr so the user can persist it in ZONT_TOKEN
92
+ print(
93
+ f"[ZONT MCP] Token obtained: {token}\n"
94
+ f"Save it to ZONT_TOKEN to avoid re-authenticating on each start.",
95
+ file=sys.stderr,
96
+ )
97
+ except ZontAPIError as e:
98
+ logger.error("Failed to obtain token: %s", e)
99
+ sys.exit(1)
100
+ else:
101
+ logger.error(
102
+ "Neither ZONT_TOKEN nor ZONT_LOGIN+ZONT_PASSWORD are set."
103
+ )
104
+ sys.exit(1)
105
+
106
+ # Register tool groups. Each module's register() function attaches its
107
+ # @mcp.tool() decorated functions to the FastMCP instance.
108
+ devices.register(mcp, client) # Group 1: device state
109
+ heating.register(mcp, client) # Group 2: heating control
110
+ control.register(mcp, client) # Group 3: I/O and guard zones
111
+ history.register(mcp, client) # Group 4: history and events
112
+ analytics.register(mcp, client) # Group 5: analytics and diagnostics
113
+ config.register(mcp, client) # Group 6: configuration read/write
114
+ commands.register(mcp, client) # Group 7: extra commands and archives
115
+
116
+ logger.info("ZONT MCP server started. Client: %s.", client.client_email)
117
+ return mcp
118
+
119
+
120
+ def main():
121
+ """Entry point. Creates the server and runs it over stdio transport."""
122
+ mcp = create_server()
123
+ mcp.run(transport="stdio")
124
+
125
+
126
+ if __name__ == "__main__":
127
+ main()
@@ -0,0 +1,4 @@
1
+ # ZONT MCP Tools
2
+ from tools import analytics, commands, config, control, devices, heating, history
3
+
4
+ __all__ = ["analytics", "commands", "config", "control", "devices", "heating", "history"]