@codesys/mcp-toolkit 1.5.7 → 2.0.0-alpha.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/CHANGELOG.md +153 -183
- package/LICENSE +21 -21
- package/README.md +224 -107
- package/dist/actions.d.ts +28 -0
- package/dist/actions.js +98 -0
- package/dist/actions.js.map +1 -0
- package/dist/bridge/bridge.d.ts +105 -0
- package/dist/bridge/bridge.js +400 -0
- package/dist/bridge/bridge.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +196 -0
- package/dist/cli.js.map +1 -0
- package/dist/codesys/cache.d.ts +48 -0
- package/dist/codesys/cache.js +82 -0
- package/dist/codesys/cache.js.map +1 -0
- package/dist/codesys/changes.d.ts +57 -0
- package/dist/codesys/changes.js +133 -0
- package/dist/codesys/changes.js.map +1 -0
- package/dist/codesys/decl.d.ts +45 -0
- package/dist/codesys/decl.js +251 -0
- package/dist/codesys/decl.js.map +1 -0
- package/dist/codesys/devices.d.ts +34 -0
- package/dist/codesys/devices.js +82 -0
- package/dist/codesys/devices.js.map +1 -0
- package/dist/codesys/diff.d.ts +13 -0
- package/dist/codesys/diff.js +61 -0
- package/dist/codesys/diff.js.map +1 -0
- package/dist/codesys/install.d.ts +40 -0
- package/dist/codesys/install.js +144 -0
- package/dist/codesys/install.js.map +1 -0
- package/dist/codesys/library-browse.d.ts +19 -0
- package/dist/codesys/library-browse.js +57 -0
- package/dist/codesys/library-browse.js.map +1 -0
- package/dist/codesys/outline.d.ts +32 -0
- package/dist/codesys/outline.js +219 -0
- package/dist/codesys/outline.js.map +1 -0
- package/dist/codesys/simulation.d.ts +34 -0
- package/dist/codesys/simulation.js +57 -0
- package/dist/codesys/simulation.js.map +1 -0
- package/dist/codesys/st.d.ts +36 -0
- package/dist/codesys/st.js +69 -0
- package/dist/codesys/st.js.map +1 -0
- package/dist/daemon.d.ts +46 -0
- package/dist/daemon.js +173 -0
- package/dist/daemon.js.map +1 -0
- package/dist/driver.d.ts +25 -0
- package/dist/driver.js +33 -0
- package/dist/driver.js.map +1 -0
- package/dist/panel/sim-panel.html +357 -0
- package/dist/panel/viewer.html +126 -0
- package/dist/panel-types.d.ts +20 -0
- package/dist/panel-types.js +3 -0
- package/dist/panel-types.js.map +1 -0
- package/dist/panel.d.ts +27 -0
- package/dist/panel.js +208 -0
- package/dist/panel.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +33 -941
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +103 -0
- package/dist/tools.js +793 -0
- package/dist/tools.js.map +1 -0
- package/dist/viewer.d.ts +14 -0
- package/dist/viewer.js +125 -0
- package/dist/viewer.js.map +1 -0
- package/package.json +37 -21
- package/watcher/mcp_compat.py +147 -0
- package/watcher/mcp_ops.py +1178 -0
- package/watcher/mcp_sim.py +246 -0
- package/watcher/watcher.py +255 -0
- package/.claude/settings.local.json +0 -29
- package/CLAUDE.md +0 -26
- package/CONTRIBUTING.md +0 -72
- package/README.md.enhanced +0 -155
- package/codesys-mcp-toolkit-1.2.0.tgz +0 -0
- package/codesys-mcp-toolkit-1.2.1.tgz +0 -0
- package/codesys-mcp-toolkit-1.5.7.tgz +0 -0
- package/dist/bin.js +0 -75
- package/dist/check_session_paths.js +0 -149
- package/dist/codesys_interop.js +0 -435
- package/dist/direct_session_command.js +0 -293
- package/dist/scriptLoader.js +0 -165
- package/dist/scripts/check_status.py +0 -21
- package/dist/scripts/compile_project.py +0 -65
- package/dist/scripts/create_method.py +0 -80
- package/dist/scripts/create_pou.py +0 -102
- package/dist/scripts/create_project.py +0 -116
- package/dist/scripts/create_property.py +0 -78
- package/dist/scripts/ensure_project_open.py +0 -154
- package/dist/scripts/find_object_by_path.py +0 -111
- package/dist/scripts/get_pou_code.py +0 -91
- package/dist/scripts/get_project_structure.py +0 -72
- package/dist/scripts/open_project.py +0 -25
- package/dist/scripts/save_project.py +0 -29
- package/dist/scripts/session_status.py +0 -281
- package/dist/scripts/set_pou_code.py +0 -109
- package/dist/scripts/start_session.py +0 -809
- package/dist/scripts/stop_session.py +0 -324
- package/dist/sessionManager.js +0 -798
- package/docs/configuration.md +0 -141
- package/docs/index.md +0 -26
- package/docs/installation.md +0 -84
- package/docs/session_management.md +0 -110
- package/examples/README.md +0 -78
- package/examples/sample_config.json +0 -32
- package/replacements_session_status.txt +0 -16
- package/scriptDoc.txt +0 -8679
- package/scripts/build.js +0 -25
- package/scripts/fix_fstrings.py +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,MAAM,YAAY,GAAG;;;;;;;;;yQASoP,CAAC;AAE1Q,MAAM,UAAU,YAAY,CAAC,GAAe;IAC1C,wFAAwF;IACxF,yEAAyE;IACzE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtK,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,aAAa,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI;QAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC;QAC7G,UAAU,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACxC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;QACjD,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;KACzB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import { type CodesysBridge } from "./bridge/bridge.js";
|
|
3
|
+
import { type ChangeStore } from "./codesys/changes.js";
|
|
4
|
+
import type { ProjectCache } from "./codesys/cache.js";
|
|
5
|
+
import { type CodesysSimState } from "./codesys/simulation.js";
|
|
6
|
+
import { type Driver } from "./driver.js";
|
|
7
|
+
export interface AppContext {
|
|
8
|
+
bridge: CodesysBridge;
|
|
9
|
+
/** Save the project after every change (default true, like v1). */
|
|
10
|
+
autosave: boolean;
|
|
11
|
+
/** Base folder for relative project paths. */
|
|
12
|
+
workspace: string;
|
|
13
|
+
/** CODESYS Templates folder (holds Standard.project). */
|
|
14
|
+
templatesDir?: string;
|
|
15
|
+
/** Description of the CODESYS in use, for status. */
|
|
16
|
+
codesys?: {
|
|
17
|
+
exe: string;
|
|
18
|
+
profile: string;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
/** How long a tool call waits for CODESYS to finish starting. */
|
|
22
|
+
startWaitMs: number;
|
|
23
|
+
/** Last project opened through these tools (status never queries CODESYS). */
|
|
24
|
+
project?: ProjectInfo;
|
|
25
|
+
/** CODESYS's own simulation, while it runs. */
|
|
26
|
+
codesysSim?: CodesysSimState;
|
|
27
|
+
/** Checkpoints and change tracking (absent when disabled). */
|
|
28
|
+
changes?: ChangeStore;
|
|
29
|
+
/** What the server knows about the open project, for the workspace panel. */
|
|
30
|
+
cache?: ProjectCache;
|
|
31
|
+
/** Whether the user has paused Claude in the panel. */
|
|
32
|
+
driver?: Driver;
|
|
33
|
+
/** The browser viewer (the panel in a normal browser window). */
|
|
34
|
+
viewer?: {
|
|
35
|
+
url: string;
|
|
36
|
+
open(force?: boolean): boolean;
|
|
37
|
+
};
|
|
38
|
+
/** The server log. */
|
|
39
|
+
log?: (message: string) => void;
|
|
40
|
+
}
|
|
41
|
+
/** What project.open / project.info report about the open project. */
|
|
42
|
+
export interface ProjectInfo {
|
|
43
|
+
path: string;
|
|
44
|
+
application?: string;
|
|
45
|
+
reused?: boolean;
|
|
46
|
+
/** The application's compiler defines. */
|
|
47
|
+
defines?: string[];
|
|
48
|
+
/** Project-level defines (Scripting 4.2+). */
|
|
49
|
+
project_defines?: string[];
|
|
50
|
+
/** The project's compiler version (Scripting 4.2+). */
|
|
51
|
+
compiler_version?: string;
|
|
52
|
+
}
|
|
53
|
+
/** " Compiler 3.5.21.0. Defines: FAST, MODE." plus a note when CODESYS is newer than the project. */
|
|
54
|
+
export declare function describeBuildSettings(r: ProjectInfo, codesysLabel?: string): string;
|
|
55
|
+
/** Which CODESYS a session uses, for the panel: "CODESYS 3.5.22.40 · Scripting 4.2.0.0 · compiler 3.5.19.40". */
|
|
56
|
+
export declare function versionLine(codesysLabel?: string, scripting?: string, compiler?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* The useful part of CODESYS's PLCopenXML export of one object: its <pou> (or <dataType>)
|
|
59
|
+
* element, without the vendor <addData> blocks (GUID-coded attributes, layout data).
|
|
60
|
+
*/
|
|
61
|
+
export declare function compactPlcOpen(xml: string): string;
|
|
62
|
+
interface TaskInfo {
|
|
63
|
+
name: string;
|
|
64
|
+
path: string;
|
|
65
|
+
interval?: string;
|
|
66
|
+
interval_unit?: string;
|
|
67
|
+
priority?: string;
|
|
68
|
+
kind?: string;
|
|
69
|
+
event?: string | null;
|
|
70
|
+
core_binding?: number | null;
|
|
71
|
+
watchdog?: {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
time?: string;
|
|
74
|
+
time_unit?: string;
|
|
75
|
+
sensitivity?: string;
|
|
76
|
+
} | null;
|
|
77
|
+
pous: string[];
|
|
78
|
+
}
|
|
79
|
+
/** One line per task, as list_tasks and configure_task show it. */
|
|
80
|
+
export declare function describeTask(t: TaskInfo): string;
|
|
81
|
+
interface BuildMessage {
|
|
82
|
+
category: string;
|
|
83
|
+
severity: string;
|
|
84
|
+
text: string;
|
|
85
|
+
prefix?: string | null;
|
|
86
|
+
number?: number | null;
|
|
87
|
+
object?: string | null;
|
|
88
|
+
position?: string | null;
|
|
89
|
+
/** Length of the token the message points at (from CODESYS's message). */
|
|
90
|
+
length?: number | null;
|
|
91
|
+
}
|
|
92
|
+
export declare function formatBuild(messages: BuildMessage[]): {
|
|
93
|
+
text: string;
|
|
94
|
+
errors: number;
|
|
95
|
+
};
|
|
96
|
+
export declare function registerTools(server: McpServer, ctx: AppContext): void;
|
|
97
|
+
/**
|
|
98
|
+
* Put an object (and everything under it) back to how it was at a checkpoint:
|
|
99
|
+
* modified objects are rewritten, objects added since are deleted, removed
|
|
100
|
+
* ones are recreated. Used by revert_object and by the panel's Revert.
|
|
101
|
+
*/
|
|
102
|
+
export declare function revertObject(ctx: AppContext, path: string, name: string): Promise<string>;
|
|
103
|
+
export {};
|