@codesys/mcp-toolkit 1.1.13 → 1.1.14

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 CHANGED
@@ -5,6 +5,13 @@ 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.1.14] - 2025-05-06
9
+
10
+ ### Fixed
11
+ - Fixed path handling for CODESYS objects to correctly handle dot and slash separators
12
+ - Added automatic detection of common CODESYS structure paths like "PLCWinNT/Plc Logic/Application"
13
+ - Improved object path traversal in find_object_by_path function
14
+
8
15
  ## [1.1.13] - 2025-05-06
9
16
 
10
17
  ### Fixed
@@ -43,6 +43,8 @@ try:
43
43
  PARENT_PATH_REL, # Original "Application"
44
44
  "%s.%s" % (project_name, PARENT_PATH_REL), # "projectName.Application"
45
45
  "%s/%s" % (project_name, PARENT_PATH_REL), # "projectName/Application"
46
+ "PLCWinNT/Plc Logic/Application", # Common CODESYS structure
47
+ "PLCWinNT.Plc Logic.Application", # Using dots instead
46
48
  project_name # Just the project name itself might work
47
49
  ]
48
50
 
@@ -2,7 +2,12 @@ import traceback
2
2
  # --- Find object by path function ---
3
3
  def find_object_by_path_robust(start_node, full_path, target_type_name="object"):
4
4
  print("DEBUG: Finding %s by path: '%s'" % (target_type_name, full_path))
5
- normalized_path = full_path.replace('\\\\', '/').strip('/')
5
+ # Handle both dot and slash separators
6
+ # First replace backslashes with forward slashes
7
+ path_with_slashes = full_path.replace('\\', '/').strip('/')
8
+ # Then replace dots with slashes (CODESYS sometimes uses dots)
9
+ normalized_path = path_with_slashes.replace('.', '/')
10
+ # Split into parts
6
11
  path_parts = normalized_path.split('/')
7
12
  if not path_parts:
8
13
  print("ERROR: Path is empty.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesys/mcp-toolkit",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "description": "Model Context Protocol (MCP) server for CODESYS automation platform",
5
5
  "main": "dist/server.js",
6
6
  "bin": {
@@ -43,6 +43,8 @@ try:
43
43
  PARENT_PATH_REL, # Original "Application"
44
44
  "%s.%s" % (project_name, PARENT_PATH_REL), # "projectName.Application"
45
45
  "%s/%s" % (project_name, PARENT_PATH_REL), # "projectName/Application"
46
+ "PLCWinNT/Plc Logic/Application", # Common CODESYS structure
47
+ "PLCWinNT.Plc Logic.Application", # Using dots instead
46
48
  project_name # Just the project name itself might work
47
49
  ]
48
50
 
@@ -2,7 +2,12 @@ import traceback
2
2
  # --- Find object by path function ---
3
3
  def find_object_by_path_robust(start_node, full_path, target_type_name="object"):
4
4
  print("DEBUG: Finding %s by path: '%s'" % (target_type_name, full_path))
5
- normalized_path = full_path.replace('\\\\', '/').strip('/')
5
+ # Handle both dot and slash separators
6
+ # First replace backslashes with forward slashes
7
+ path_with_slashes = full_path.replace('\\', '/').strip('/')
8
+ # Then replace dots with slashes (CODESYS sometimes uses dots)
9
+ normalized_path = path_with_slashes.replace('.', '/')
10
+ # Split into parts
6
11
  path_parts = normalized_path.split('/')
7
12
  if not path_parts:
8
13
  print("ERROR: Path is empty.")