@codesys/mcp-toolkit 1.5.7 → 1.5.8
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 +6 -0
- package/codesys-mcp-toolkit-1.5.8.tgz +0 -0
- package/dist/server.js +34 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.8] - 2025-05-02
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fixed null reference error when accessing sessionManager.getState() with --no-session flag
|
|
11
|
+
- Added proper null checks for session manager in session_status, start_session, and stop_session tools
|
|
12
|
+
- Improved error messages when trying to use session management tools with --no-session flag
|
|
13
|
+
|
|
8
14
|
## [1.5.7] - 2025-05-02
|
|
9
15
|
### Fixed
|
|
10
16
|
- Added safety timeout to session scripts to prevent CODESYS UI hanging
|
|
Binary file
|
package/dist/server.js
CHANGED
|
@@ -177,7 +177,7 @@ function startMcpServer(config) {
|
|
|
177
177
|
console.error("SERVER.TS: Initializing McpServer...");
|
|
178
178
|
const server = new mcp_js_1.McpServer({
|
|
179
179
|
name: "CODESYS Control MCP Server",
|
|
180
|
-
version: "1.8.
|
|
180
|
+
version: "1.8.3", // Updated version with null reference fixes for session management
|
|
181
181
|
capabilities: {
|
|
182
182
|
resources: { listChanged: true },
|
|
183
183
|
tools: { listChanged: true }
|
|
@@ -800,6 +800,17 @@ function startMcpServer(config) {
|
|
|
800
800
|
// --- Session Management Tools ---
|
|
801
801
|
server.tool("start_session", "Starts a persistent CODESYS session for improved performance with multiple operations", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
802
802
|
console.error("Tool call: start_session");
|
|
803
|
+
// First check if session manager is defined
|
|
804
|
+
if (!sessionManager) {
|
|
805
|
+
console.error("Tool call: start_session - session manager is not defined");
|
|
806
|
+
return {
|
|
807
|
+
content: [{
|
|
808
|
+
type: "text",
|
|
809
|
+
text: "Session management is disabled. Use the toolkit without the --no-session flag to enable session management."
|
|
810
|
+
}],
|
|
811
|
+
isError: true
|
|
812
|
+
};
|
|
813
|
+
}
|
|
803
814
|
try {
|
|
804
815
|
const currentState = sessionManager.getState();
|
|
805
816
|
if (currentState === sessionManager_1.SessionState.RUNNING || currentState === sessionManager_1.SessionState.BUSY) {
|
|
@@ -842,6 +853,17 @@ function startMcpServer(config) {
|
|
|
842
853
|
}));
|
|
843
854
|
server.tool("stop_session", "Stops the persistent CODESYS session", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
844
855
|
console.error("Tool call: stop_session");
|
|
856
|
+
// First check if session manager is defined
|
|
857
|
+
if (!sessionManager) {
|
|
858
|
+
console.error("Tool call: stop_session - session manager is not defined");
|
|
859
|
+
return {
|
|
860
|
+
content: [{
|
|
861
|
+
type: "text",
|
|
862
|
+
text: "Session management is disabled. No active session to stop."
|
|
863
|
+
}],
|
|
864
|
+
isError: false // Not an error, as there's no session to stop
|
|
865
|
+
};
|
|
866
|
+
}
|
|
845
867
|
try {
|
|
846
868
|
const currentState = sessionManager.getState();
|
|
847
869
|
if (currentState === sessionManager_1.SessionState.STOPPED) {
|
|
@@ -884,6 +906,17 @@ function startMcpServer(config) {
|
|
|
884
906
|
}));
|
|
885
907
|
server.tool("session_status", "Returns the status of the CODESYS session", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
886
908
|
console.error("Tool call: session_status");
|
|
909
|
+
// First check if session manager is defined
|
|
910
|
+
if (!sessionManager) {
|
|
911
|
+
console.error("Tool call: session_status - session manager is not defined");
|
|
912
|
+
return {
|
|
913
|
+
content: [{
|
|
914
|
+
type: "text",
|
|
915
|
+
text: "Session management is disabled. Status: DISABLED"
|
|
916
|
+
}],
|
|
917
|
+
isError: false
|
|
918
|
+
};
|
|
919
|
+
}
|
|
887
920
|
try {
|
|
888
921
|
const state = sessionManager.getState();
|
|
889
922
|
return {
|