Claude integration: MCP server with render_page images, skill, JSON CLI

- nxhmi.mcp_server: dependency-free stdio MCP server, 14 tools; readable
  values in and out; render_page returns a PNG image
- .mcp.json for Claude Code, .claude/skills/nextion-hmi/SKILL.md
- CLI: info --json, schema <kind>
- fix: project.add_page(h=...) clashed with the page height keyword
- 75 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-15 15:27:01 +01:00
1 parent b9d7410716
commit 6f8341c66c
9 files changed
+521 -6

No files matched your search

+20
View File
@@ -73,6 +73,26 @@ python -m nxhmi render project.HMI pngs/ # one PNG per page
python -m nxhmi kinds # component kinds for `add`
```
## Use with Claude
The repo is set up for Claude (Claude Code, Claude Desktop or any MCP client):
- **MCP server** -- `python -m nxhmi.mcp_server` (stdio, no dependencies). Tools: `info`,
`get_page`, `set_attributes`, `set_event`, `add_component`, `remove_component`, `add_page`,
`new_project`, `add_picture`, `add_font`, `verify`, `list_kinds`, `schema`, and
**`render_page`, which returns the page as an image** so the model can see what it built.
Attribute values can be readable names (`"xcen": "center"`, `"bco": "#ff0000"`).
`.mcp.json` registers it automatically when Claude Code runs in this repo; elsewhere add:
```json
{"mcpServers": {"nxhmi": {"command": "python", "args": ["-m", "nxhmi.mcp_server"],
"env": {"PYTHONPATH": "/path/to/openhmi-nx/src"}}}}
```
- **Skill** -- [.claude/skills/nextion-hmi/SKILL.md](.claude/skills/nextion-hmi/SKILL.md): the
edit -> verify -> render loop, value names, fonts/pictures, event code, limits.
- **Machine-readable CLI** -- `info --json`, `schema <kind>`, `dump --page`.
## Python
```python