@etm-professional-control/winccoa-mcp-server 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -26,10 +26,18 @@ npm install file:C:/Siemens/Automation/WinCC_OA/3.20/javascript/winccoa-manager
26
26
 
27
27
  ### 2. Configure
28
28
 
29
+ Create configuration file from template:
30
+
31
+ **Windows:**
32
+ ```cmd
33
+ copy .env.example .env
34
+ notepad .env
35
+ ```
36
+
37
+ **Linux/macOS:**
29
38
  ```bash
30
- # Copy and edit configuration
31
39
  cp .env.example .env
32
- notepad .env # Windows
40
+ nano .env # or use your preferred editor
33
41
  ```
34
42
 
35
43
  **Minimal .env setup:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etm-professional-control/winccoa-mcp-server",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP Server for WinCC OA with field-specific configurations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,6 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "./build.sh",
12
- "postinstall": "node postinstall.cjs",
13
12
  "inspect": "npx @modelcontextprotocol/inspector",
14
13
  "start": "node build/index_stdio.js",
15
14
  "start:http": "node build/index_http.js",
@@ -62,6 +61,7 @@
62
61
  "src/fields",
63
62
  "config",
64
63
  "README.md",
65
- ".env.example"
64
+ ".env.example",
65
+ "postinstall.cjs"
66
66
  ]
67
67
  }
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ // Get package info dynamically
7
+ const packageJson = require('./package.json');
8
+ const packageName = packageJson.name;
9
+
10
+ // Determine the installation directory (where npm install was run)
11
+ const installDir = process.env.INIT_CWD || process.cwd();
12
+ const nodeModulesPath = path.join(installDir, 'node_modules', packageName);
13
+
14
+ console.log(`Installing WinCC OA MCP Server files to: ${installDir}`);
15
+ console.log(`Package location: ${nodeModulesPath}`);
16
+
17
+ try {
18
+ // Copy build files to installation directory
19
+ const buildDir = path.join(nodeModulesPath, 'build');
20
+
21
+ if (fs.existsSync(buildDir)) {
22
+ // Copy all files from build directory
23
+ const files = fs.readdirSync(buildDir, { withFileTypes: true });
24
+
25
+ for (const file of files) {
26
+ const srcPath = path.join(buildDir, file.name);
27
+ const destPath = path.join(installDir, file.name);
28
+
29
+ if (file.isDirectory()) {
30
+ // Copy directory recursively
31
+ fs.cpSync(srcPath, destPath, { recursive: true });
32
+ console.log(`Copied directory: ${file.name}`);
33
+ } else {
34
+ // Copy file
35
+ fs.copyFileSync(srcPath, destPath);
36
+ console.log(`Copied file: ${file.name}`);
37
+ }
38
+ }
39
+
40
+ // Copy .env.example
41
+ const envExampleSrc = path.join(nodeModulesPath, '.env.example');
42
+ const envExampleDest = path.join(installDir, '.env.example');
43
+
44
+ if (fs.existsSync(envExampleSrc)) {
45
+ fs.copyFileSync(envExampleSrc, envExampleDest);
46
+ console.log('Copied .env.example');
47
+ }
48
+
49
+ console.log('\n✅ Installation complete!');
50
+ console.log('\nNext steps:');
51
+ console.log('1. Copy the environment file: cp .env.example .env');
52
+ console.log('2. Edit .env with your configuration');
53
+ console.log('3. Add JavaScript Manager in WinCC OA with script path: index_http.js');
54
+
55
+ } else {
56
+ console.error('Build directory not found in package');
57
+ process.exit(1);
58
+ }
59
+
60
+ } catch (error) {
61
+ console.error('Error during postinstall:', error.message);
62
+ process.exit(1);
63
+ }