codesysultra 1.0.2 → 1.0.4

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.
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "codesys_local": {
4
+ "command": "codesysultra",
5
+ "args": [
6
+ "--codesys-path",
7
+ "E:\\Soft\\Codesys\\CODESYS\\Common\\CODESYS.exe",
8
+ "--codesys-profile",
9
+ "CODESYS V3.5 SP21 Patch 4"
10
+ ]
11
+ }
12
+ }
13
+ }
package/dist/bin.js CHANGED
@@ -63,29 +63,18 @@ catch (e) {
63
63
  commander_1.program
64
64
  .name('codesysultra') // Set the command name users will see
65
65
  .description('Model Context Protocol (MCP) server for CODESYS automation platform')
66
- .version(version);
67
- // 添加配置生成命令
68
- commander_1.program.command('config')
69
- .description('Generate configuration from CODESYS version info file')
70
- .option('-c, --codesys-path <path>', 'Path to CODESYS executable')
71
- .option('-v, --version-info <path>', 'Path to CODESYS version info file')
72
- .option('-o, --output <path>', 'Output configuration file path (optional, prints to console if not specified)')
73
- .action((options) => {
74
- generateConfig(options);
75
- });
76
- // 主命令选项
77
- commander_1.program.option('-p, --codesys-path <path>', 'Path to CODESYS executable (can contain spaces, use quotes if needed)', process.env.CODESYS_PATH || 'C:\\Program Files\\CODESYS 3.5.21.0\\CODESYS\\Common\\CODESYS.exe' // Default AFTER reading env var
78
- )
79
- .option('-f, --codesys-profile <profile>', // Changed alias to 'f' to avoid conflict if you add other '-p' options
80
- 'CODESYS profile name (overrides CODESYS_PROFILE env var)', process.env.CODESYS_PROFILE || 'CODESYS V3.5 SP21' // Default AFTER reading env var
81
- )
82
- // Add workspace option if needed, defaults to cwd
83
- .option('-w, --workspace <dir>', 'Workspace directory for relative project paths', process.cwd() // Default to current working directory
84
- )
85
- .parse(process.argv); // Parse the arguments
66
+ .version(version)
67
+ .option('-p, --codesys-path <path>', 'Path to CODESYS executable (can contain spaces, use quotes if needed)', process.env.CODESYS_PATH || 'C:\\Program Files\\CODESYS 3.5.21.0\\CODESYS\\Common\\CODESYS.exe')
68
+ .option('-f, --codesys-profile <profile>', 'CODESYS profile name (overrides CODESYS_PROFILE env var)', process.env.CODESYS_PROFILE || 'CODESYS V3.5 SP21')
69
+ .option('-w, --workspace <dir>', 'Workspace directory for relative project paths', process.cwd())
70
+ .option('-g, --generate-config', 'Generate configuration file from CODESYS version info (use with -c and -v)')
71
+ .option('-v, --version-info <path>', 'Path to CODESYS version info file (for config generation)')
72
+ .option('-o, --output <path>', 'Output configuration file path (for config generation)');
73
+ commander_1.program.parse(process.argv); // Parse the arguments
86
74
  const options = commander_1.program.opts();
87
- // 如果执行的是config命令,不继续执行服务器启动
88
- if (process.argv[2] === 'config') {
75
+ // 如果是生成配置模式
76
+ if (options.generateConfig) {
77
+ generateConfig(options);
89
78
  process.exit(0);
90
79
  }
91
80
  // --- Log options Commander parsed ---
@@ -127,7 +116,7 @@ function generateConfig(options) {
127
116
  process.exit(1);
128
117
  }
129
118
  if (!options.codesysPath) {
130
- console.error('Error: CODESYS path is required. Use -c or --codesys-path option.');
119
+ console.error('Error: CODESYS path is required. Use -p or --codesys-path option.');
131
120
  process.exit(1);
132
121
  }
133
122
  const versionInfoPath = path.resolve(options.versionInfo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codesysultra",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Model Context Protocol (MCP) server for CODESYS automation platform",
5
5
  "main": "dist/server.js",
6
6
  "bin": {
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "codesys_local": {
4
+ "command": "codesysultra",
5
+ "args": [
6
+ "--codesys-path",
7
+ "E:\\Soft\\Codesys\\CODESYS\\Common\\CODESYS.exe",
8
+ "--codesys-profile",
9
+ "CODESYS V3.5 SP21 Patch 4"
10
+ ]
11
+ }
12
+ }
13
+ }