@renanlido/tia-openness-mcp 1.11.2 → 1.12.0
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.
- package/README.md +56 -12
- package/dist/index.js +1563 -311
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -59,6 +59,16 @@ never calls the `serve`. The other 105 tools work with the released app. An opti
|
|
|
59
59
|
tool's route differs on an older app: for example `expectedContentHash` (the stale-write guard), where the older `serve`
|
|
60
60
|
returns no `contentGuard` and the tool says the write was not guarded.
|
|
61
61
|
|
|
62
|
+
**Version awareness (App 1.8.0).** `tia_status` and `tia_readiness` preserve their results and expose the
|
|
63
|
+
serve's additive `version` diagnostics: selected host/API major, PublicAPI directory, installed hosts
|
|
64
|
+
and each host's available APIs. Compatibility APIs are not extra installations or support claims.
|
|
65
|
+
Optional `tia_connect.tiaVersion` accepts a string such as `"V21"`; project `.apNN` hints otherwise apply.
|
|
66
|
+
App 1.8.0 ships only V21: legacy selections return `isError:true`, `status:409`,
|
|
67
|
+
`kind:"feature_unsupported_in_version"` and the serve's complete `details`, not a G1 handoff.
|
|
68
|
+
Restart serve to change its bound host/API tuple. The selection input requires the App 1.8.0
|
|
69
|
+
version-aware serve; older app routes do not implement it. Trust registry locations/statuses are
|
|
70
|
+
diagnostic only and never authorize changing trust or answering G1.
|
|
71
|
+
|
|
62
72
|
### Diagnostics + M1 read-only (class R, auto-approvable)
|
|
63
73
|
| Tool | Endpoint | Description |
|
|
64
74
|
|---|---|---|
|
|
@@ -68,6 +78,11 @@ returns no `contentGuard` and the tool says the write was not guarded.
|
|
|
68
78
|
| `tia_job_status` | — (does not call `serve`) | Waits (up to `waitSeconds`, default 20, max 25) for a long tool's background job: returns its final result if the job ends within the wait, otherwise `status:"running"` again; an unknown or forgotten `jobId` answers `not_found` (see "Long operations run as jobs" below). |
|
|
69
79
|
| `tia_block_render` | — (pure, no HTTP call) | Renders ONE SimaticML block export (the content of an exported `.xml`, e.g. the versioned file in git) as readable pseudo-SCL, network by network: LAD/FBD networks become SCL-like statements, SCL networks are rebuilt from their tokens, STL/GRAPH networks are marked not rendered; anything it cannot translate stays visible as `(* unsupported: ... *)` and is listed in `unsupported`, as are a duplicate UId, edge memory shared by several edge parts, a negated operand on an S/R/P/N coil and an invalid name or UId: that part is ambiguous, read it in the XML or report it as not reviewed. A network where one call, system block or box writes a destination whose address (an index or the same variable) depends on another output of the same part is marked `not rendered ... output destinations overlap`: read it in the XML or report it as not reviewed. Notation: `RLO_<UId>` is a temporary holding one value evaluated once (several targets of one value are all assigned from one capture); `TMP_<UId>` is the output of a MOVE/arithmetic box that only runs under its `IF <EN>` (stale when EN is false); `TMP_<UId>_<pin>` is the output or return value of ONE call that has several targets or, for an FC (no instance), that another part reads or that is negated, bound in that call with the targets and readers copying from it (two calls never share a value; a call with an instance and one target is written directly or read as `#inst.pin`); an edge (`P_TRIG`/`N_TRIG`) runs every scan and is evaluated before the `IF` that uses it (`RLO_<UId> := P_TRIG(...);`), so it is not conditional on that EN; `NOT` is a negated output pin; `TYPE#(x)` is `x` read as TYPE (an absolute address of a non-natural type, or an operand of a comparator, arithmetic box or Inc/Dec that is not a constant, a boolean or already of the instruction type, including a value forwarded through MOVE or produced by another box or call such as `INT#(RLO_40)` or `INT#(TMP_41)`, shown with the instruction type because the export does not carry a symbol's declared type; constants and written places are never cast); hidden and bidirectional characters appear as `<U+XXXX>`; ENO is shown as EN. For reading and review only: not importable, layout not preserved. `{ text, blocks, unsupported, note }`; malformed or non-block XML answers `invalid_xml`. Works with the `serve` down. |
|
|
70
80
|
|
|
81
|
+
`tia_block_render` takes **XML text**, never a file path. Call `tia_export_block {plc, block}` and pass its
|
|
82
|
+
inline `xml` field to the renderer. `tia_export_xml` writes files on the serve host; passing one of those
|
|
83
|
+
paths as `xml` does not read that file. Path-like input is refused with `invalid_xml`, an input preview and
|
|
84
|
+
the inline-export hint; a leading BOM on actual XML text is supported.
|
|
85
|
+
|
|
71
86
|
**M1 (read-only, 1:1 with the API's GET endpoints):** `tia_instances`, `tia_status`, `tia_projects`, `tia_project_info`,
|
|
72
87
|
`tia_project_languages`, `tia_plcs`, `tia_devices`, `tia_device_tree`, `tia_device_connections`,
|
|
73
88
|
`tia_plc_blocks/types/tags/watchtables`, `tia_catalog`, `tia_connections_diagnose`, `tia_subnets`,
|
|
@@ -75,8 +90,9 @@ returns no `contentGuard` and the tool says the write was not guarded.
|
|
|
75
90
|
interfaces the CPU sees, plus each adapter's OS status — **no network scan**, unlike
|
|
76
91
|
`tia_accessible_devices`; use it to pick `tia_download`'s connection params). None of them mutate state. `tia_status` reports
|
|
77
92
|
`boundProjectPath` (the project this session is bound to, `null` when none) and `bindingDrift` (`null`, or `{ actual, reason }` when the
|
|
78
|
-
project open in the bound TIA is no longer that one); `tia_project_info`
|
|
79
|
-
|
|
93
|
+
project open in the bound TIA is no longer that one); `tia_project_info` reads the open project's name, path, author,
|
|
94
|
+
device/PLC discovery and `boundProjectPath`/`modified` (unsaved changes), not the connect receipt. Like every project-bound
|
|
95
|
+
call, it answers `409 binding_conflict` on that drift — ask the human which project is
|
|
80
96
|
intended, then `tia_connect` to the bound path (go back) or to the path open now (adopt it).
|
|
81
97
|
|
|
82
98
|
The reads added by epic #74 are documented next to the writes they serve: cross-references, type exports and the PLC writes in "M3" below; the multiuser reads in the "Libraries, HMI, CAx and PLC security" table; the subnet, IO-system, I/O-map, WinCC Unified HMI and VCI reads in [WinCC Unified HMI, network lifecycle, I/O map and version control (epic #74)](#wincc-unified-hmi-network-lifecycle-io-map-and-version-control-epic-74).
|
|
@@ -123,13 +139,21 @@ A **compliant-by-construction** creation surface (45 tools) with schema validati
|
|
|
123
139
|
- **Tags/constants:** `tia_tagtable_create`/`delete`, `tia_tag_create`/`update`/`delete`, `tia_constant_create`/`update`/`delete`.
|
|
124
140
|
- **Blocks/types:** `tia_fb_create`, `tia_instancedb_create`, `tia_ob_create`, `tia_block_delete`/`set_attribute`, `tia_block_group_create`/`delete`, `tia_type_group_create`/`type_delete`.
|
|
125
141
|
- **Code:** `tia_source_put` (textual SCL — Gd6), `tia_import_xml`/`tia_types_import` (graphical SimaticML — Gd6/Gd7), `tia_export_xml`.
|
|
126
|
-
- **Project-as-code proof (#26/#28):** `tia_export_block` (exports ONE block inline as SimaticML — `sha256`/`normalizedSha256`/`bytes`, no file on the serve host) and `tia_block_compare` (compares a block against the SimaticML you pass, e.g. the file in git — normalized, ignores BOM/formatting/`<Created
|
|
142
|
+
- **Project-as-code proof (#26/#28):** `tia_export_block` (exports ONE block inline as SimaticML — `sha256`/`normalizedSha256`/`bytes`, no file on the serve host) and `tia_block_compare` (compares a block against the SimaticML you pass, e.g. the file in git — normalized, ignores BOM/formatting/`<Created>` and canonicalizes UId numbering while preserving wiring — `verdict:"equal"|"different"` is the actual roundtrip proof; a raw hash is not). Both read-mostly: exporting an inconsistent block first compiles it (export requires consistency), which can regenerate its instance DB.
|
|
127
143
|
- **Watch tables:** `tia_watchtable_create`/`delete`.
|
|
128
144
|
- **Generic object layer:** `tia_obj_service`/`set_attributes`/`invoke`/`create`. Declared M-off, but not offline-only:
|
|
129
145
|
the serve's `/obj` risk policy lets these reach online, credential and other deploy-gated members of the object
|
|
130
146
|
model only with the `deploy` license scope, and refuses a download through them for every license — use
|
|
131
147
|
`tia_download`.
|
|
132
148
|
|
|
149
|
+
**Comparison hash change (#149).** `tia_block_compare` renumbers real `UId` attributes by first appearance across
|
|
150
|
+
definitions and references. Rewiring now differs; a pure renumbering still matches, and UId-like text in comments
|
|
151
|
+
and values is preserved. `normalizedSha256` from exports and the comparison's normalized digests can therefore
|
|
152
|
+
change from earlier MCP builds: recompute stored comparison baselines. Raw `sha256` and the serve's `contentHash`
|
|
153
|
+
are unchanged and remain separate contracts. The shared parity fixture's `compareNormalized`/`compareSha256`
|
|
154
|
+
fields retain the legacy pre-#149 vectors needed by the C# contentHash contract tests; current comparison behavior
|
|
155
|
+
is covered by relation tests and `test/compare-wiring.test.ts`, not those historical snapshots.
|
|
156
|
+
|
|
133
157
|
**PLC writes added by epic #74 (ADR 0034) and the reads around them.** Every write is class `author` (the `author` or `deploy` license scope), offline, and takes `dryRun` (Gd11), which the serve answers: it runs the same guards and returns the plan WITHOUT changing anything (needs an open project). A new or renamed tag, constant or block whose name matches, ignoring case, another tag, constant or block of the PLC is `409 name_collision` (`details.collidesWith`). Bench run of 2026-10-19 (`docs/ROADMAP.md` section 10): these writes pass on a real S7-1200 project; V21 accepted every candidate used to provoke a rejected update, so the atomic-rejection paths are covered by unit tests only.
|
|
134
158
|
|
|
135
159
|
| Tool | Endpoint | Class / notes |
|
|
@@ -162,6 +186,7 @@ is a path **on the serve host**.
|
|
|
162
186
|
|---|---|---|
|
|
163
187
|
| `tia_library_mastercopies` / `tia_library_types` | `GET /library/mastercopies` · `GET /library/types` | R — project-library master copies; library types with their versions. |
|
|
164
188
|
| `tia_library_mastercopy_create` | `POST /library/mastercopies` | M-off, job — master copy of a **device** (a block cannot be a source). |
|
|
189
|
+
| `tia_device_from_mastercopy` | `POST /devices/frommastercopy` | M-off, job; app ≥ 1.8.0 — a **new** station from a prepared device master copy. Known block-only content: `409 mastercopy_not_device`. Validated 1214C V4.4 inheritance: PUT/GET, OPC UA license selection and HR mappings. Not an existing-CPU setter or entitlement grant; inspect the clone's certificate and compile. |
|
|
165
190
|
| `tia_block_from_mastercopy` | `POST /plcs/{plc}/blocks/frommastercopy` | M-off — needs a master copy holding PLC blocks; a device copy is refused (`409 mastercopy_not_blocks` after app 1.6.3; up to 1.6.3 a 500). |
|
|
166
191
|
| `tia_global_libraries` | `GET /globallibraries` | R — global libraries open in the TIA Portal session. |
|
|
167
192
|
| `tia_global_library_create` / `_open` / `_save` / `_close` | `POST /globallibraries` (+ `/open` `/save` `/close`) | M-off (create/open/save run as jobs). Save/close take the name from `tia_global_libraries` (exact name first, then ignoring case); a name that picks no single open user library is refused, nothing saved or closed — `404 not_found` (`details.userLibraries` lists the names that work), or `409 conflict` for a system/corporate library or an ambiguous name — after app 1.6.3 (up to 1.6.3 a success even for an unknown name). A library opened read-only cannot be saved: `409 conflict` (`details.readOnly`) after app 1.6.3, a 500 up to 1.6.3. |
|
|
@@ -186,11 +211,18 @@ Reads (class R) and offline changes (class M-off) added by epic #74. Every chang
|
|
|
186
211
|
|
|
187
212
|
**Network lifecycle (ADR 0035).** `tia_device_network` returns each interface's `item`, the `interface` value that `tia_pn_name_set` and the `tia_io_system_*` tools take (default: the primary network interface). The reads list `inventoryGaps` [{kind, subject, reason}] — reads that failed during the scan; a non-empty list means the nodes and IO systems may be incomplete. A write answers a `postcheck` (the serve re-reads); a mismatch is `409 postcheck_failed` (`details.mismatches`, and `details.rollback` where the write can be undone): re-read before anything else. `tia_network_connect`, `tia_network_address` and `tia_network_disconnect` carry a `postcheck` too.
|
|
188
213
|
|
|
214
|
+
`tia_network_connect` uses `POST /network/connect/plan` for `dryRun:true`, never the legacy
|
|
215
|
+
mutation route. An older serve safely returns `404 route_not_found` with upgrade guidance.
|
|
216
|
+
With an `ip`, both preview and apply require readable Address metadata/current value before any
|
|
217
|
+
connection or write: `node_attribute_list_unavailable` and `node_attribute_unreadable` mean nothing
|
|
218
|
+
changed. Re-read with `tia_device_network`; an ignored address setter returns `postcheck_failed`
|
|
219
|
+
before any optional IO-system creation. A call without `ip` does not need Address metadata.
|
|
220
|
+
|
|
189
221
|
| Tool | Endpoint | Class / notes |
|
|
190
222
|
|---|---|---|
|
|
191
|
-
| `tia_subnet_get` | `GET /subnets/{subnet}
|
|
223
|
+
| `tia_subnet_get` | `GET /subnets/{subnet}?limit=&cursor=` | R — one subnet: attributes, `updatable`, connected `nodes` and `ioSystems`; optional pages count nodes then IO-device assignments (an empty system is one unit), with `total` and `nextCursor`. |
|
|
192
224
|
| `tia_device_network` | `GET /devices/{device}/network` | R — per interface: subnet, node (name, address, mask), `pn` (PROFINET device name, auto-generation), `ioController` / `ioConnector` IO system; unknown device `404 not_found`. |
|
|
193
|
-
| `tia_io_systems` | `GET /iosystems
|
|
225
|
+
| `tia_io_systems` | `GET /iosystems?limit=&cursor=` | R — IO systems `{name, number, subnet, controller, devices}`; optional pages count device assignments plus empty systems, repeating a split system's header with only that page's devices. |
|
|
194
226
|
| `tia_subnet_update` | `POST /subnets/{subnet}` | M-off — rename and/or set the attributes allow-listed for the net type (`updatable` in `tia_subnet_get`); only differing values are written. A rename takes at most 24 characters: a longer name is `400 invalid_subnet_name` (`details.name`, `length`, `maxLength`; a `dryRun` too, nothing changed) although `tia_subnet_create` accepts longer names; a name equal to the current one is not a rename, and the serve counts UTF-16 code units, spaces included (how TIA counts other characters is not verified). `409 subnet_name_in_use`, `400 unsupported_subnet_attribute`, `409 subnet_not_writable`; the result carries `changes`. |
|
|
195
227
|
| `tia_subnet_delete` | `DELETE /subnets/{subnet}?disconnectNodes=true` | M-off — a subnet with nodes or IO systems is `409 subnet_not_empty` (`details.nodes`, `details.ioSystems`) unless `disconnectNodes:true`, which disconnects every node and removes the IO systems first. `409 subnet_delete_incomplete`: the project is partially changed, re-read with `tia_subnet_get`. |
|
|
196
228
|
| `tia_pn_name_set` | `POST /devices/{device}/pn-name` | M-off — the PROFINET device name of one interface and/or its auto-generation (an explicit name turns auto-generation off: a node in its default state, auto-generation on and `PnDeviceName` read-only, takes a `name` that way). The name is DNS-style and lower case (`400 invalid_pn_device_name`); `409 pn_name_in_use`, `409 pn_names_unverifiable`, `409 pn_name_unsupported` (the interface is not a PROFINET interface, or an attribute the request writes is not writable). The `dryRun` cannot prove that the name becomes writable after the switch, so a `plan_ok` can still be followed by `409 pn_name_unsupported` from the real call: the serve then writes the previous auto-generation back and verifies it (the error says "Nothing was changed." only when that read-back confirms it, otherwise `409 conflict` names `autoGeneration` as NOT restored: re-read with `tia_device_network`). |
|
|
@@ -280,14 +312,16 @@ Accepts the structured **project-spec** (`docs/TIA-BEST-PRACTICES.md` §13.2; JS
|
|
|
280
312
|
|
|
281
313
|
### Long operations run as jobs (ADR 0009)
|
|
282
314
|
|
|
283
|
-
Opening a project takes 40–80 s in the field
|
|
284
|
-
|
|
285
|
-
soft-deadline job runner instead of blocking
|
|
315
|
+
Opening a project takes 40–80 s in the field; device creation (CPU/HMI), SimaticML block/UDT imports,
|
|
316
|
+
and a compile/download of a large project can also exceed 30 s. Some MCP clients abort individual calls
|
|
317
|
+
at 30 s (client limits vary). The following tools run through a soft-deadline job runner instead of blocking
|
|
318
|
+
the call: `tia_connect`, `tia_start`, `tia_show_ui`,
|
|
286
319
|
`tia_project_create`, `tia_project_save`, `tia_project_saveas`, `tia_project_close`, `tia_project_archive`,
|
|
287
|
-
`tia_compile`, `tia_block_compile`, `tia_source_put`, `
|
|
320
|
+
`tia_compile`, `tia_block_compile`, `tia_source_put`, `tia_device_create`, `tia_import_xml`, `tia_types_import`,
|
|
321
|
+
`tia_download` (plan and real), `tia_upload`, `tia_export_xml`,
|
|
288
322
|
`tia_spec_apply`, `tia_export_block`, `tia_export_type`, `tia_type_source`, `tia_block_compare`, `tia_crossrefs`,
|
|
289
323
|
`tia_io_map`, `tia_cax_export`, `tia_cax_import`, `tia_hmi_screen_export`, `tia_hmi_screens_import`, `tia_hmi_validate`,
|
|
290
|
-
`tia_global_library_create`, `tia_global_library_open`, `tia_global_library_save`, `tia_library_mastercopy_create`,
|
|
324
|
+
`tia_global_library_create`, `tia_global_library_open`, `tia_global_library_save`, `tia_library_mastercopy_create`, `tia_device_from_mastercopy`,
|
|
291
325
|
`tia_local_session_open`, `tia_local_session_save`, `tia_local_session_close`, `tia_objects_mark`, `tia_objects_unmark`,
|
|
292
326
|
`tia_vci_status`, `tia_vci_export` and `tia_vci_import`.
|
|
293
327
|
|
|
@@ -308,6 +342,16 @@ soft-deadline job runner instead of blocking the call: `tia_connect`, `tia_start
|
|
|
308
342
|
- A lifecycle job that remains running may still be starting or waiting for the trust dialog; `running` alone is not G1 evidence.
|
|
309
343
|
Follow its conditional `nextSteps`, and ask a human to confirm G1 only if the dialog is visible on the serve host.
|
|
310
344
|
|
|
345
|
+
**Client tool timeouts.** A client's MCP timeout is separate from the MCP's `TIA_*_TIMEOUT_MS` HTTP
|
|
346
|
+
deadlines; raising an HTTP deadline does not raise the client's limit. Keep the soft deadline below the
|
|
347
|
+
client's limit, with headroom for transport. Where the client supports an override, increase its tool-call
|
|
348
|
+
timeout rather than retrying a mutation with an unknown outcome. For a manually configured Codex `tia`
|
|
349
|
+
server, set `tool_timeout_sec = 120` in the existing `[mcp_servers.tia]` table in `~/.codex/config.toml`
|
|
350
|
+
(seconds, not under `.env`), then restart the client. Codex documents this setting and a 60 s default in
|
|
351
|
+
its [official MCP configuration guide](https://developers.openai.com/codex/mcp#other-configuration-options).
|
|
352
|
+
This is an optional client override, not a replacement for polling jobs or approval gates. For other
|
|
353
|
+
clients, use only their documented tool timeout controls; there is no universal MCP timeout setting.
|
|
354
|
+
|
|
311
355
|
### Tool annotations, structured output and confirmation dialogs (ADR 0026)
|
|
312
356
|
|
|
313
357
|
**Annotations.** Every tool publishes the four MCP hints, all derived from its class in `src/tool-classes.json` (none is set
|
|
@@ -412,7 +456,7 @@ any other.
|
|
|
412
456
|
|
|
413
457
|
Every array and every object below the top level of the read tools' `outputSchema` accepts a marker in place of its value (the
|
|
414
458
|
lists at the top of the result, each element of a list, the `tags` of a tag table, the `items` and `addresses` of a device-tree
|
|
415
|
-
node
|
|
459
|
+
node and the `plcs` of `tia_project_info`), so the oversized `tags` of one table, one whole device or the `items`
|
|
416
460
|
of one device item become a marker and the rest of the result, `total` included, stays. Only a string field the schema
|
|
417
461
|
types as a plain string cannot hold one: such a value over the cap answers with an `isError` result of `kind:"response_too_large"`
|
|
418
462
|
instead, with `details` `{chars, valueChars, responseChars, issues}` and a hint.
|
|
@@ -461,7 +505,7 @@ Paging needs a serve that supports it (`docs/API-HTTP.md`, "Paging (`limit` and
|
|
|
461
505
|
two inputs and answers the whole list, without `total` or `nextCursor`. The decision record is
|
|
462
506
|
`docs/adr/0031-payload-budgets-and-cursor-paging-for-large-reads.md` in the repository.
|
|
463
507
|
|
|
464
|
-
**Other paged reads.** `tia_crossrefs`, `tia_io_map`, `tia_vci_status`, `tia_server_projects`, `tia_markings` and the WinCC Unified HMI reads (`tia_hmi_tag_tables`, `tia_hmi_tags`, `tia_hmi_connections`, `tia_hmi_alarms`, `tia_hmi_alarm_classes`, `tia_hmi_screen_items`, `tia_hmi_validate`) take the same `limit` and `cursor` and answer `total` and `nextCursor`, each counting its own units (see the tool's row). `cursor_stale` and `invalid_cursor` are recovered as above, and a page over the budget loses its `nextCursor`.
|
|
508
|
+
**Other paged reads.** `tia_subnet_get`, `tia_io_systems`, `tia_crossrefs`, `tia_io_map`, `tia_vci_status`, `tia_server_projects`, `tia_markings` and the WinCC Unified HMI reads (`tia_hmi_tag_tables`, `tia_hmi_tags`, `tia_hmi_connections`, `tia_hmi_alarms`, `tia_hmi_alarm_classes`, `tia_hmi_screen_items`, `tia_hmi_validate`) take the same `limit` and `cursor` and answer `total` and `nextCursor`, each counting its own units (see the tool's row). `cursor_stale` and `invalid_cursor` are recovered as above, and a page over the budget loses its `nextCursor`. Network `inventoryGaps` describes the whole scan on every page: if that list itself is omitted, a smaller `limit` cannot shrink it; raise `TIA_MCP_MAX_VALUE_CHARS`/`TIA_MCP_MAX_RESPONSE_CHARS` or read the serve directly.
|
|
465
509
|
|
|
466
510
|
## Configuration (env)
|
|
467
511
|
|