@codesys/mcp-toolkit 2.0.1 → 2.1.1

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