@codesys/mcp-toolkit 2.1.0 → 2.1.2

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/CHANGELOG.md CHANGED
@@ -1,181 +1,202 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [2.1.0] - 2026-11-13
9
-
10
- ### Added
11
- - `--attach <dir>` (experimental): work in a CODESYS / Machine Expert window you
12
- already have open. The server writes `start_attach.py`; run it in the window
13
- with Tools > Scripting > Execute Script File. A UI timer polls for requests, so
14
- the window stays usable. Nothing is started or killed. (#12, thanks @dFxed)
15
- - EcoStruxure Machine Expert V2.3 works: `LogicBuilder.exe` has no profiles, so
16
- `--codesys-profile` is optional for products other than `CODESYS.exe` and
17
- `--profile` is left out when there is none. CODESYS behaviour is unchanged.
18
- (#7, #11, thanks @dFxed)
19
-
20
- ### Fixed
21
- - `read_objects` says when the PLCopenXML export of a graphical object fails,
22
- instead of leaving its body out without a word. (#13, thanks @Alfabete-spec)
23
- - `codesys_sim_start` refuses when the application is already logged in, which
24
- can happen in a window opened with `--attach`. It could otherwise have taken
25
- over a connection to a real controller.
26
- - A result file that stays unreadable fails the call after a few seconds
27
- instead of being retried forever.
28
-
29
- ## [2.0.1] - 2026-11-10
30
-
31
- ### Added
32
- - Listing in the official MCP Registry as
33
- `io.github.johannesPettersson80/codesys-mcp-toolkit`: `mcpName` in
34
- `package.json` and a `server.json`.
35
-
36
- ## [2.0.0] - 2026-11-09
37
-
38
- Rewrite. See README "Migrating from v1".
39
-
40
- ### Changed
41
- - CODESYS runs once per session with a watcher script (file-queue IPC,
42
- JSON op requests, heartbeat, hang/crash detection and restart) instead of
43
- a cold `--runscript` per call.
44
- - ESM TypeScript on MCP SDK v2 (`@modelcontextprotocol/server`), Node 20+.
45
- - One tool, `codesys`, so a client that asks for approval per tool asks once.
46
- Each operation is an action of it (`read_objects`, `write_object`,
47
- `create_object`, `get_project_tree`, `search_code`, `compile`,
48
- `list_libraries`, `add_library`, `list_tasks`, `codesys_status`, ...), and
49
- actions work on the open project. `help` lists them with their arguments,
50
- and `batch` runs several in one call.
51
- - Structured Text only; graphical objects are listed as `[non-ST]`.
52
- - No login or download to a controller. The online functions are used only
53
- for CODESYS's own simulation.
54
- - Earlier development builds simulated in truST. That is gone; the options
55
- `--trust-runtime`, `--mirror-dir` and `--no-sim` are accepted and ignored,
56
- so existing client setups keep starting.
57
-
58
- ### Added
59
- - CODESYS's own simulation, with nothing extra to install: `codesys_sim_start`,
60
- `codesys_sim_stop`, `codesys_sim_status`, `codesys_sim_control`,
61
- `codesys_sim_cycle`, `codesys_sim_read`, `codesys_sim_write`,
62
- `codesys_sim_force`, `codesys_sim_unforce`. Runs on the real compiler and
63
- libraries; the project is locked while it runs.
64
- - `get_outline`, `get_io_list`: the project's structure and interfaces, and
65
- its I/O variables, from one export instead of reading every object.
66
- - `get_library_api`: interfaces of referenced source libraries.
67
- - `checkpoint`, `get_changes`, `revert_object`: change tracking against
68
- snapshots, with an automatic `session-start` snapshot on open.
69
- - `open_sim_panel`: a live panel inside the chat (MCP App), which Claude opens
70
- after opening or creating a project. It is a separate tool with its own
71
- approval. Open workspace on the card expands it.
72
- - `open_workspace`: the same workspace in the default browser, when the user
73
- asks for it, served on 127.0.0.1 with a token. Options `--viewer-port`,
74
- `--no-viewer`.
75
- - Panel views that follow Claude's work: Code (live code with new lines
76
- marked) and Review (accept or revert each changed object, with its
77
- added/removed line counts; in the chat card the changes open in place).
78
- - `compile` checks every POU, GVL and DUT, including those no task calls (it
79
- sets "link always" for the build and restores it); `deep` also generates
80
- code, `clean` builds from scratch.
81
- - CODESYS V3.5 SP22: the toolkit passes the install's additional folder
82
- (`CODESYS\AdditionalFolders\Default`, where SP22 keeps add-ons such as
83
- Scripting) as `--additionalfolder`, and reads profiles from it.
84
- `--codesys-additional-folder` overrides it.
85
- - `codesys_status` and the panel show the Scripting add-on version next to
86
- the CODESYS install and compiler version. The server log says why an install
87
- was picked.
88
- - Build properties: objects excluded from the build are marked in the tree.
89
- The application's compiler defines and, with Scripting 4.2, the project
90
- defines and compiler version are reported.
91
- - `get_devices`: the device tree and its I/O channels with their mapped
92
- variables; `get_io_list` includes the device-tree mappings.
93
- - `read_objects` returns graphical bodies (SFC, CFC, LD, FBD) as PLCopenXML.
94
- - `open_project` opens `.projectarchive` files; `save_project` can write one.
95
- - `remove_library`. `add_library` also takes a bare title (`Util`), with an
96
- optional version.
97
- - `get_library_api` lists compiled libraries and ones the project doesn't
98
- reference, with their descriptions, from CODESYS's library browser cache.
99
- - A profile that isn't installed is refused at start, with the installed ones
100
- listed. The `--workspace` folder is created if missing.
101
- - Profiles and templates are also found for programs laid out unlike
102
- `CODESYS.exe`. See `docs/machine-expert-testing.md` for testing with
103
- Schneider Machine Expert, which isn't supported yet.
104
- - Checkpoints keep graphical bodies as PLCopenXML; `revert_object` re-imports
105
- a deleted graphical object instead of recreating it as empty ST.
106
- - Compile messages give the real column (from CODESYS's offset; its own
107
- text says column 1) and the token length; the full-screen editor marks
108
- lines with errors and warnings.
109
- - `configure_task`: create and configure tasks (kind, interval, priority,
110
- event, core, watchdog) and add program calls; `list_tasks` shows the event,
111
- core and watchdog. Removing a call is refused with an explanation: SP21's
112
- scripting can't do it.
113
- - Shared session: server processes started with the same options share one
114
- background owner (one CODESYS), so the panel shows the project the chat
115
- works on. `--no-shared` runs in-process as before.
116
- - **In the chat:** a compact card with status, what Claude is working on
117
- and changes.
118
- - **Full screen:** a CODESYS-style workspace with the project tree and
119
- badges, editor tabs (diff against the session start), and problems and
120
- review tabs.
121
- - **Follow Claude** opens what Claude edits.
122
- - **Selections** are sent to Claude as model context.
123
- - **Panel-only tools** (`get_sim_state`, `get_workspace`, `get_object`) are
124
- hidden from clients without MCP Apps support. They read a project cache
125
- that the tools keep current, so the panel never calls CODESYS.
126
- - **Interaction:** accept or revert Claude's change per object (a `review`
127
- checkpoint the badges and diffs compare with), and **Pause Claude**, which
128
- holds Claude's changing tools with a `paused_by_user` answer. User actions
129
- are sent to Claude as model context. They use app-only `ui_*` tools.
130
-
131
- ### Fixed
132
- - The server advertises the MCP Apps extension (`io.modelcontextprotocol/ui`)
133
- in its capabilities. A host may otherwise treat the card tool as plain text
134
- and show no card.
135
- - `create_project` makes a project that compiles (#4). CODESYS's shipped
136
- `Standard.project` can be years old: SP22's names device 3.1.3.0 and
137
- `IoStandard, 3.1.3.1`. The new copy is brought up to the running CODESYS's
138
- device, compiler and libraries. Templates you pass and projects you open are
139
- never updated.
140
- - `open_project` says when a project needs a newer compiler than the running
141
- CODESYS has, and so can't compile there.
142
- - A start-up timeout or a crash during a call reports what the program printed.
143
- - A dialog CODESYS waits on during a call ends the call in about 15 seconds
144
- with an error that names it. Before, the call ran into its timeout (up to 5
145
- minutes).
146
- - A request file held for a moment by another process (antivirus, indexer) no
147
- longer fails the call with `bad_request`.
148
- - `compile` returns errors and warnings with object, line and code (#10).
149
- - Non-ASCII text round-trips (UTF-8 end to end) (#9).
150
- - Reads work in Claude Desktop because they are tools, not resources (#6).
151
- - Declarations that drop or change the object header are rejected (#5).
152
- - Functions get their return type (#8).
153
- - Object kinds come from type GUIDs, so localised CODESYS works.
154
- - Interfaces are created without the implicit `__System.IQueryInterface` base.
155
-
156
- ## [1.1.16] - 2025-05-06
157
-
158
- ### Fixed
159
- - Reverted to v1.1.3 code base which has working POU creation functionality
160
- - Fixed path handling by using simpler approach from v1.1.3
161
- - Restored original Application object finding logic that worked in v1.1.3
162
-
163
- ## [1.0.0] - 2025-04-23
164
-
165
- ### Added
166
- - Initial release of the MCP server for CODESYS
167
- - Command-line interface with configuration options
168
- - Project management functionality:
169
- - Opening existing CODESYS projects
170
- - Creating new CODESYS projects
171
- - Saving projects
172
- - POU (Program Organization Unit) management:
173
- - Creating POUs (Programs, Function Blocks, Functions)
174
- - Setting POU code (declaration and implementation)
175
- - Creating properties and methods for Function Blocks
176
- - Project compilation support
177
- - Resources for querying:
178
- - Project status
179
- - Project structure
180
- - POU code
181
- - Documentation for installation and usage
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.1.2] - 2026-11-13
9
+
10
+ ### Fixed
11
+ - `get_devices` really shows Machine Expert modules by their module id. 2.1.1
12
+ expected `get_module_identification()` to return an object, but in CODESYS
13
+ and Machine Expert 2.3 it returns the module id as a string (empty for a
14
+ device that isn't a module), so the module id was never read.
15
+
16
+ ## [2.1.1] - 2026-11-13
17
+
18
+ ### Fixed
19
+ - `get_devices` tells modules apart. A module is a device that exists only
20
+ inside its owner, such as Machine Expert's local I/O and embedded functions.
21
+ CODESYS reports the owner's type and id for it, so every device looked the
22
+ same (#7). Modules now show their module id.
23
+
24
+ ### Changed
25
+ - Releases are published from GitHub Actions through npm trusted publishing,
26
+ so the npm package carries a provenance statement, and `server.json` goes to
27
+ the MCP Registry in the same run.
28
+
29
+ ## [2.1.0] - 2026-11-13
30
+
31
+ ### Added
32
+ - `--attach <dir>` (experimental): work in a CODESYS / Machine Expert window you
33
+ already have open. The server writes `start_attach.py`; run it in the window
34
+ with Tools > Scripting > Execute Script File. A UI timer polls for requests, so
35
+ the window stays usable. Nothing is started or killed. (#12, thanks @dFxed)
36
+ - EcoStruxure Machine Expert V2.3 works: `LogicBuilder.exe` has no profiles, so
37
+ `--codesys-profile` is optional for products other than `CODESYS.exe` and
38
+ `--profile` is left out when there is none. CODESYS behaviour is unchanged.
39
+ (#7, #11, thanks @dFxed)
40
+
41
+ ### Fixed
42
+ - `read_objects` says when the PLCopenXML export of a graphical object fails,
43
+ instead of leaving its body out without a word. (#13, thanks @Alfabete-spec)
44
+ - `codesys_sim_start` refuses when the application is already logged in, which
45
+ can happen in a window opened with `--attach`. It could otherwise have taken
46
+ over a connection to a real controller.
47
+ - A result file that stays unreadable fails the call after a few seconds
48
+ instead of being retried forever.
49
+
50
+ ## [2.0.1] - 2026-11-10
51
+
52
+ ### Added
53
+ - Listing in the official MCP Registry as
54
+ `io.github.johannesPettersson80/codesys-mcp-toolkit`: `mcpName` in
55
+ `package.json` and a `server.json`.
56
+
57
+ ## [2.0.0] - 2026-11-09
58
+
59
+ Rewrite. See README "Migrating from v1".
60
+
61
+ ### Changed
62
+ - CODESYS runs once per session with a watcher script (file-queue IPC,
63
+ JSON op requests, heartbeat, hang/crash detection and restart) instead of
64
+ a cold `--runscript` per call.
65
+ - ESM TypeScript on MCP SDK v2 (`@modelcontextprotocol/server`), Node 20+.
66
+ - One tool, `codesys`, so a client that asks for approval per tool asks once.
67
+ Each operation is an action of it (`read_objects`, `write_object`,
68
+ `create_object`, `get_project_tree`, `search_code`, `compile`,
69
+ `list_libraries`, `add_library`, `list_tasks`, `codesys_status`, ...), and
70
+ actions work on the open project. `help` lists them with their arguments,
71
+ and `batch` runs several in one call.
72
+ - Structured Text only; graphical objects are listed as `[non-ST]`.
73
+ - No login or download to a controller. The online functions are used only
74
+ for CODESYS's own simulation.
75
+ - Earlier development builds simulated in truST. That is gone; the options
76
+ `--trust-runtime`, `--mirror-dir` and `--no-sim` are accepted and ignored,
77
+ so existing client setups keep starting.
78
+
79
+ ### Added
80
+ - CODESYS's own simulation, with nothing extra to install: `codesys_sim_start`,
81
+ `codesys_sim_stop`, `codesys_sim_status`, `codesys_sim_control`,
82
+ `codesys_sim_cycle`, `codesys_sim_read`, `codesys_sim_write`,
83
+ `codesys_sim_force`, `codesys_sim_unforce`. Runs on the real compiler and
84
+ libraries; the project is locked while it runs.
85
+ - `get_outline`, `get_io_list`: the project's structure and interfaces, and
86
+ its I/O variables, from one export instead of reading every object.
87
+ - `get_library_api`: interfaces of referenced source libraries.
88
+ - `checkpoint`, `get_changes`, `revert_object`: change tracking against
89
+ snapshots, with an automatic `session-start` snapshot on open.
90
+ - `open_sim_panel`: a live panel inside the chat (MCP App), which Claude opens
91
+ after opening or creating a project. It is a separate tool with its own
92
+ approval. Open workspace on the card expands it.
93
+ - `open_workspace`: the same workspace in the default browser, when the user
94
+ asks for it, served on 127.0.0.1 with a token. Options `--viewer-port`,
95
+ `--no-viewer`.
96
+ - Panel views that follow Claude's work: Code (live code with new lines
97
+ marked) and Review (accept or revert each changed object, with its
98
+ added/removed line counts; in the chat card the changes open in place).
99
+ - `compile` checks every POU, GVL and DUT, including those no task calls (it
100
+ sets "link always" for the build and restores it); `deep` also generates
101
+ code, `clean` builds from scratch.
102
+ - CODESYS V3.5 SP22: the toolkit passes the install's additional folder
103
+ (`CODESYS\AdditionalFolders\Default`, where SP22 keeps add-ons such as
104
+ Scripting) as `--additionalfolder`, and reads profiles from it.
105
+ `--codesys-additional-folder` overrides it.
106
+ - `codesys_status` and the panel show the Scripting add-on version next to
107
+ the CODESYS install and compiler version. The server log says why an install
108
+ was picked.
109
+ - Build properties: objects excluded from the build are marked in the tree.
110
+ The application's compiler defines and, with Scripting 4.2, the project
111
+ defines and compiler version are reported.
112
+ - `get_devices`: the device tree and its I/O channels with their mapped
113
+ variables; `get_io_list` includes the device-tree mappings.
114
+ - `read_objects` returns graphical bodies (SFC, CFC, LD, FBD) as PLCopenXML.
115
+ - `open_project` opens `.projectarchive` files; `save_project` can write one.
116
+ - `remove_library`. `add_library` also takes a bare title (`Util`), with an
117
+ optional version.
118
+ - `get_library_api` lists compiled libraries and ones the project doesn't
119
+ reference, with their descriptions, from CODESYS's library browser cache.
120
+ - A profile that isn't installed is refused at start, with the installed ones
121
+ listed. The `--workspace` folder is created if missing.
122
+ - Profiles and templates are also found for programs laid out unlike
123
+ `CODESYS.exe`. See `docs/machine-expert-testing.md` for testing with
124
+ Schneider Machine Expert, which isn't supported yet.
125
+ - Checkpoints keep graphical bodies as PLCopenXML; `revert_object` re-imports
126
+ a deleted graphical object instead of recreating it as empty ST.
127
+ - Compile messages give the real column (from CODESYS's offset; its own
128
+ text says column 1) and the token length; the full-screen editor marks
129
+ lines with errors and warnings.
130
+ - `configure_task`: create and configure tasks (kind, interval, priority,
131
+ event, core, watchdog) and add program calls; `list_tasks` shows the event,
132
+ core and watchdog. Removing a call is refused with an explanation: SP21's
133
+ scripting can't do it.
134
+ - Shared session: server processes started with the same options share one
135
+ background owner (one CODESYS), so the panel shows the project the chat
136
+ works on. `--no-shared` runs in-process as before.
137
+ - **In the chat:** a compact card with status, what Claude is working on
138
+ and changes.
139
+ - **Full screen:** a CODESYS-style workspace with the project tree and
140
+ badges, editor tabs (diff against the session start), and problems and
141
+ review tabs.
142
+ - **Follow Claude** opens what Claude edits.
143
+ - **Selections** are sent to Claude as model context.
144
+ - **Panel-only tools** (`get_sim_state`, `get_workspace`, `get_object`) are
145
+ hidden from clients without MCP Apps support. They read a project cache
146
+ that the tools keep current, so the panel never calls CODESYS.
147
+ - **Interaction:** accept or revert Claude's change per object (a `review`
148
+ checkpoint the badges and diffs compare with), and **Pause Claude**, which
149
+ holds Claude's changing tools with a `paused_by_user` answer. User actions
150
+ are sent to Claude as model context. They use app-only `ui_*` tools.
151
+
152
+ ### Fixed
153
+ - The server advertises the MCP Apps extension (`io.modelcontextprotocol/ui`)
154
+ in its capabilities. A host may otherwise treat the card tool as plain text
155
+ and show no card.
156
+ - `create_project` makes a project that compiles (#4). CODESYS's shipped
157
+ `Standard.project` can be years old: SP22's names device 3.1.3.0 and
158
+ `IoStandard, 3.1.3.1`. The new copy is brought up to the running CODESYS's
159
+ device, compiler and libraries. Templates you pass and projects you open are
160
+ never updated.
161
+ - `open_project` says when a project needs a newer compiler than the running
162
+ CODESYS has, and so can't compile there.
163
+ - A start-up timeout or a crash during a call reports what the program printed.
164
+ - A dialog CODESYS waits on during a call ends the call in about 15 seconds
165
+ with an error that names it. Before, the call ran into its timeout (up to 5
166
+ minutes).
167
+ - A request file held for a moment by another process (antivirus, indexer) no
168
+ longer fails the call with `bad_request`.
169
+ - `compile` returns errors and warnings with object, line and code (#10).
170
+ - Non-ASCII text round-trips (UTF-8 end to end) (#9).
171
+ - Reads work in Claude Desktop because they are tools, not resources (#6).
172
+ - Declarations that drop or change the object header are rejected (#5).
173
+ - Functions get their return type (#8).
174
+ - Object kinds come from type GUIDs, so localised CODESYS works.
175
+ - Interfaces are created without the implicit `__System.IQueryInterface` base.
176
+
177
+ ## [1.1.16] - 2025-05-06
178
+
179
+ ### Fixed
180
+ - Reverted to v1.1.3 code base which has working POU creation functionality
181
+ - Fixed path handling by using simpler approach from v1.1.3
182
+ - Restored original Application object finding logic that worked in v1.1.3
183
+
184
+ ## [1.0.0] - 2025-04-23
185
+
186
+ ### Added
187
+ - Initial release of the MCP server for CODESYS
188
+ - Command-line interface with configuration options
189
+ - Project management functionality:
190
+ - Opening existing CODESYS projects
191
+ - Creating new CODESYS projects
192
+ - Saving projects
193
+ - POU (Program Organization Unit) management:
194
+ - Creating POUs (Programs, Function Blocks, Functions)
195
+ - Setting POU code (declaration and implementation)
196
+ - Creating properties and methods for Function Blocks
197
+ - Project compilation support
198
+ - Resources for querying:
199
+ - Project status
200
+ - Project structure
201
+ - POU code
202
+ - Documentation for installation and usage
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 CODESYS MCP Server 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.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CODESYS MCP Server 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.
@@ -7,6 +7,8 @@ export interface DeviceInfo {
7
7
  type?: number | null;
8
8
  id?: string;
9
9
  version?: string;
10
+ /** Module id of a module (a device inside its owner, e.g. local I/O); its type and id are the owner's. */
11
+ module?: string | null;
10
12
  enabled?: boolean | null;
11
13
  /** The device's I/O mapping in CODESYS's CSV export format (only when it has channels). */
12
14
  io_csv?: string;
@@ -69,7 +69,11 @@ export function describeDevices(devices) {
69
69
  return "No devices in the project.";
70
70
  const lines = [];
71
71
  for (const d of devices) {
72
- const ident = d.id ? ` (type ${d.type ?? "?"}, id ${d.id}, version ${d.version ?? "?"})` : "";
72
+ const ident = d.module
73
+ ? ` (module ${d.module}${d.version ? `, version ${d.version}` : ""})`
74
+ : d.id
75
+ ? ` (type ${d.type ?? "?"}, id ${d.id}, version ${d.version ?? "?"})`
76
+ : "";
73
77
  const channels = d.io_csv ? parseIoMappingCsv(d.io_csv) : [];
74
78
  const mapped = channels.filter((c) => c.variable).length;
75
79
  lines.push(`${" ".repeat(d.depth)}${d.name}${ident}${d.enabled === false ? " [disabled]" : ""}${channels.length ? `: ${channels.length} channel(s), ${mapped} mapped` : ""}${d.io_error ? ` (I/O mapping not readable: ${d.io_error})` : ""}`);
@@ -1 +1 @@
1
- {"version":3,"file":"devices.js","sourceRoot":"","sources":["../../src/codesys/devices.ts"],"names":[],"mappings":"AAAA,qGAAqG;AA4BrG,mDAAmD;AACnD,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACd,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBAClC,GAAG,IAAI,GAAG,CAAC;gBACX,CAAC,EAAE,CAAC;YACN,CAAC;;gBAAM,MAAM,GAAG,CAAC,MAAM,CAAC;QAC1B,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,GAAG,CA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C;QACF,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;QACnO,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { McpServer } from "@modelcontextprotocol/server";
2
2
  import { type AppContext } from "./tools.js";
3
- export declare const VERSION = "2.1.0";
3
+ export declare const VERSION = "2.1.2";
4
4
  export declare function createServer(ctx: AppContext): McpServer;
5
5
  export type { AppContext };
package/dist/server.js CHANGED
@@ -3,7 +3,7 @@ import { EXTENSION_ID } from "@modelcontextprotocol/ext-apps/server";
3
3
  import { currentCodesysSim } from "./codesys/simulation.js";
4
4
  import { registerTools, revertObject, versionLine } from "./tools.js";
5
5
  import { registerPanel } from "./panel.js";
6
- export const VERSION = "2.1.0";
6
+ export const VERSION = "2.1.2";
7
7
  const INSTRUCTIONS = `CODESYS V3.5 automation through a persistent CODESYS session.
8
8
  Everything goes through the one tool named codesys, as {"action": "<name>", "args": {...}}. The names below are its actions; {"action": "help"} lists them all with their arguments.
9
9
  Use batch whenever you know the next steps: it sends several actions in one call and is much faster than separate calls. For example, all the create_object and write_object calls of a step followed by compile, or codesys_sim_force, wait, codesys_sim_cycle and codesys_sim_read for one test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesys/mcp-toolkit",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "MCP server for CODESYS V3.5: read, write, compile and simulate Structured Text through a persistent CODESYS session",
5
5
  "mcpName": "io.github.johannesPettersson80/codesys-mcp-toolkit",
6
6
  "type": "module",