@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.
Files changed (109) hide show
  1. package/CHANGELOG.md +153 -183
  2. package/LICENSE +21 -21
  3. package/README.md +224 -107
  4. package/dist/actions.d.ts +28 -0
  5. package/dist/actions.js +98 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/bridge/bridge.d.ts +105 -0
  8. package/dist/bridge/bridge.js +400 -0
  9. package/dist/bridge/bridge.js.map +1 -0
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.js +196 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/codesys/cache.d.ts +48 -0
  14. package/dist/codesys/cache.js +82 -0
  15. package/dist/codesys/cache.js.map +1 -0
  16. package/dist/codesys/changes.d.ts +57 -0
  17. package/dist/codesys/changes.js +133 -0
  18. package/dist/codesys/changes.js.map +1 -0
  19. package/dist/codesys/decl.d.ts +45 -0
  20. package/dist/codesys/decl.js +251 -0
  21. package/dist/codesys/decl.js.map +1 -0
  22. package/dist/codesys/devices.d.ts +34 -0
  23. package/dist/codesys/devices.js +82 -0
  24. package/dist/codesys/devices.js.map +1 -0
  25. package/dist/codesys/diff.d.ts +13 -0
  26. package/dist/codesys/diff.js +61 -0
  27. package/dist/codesys/diff.js.map +1 -0
  28. package/dist/codesys/install.d.ts +40 -0
  29. package/dist/codesys/install.js +144 -0
  30. package/dist/codesys/install.js.map +1 -0
  31. package/dist/codesys/library-browse.d.ts +19 -0
  32. package/dist/codesys/library-browse.js +57 -0
  33. package/dist/codesys/library-browse.js.map +1 -0
  34. package/dist/codesys/outline.d.ts +32 -0
  35. package/dist/codesys/outline.js +219 -0
  36. package/dist/codesys/outline.js.map +1 -0
  37. package/dist/codesys/simulation.d.ts +34 -0
  38. package/dist/codesys/simulation.js +57 -0
  39. package/dist/codesys/simulation.js.map +1 -0
  40. package/dist/codesys/st.d.ts +36 -0
  41. package/dist/codesys/st.js +69 -0
  42. package/dist/codesys/st.js.map +1 -0
  43. package/dist/daemon.d.ts +46 -0
  44. package/dist/daemon.js +173 -0
  45. package/dist/daemon.js.map +1 -0
  46. package/dist/driver.d.ts +25 -0
  47. package/dist/driver.js +33 -0
  48. package/dist/driver.js.map +1 -0
  49. package/dist/panel/sim-panel.html +357 -0
  50. package/dist/panel/viewer.html +126 -0
  51. package/dist/panel-types.d.ts +20 -0
  52. package/dist/panel-types.js +3 -0
  53. package/dist/panel-types.js.map +1 -0
  54. package/dist/panel.d.ts +27 -0
  55. package/dist/panel.js +208 -0
  56. package/dist/panel.js.map +1 -0
  57. package/dist/server.d.ts +5 -0
  58. package/dist/server.js +33 -941
  59. package/dist/server.js.map +1 -0
  60. package/dist/tools.d.ts +103 -0
  61. package/dist/tools.js +793 -0
  62. package/dist/tools.js.map +1 -0
  63. package/dist/viewer.d.ts +14 -0
  64. package/dist/viewer.js +125 -0
  65. package/dist/viewer.js.map +1 -0
  66. package/package.json +37 -21
  67. package/watcher/mcp_compat.py +147 -0
  68. package/watcher/mcp_ops.py +1178 -0
  69. package/watcher/mcp_sim.py +246 -0
  70. package/watcher/watcher.py +255 -0
  71. package/.claude/settings.local.json +0 -29
  72. package/CLAUDE.md +0 -26
  73. package/CONTRIBUTING.md +0 -72
  74. package/README.md.enhanced +0 -155
  75. package/codesys-mcp-toolkit-1.2.0.tgz +0 -0
  76. package/codesys-mcp-toolkit-1.2.1.tgz +0 -0
  77. package/codesys-mcp-toolkit-1.5.7.tgz +0 -0
  78. package/dist/bin.js +0 -75
  79. package/dist/check_session_paths.js +0 -149
  80. package/dist/codesys_interop.js +0 -435
  81. package/dist/direct_session_command.js +0 -293
  82. package/dist/scriptLoader.js +0 -165
  83. package/dist/scripts/check_status.py +0 -21
  84. package/dist/scripts/compile_project.py +0 -65
  85. package/dist/scripts/create_method.py +0 -80
  86. package/dist/scripts/create_pou.py +0 -102
  87. package/dist/scripts/create_project.py +0 -116
  88. package/dist/scripts/create_property.py +0 -78
  89. package/dist/scripts/ensure_project_open.py +0 -154
  90. package/dist/scripts/find_object_by_path.py +0 -111
  91. package/dist/scripts/get_pou_code.py +0 -91
  92. package/dist/scripts/get_project_structure.py +0 -72
  93. package/dist/scripts/open_project.py +0 -25
  94. package/dist/scripts/save_project.py +0 -29
  95. package/dist/scripts/session_status.py +0 -281
  96. package/dist/scripts/set_pou_code.py +0 -109
  97. package/dist/scripts/start_session.py +0 -809
  98. package/dist/scripts/stop_session.py +0 -324
  99. package/dist/sessionManager.js +0 -798
  100. package/docs/configuration.md +0 -141
  101. package/docs/index.md +0 -26
  102. package/docs/installation.md +0 -84
  103. package/docs/session_management.md +0 -110
  104. package/examples/README.md +0 -78
  105. package/examples/sample_config.json +0 -32
  106. package/replacements_session_status.txt +0 -16
  107. package/scriptDoc.txt +0 -8679
  108. package/scripts/build.js +0 -25
  109. 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"}
@@ -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 {};