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

+14 -1
View File
@@ -11,6 +11,10 @@ from .page import Page
def cmd_info(a):
if a.json:
from .mcp_server import t_info
print(json.dumps(t_info(a.hmi), indent=1, ensure_ascii=False))
return
h = HMIFile.load(a.hmi)
t0, t1 = h.table_ok()
print("file table: primary %s, backup %s" % ("ok" if t0 else "BAD", "ok" if t1 else "BAD"))
@@ -140,6 +144,11 @@ def cmd_render(a):
print("wrote", path)
def cmd_schema(a):
from .mcp_server import t_schema
print(json.dumps(t_schema(a.kind), indent=1, ensure_ascii=False))
def cmd_kinds(a):
from . import components
for k in components.kinds():
@@ -159,7 +168,11 @@ def cmd_dump(a):
def main(argv=None):
ap = argparse.ArgumentParser(prog="nxhmi", description="Read, verify and write Nextion Editor .HMI projects")
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("info", help="list entries, pages and checksum status"); s.add_argument("hmi"); s.set_defaults(f=cmd_info)
s = sub.add_parser("info", help="list entries, pages and checksum status"); s.add_argument("hmi")
s.add_argument("--json", action="store_true", help="machine-readable overview (pages, components, fonts, ...)")
s.set_defaults(f=cmd_info)
s = sub.add_parser("schema", help="attributes of a component kind (types, defaults, allowed values)")
s.add_argument("kind"); s.set_defaults(f=cmd_schema)
s = sub.add_parser("verify", help="check every checksum"); s.add_argument("hmi", nargs="+"); s.set_defaults(f=cmd_verify)
s = sub.add_parser("decode", help="HMI -> folder of JSON/text"); s.add_argument("hmi"); s.add_argument("out")
s.add_argument("--encoding", default="latin-1"); s.add_argument("--raw", action="store_true", help="numbers instead of names/colours")