WHY: an unlicensed CODESYS Control runtime drops out of demo mode every 2 hours. systemctl is-active reports "active" even after the binary has died, so a TCP probe on the runtime port (default 11740) is the only honest liveness signal. The new tool gives MCP a one-call path to bring the runtime back without dropping into a terminal. Implementation choices: - ssh2 (npm) instead of spawning ssh/sshpass: sshpass is not on the default Windows path, and the target Pi's sshd 10.x rejects pubkey signatures from this client environment in practice. ssh2 handles password auth + remote stdin + exit-code capture cross-platform. - sudo -S with the password fed on remote stdin -- avoids a NOPASSWD sudoers entry on the PLC. - After issuing the restart, polls 'ss -tln | grep :<port>' once per second until the listen port is up or livenessWaitSeconds expires. This is what catches a half-dead runtime that systemctl reports as fine. Defaults match the only Pi we currently target (codesys-pi.local / karstein / codesys123 / codesyscontrol / port 11740) but every field is overridable. Smoke-tested against codesys-pi.local: restart exit 0, port back up after ~3s.
54 lines
1.6 KiB
JSON
54 lines
1.6 KiB
JSON
{
|
|
"name": "codesys-mcp-sp21-plus",
|
|
"version": "0.5.0",
|
|
"description": "Codesys-MCP-SP21+ -- fork of luke-harriman/Codesys-MCP carrying CODESYS V3.5 SP22 Patch 1 fixes (and forward-compat with later SPs): script-engine API drift, online/runtime tool auto-login, dual-SHA release classifier, set_pou_code omitted-decl wipe fix, add_library managed-overload, etc. MCP server for CODESYS with persistent UI instance and file-based IPC.",
|
|
"main": "dist/server.js",
|
|
"bin": {
|
|
"codesys-mcp-sp21-plus": "dist/bin.js"
|
|
},
|
|
"files": [
|
|
"dist/",
|
|
"README.md",
|
|
"LICENSE"
|
|
],
|
|
"scripts": {
|
|
"build": "tsc && node -e \"require('fs').cpSync('src/scripts','dist/scripts',{recursive:true})\"",
|
|
"test": "vitest --run",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc --noEmit",
|
|
"prepublishOnly": "npm run build && npm test"
|
|
},
|
|
"keywords": [
|
|
"codesys",
|
|
"mcp",
|
|
"plc",
|
|
"automation",
|
|
"persistent",
|
|
"ui"
|
|
],
|
|
"author": "luke-harriman (upstream); phobicdotno (SP21+ fork)",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/phobicdotno/Codesys-MCP-SP21-plus.git"
|
|
},
|
|
"homepage": "https://github.com/phobicdotno/Codesys-MCP-SP21-plus#readme",
|
|
"license": "MIT",
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"dependencies": {
|
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
"commander": "^11.1.0",
|
|
"ssh2": "^1.17.0",
|
|
"uuid": "^9.0.0",
|
|
"zod": "^3.24.3"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^20.14.1",
|
|
"@types/ssh2": "^1.15.5",
|
|
"@types/uuid": "^9.0.0",
|
|
"tsx": "^4.21.0",
|
|
"typescript": "^5.5.3",
|
|
"vitest": "^1.6.0"
|
|
}
|
|
}
|