0
0
Fork 0
Codesys-MCP-SP21-plus/package.json
Karstein Phobic Nyvold Kvistad 3e9f4b8403 fix(add_library): refuse hollow placeholder when library not installed in repo
The pre-resolve via library_manager.find_library() at line 218 already
detected when the requested name was not present in the installed
library repository -- it logged "Pre-resolve... returned no hit" -- but
the script then proceeded to call add_placeholder(LIBRARY_NAME) without
a managed-lib argument anyway. CODESYS happily creates such a reference
with is_placeholder=False, so the post-add _is_resolved() guard returns
True and the project gets saved with a hollow reference. The next time
the project is opened, the IDE pops:

    Library Manager: Error: Could not open library 'X'.
    (Reason: The placeholder library 'X' could not be resolved.)

...and compile fails until the user manually deletes the bad reference
from the Library Manager.

Karstein hit this on 2026-04-28 trying to add "OPC UA Pub Sub" (the
real library is "OPC UA PubSub SL", an add-on SL package not present
in the stock V3.5 SP22 install). The script returned SCRIPT_SUCCESS,
list_project_libraries showed it as `[managed]`, and only on the next
set_pou_code call did the broken-placeholder error surface.

Fix: when _resolve_in_repo returns None, hard-refuse upfront with a
clear error pointing at the Library Repository / CODESYS Installer.
Opt-in via ALLOW_UNRESOLVED=1 (mapped to the new MCP arg
`allowUnresolved: true`) for the rare case where a placeholder for a
not-yet-installed library is genuinely wanted.

Tool description and arg docs updated to mark allowUnresolved as
DANGEROUS so future agent calls don't reach for it casually.

Bumped 0.6.0 -> 0.6.1.
2026-04-28 23:05:32 +02:00

54 lines
1.6 KiB
JSON

{
"name": "codesys-mcp-sp21-plus",
"version": "0.6.1",
"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"
}
}