@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 +194 -160
- package/LICENSE +21 -21
- package/README.md +293 -269
- package/dist/bridge/bridge.d.ts +12 -0
- package/dist/bridge/bridge.js +126 -3
- package/dist/bridge/bridge.js.map +1 -1
- package/dist/cli.js +20 -4
- package/dist/cli.js.map +1 -1
- package/dist/codesys/devices.d.ts +2 -0
- package/dist/codesys/devices.js +5 -1
- package/dist/codesys/devices.js.map +1 -1
- package/dist/codesys/install.js +3 -2
- package/dist/codesys/install.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +10 -10
- package/dist/tools.d.ts +2 -0
- package/dist/tools.js +38 -7
- package/dist/tools.js.map +1 -1
- package/package.json +67 -67
- package/watcher/mcp_compat.py +175 -147
- package/watcher/mcp_ops.py +6 -0
- package/watcher/mcp_sim.py +8 -0
- package/watcher/watcher.py +326 -255
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.
|
|
9
|
-
|
|
10
|
-
###
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
- `
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
`
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
###
|
|
145
|
-
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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.
|