@etm-professional-control/winccoa-mcp-server 1.3.1 → 1.4.0
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/.env.example +8 -1
- package/README.md +36 -5
- package/build/helpers/drivers/MqttConnection.d.ts +113 -0
- package/build/helpers/drivers/MqttConnection.d.ts.map +1 -0
- package/build/helpers/drivers/MqttConnection.js +644 -0
- package/build/helpers/drivers/MqttConnection.js.map +1 -0
- package/build/server.d.ts +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +65 -66
- package/build/server.js.map +1 -1
- package/build/tools/datapoints/dp_type_create.d.ts.map +1 -1
- package/build/tools/datapoints/dp_type_create.js +10 -8
- package/build/tools/datapoints/dp_type_create.js.map +1 -1
- package/build/tools/mqtt/mqtt_connection.d.ts +14 -0
- package/build/tools/mqtt/mqtt_connection.d.ts.map +1 -0
- package/build/tools/mqtt/mqtt_connection.js +380 -0
- package/build/tools/mqtt/mqtt_connection.js.map +1 -0
- package/build/types/drivers/connection.d.ts +36 -53
- package/build/types/drivers/connection.d.ts.map +1 -1
- package/build/types/drivers/connection.js +38 -31
- package/build/types/drivers/connection.js.map +1 -1
- package/build/types/drivers/mqtt.d.ts +253 -0
- package/build/types/drivers/mqtt.d.ts.map +1 -0
- package/build/types/drivers/mqtt.js +142 -0
- package/build/types/drivers/mqtt.js.map +1 -0
- package/build/types/drivers/opcua.d.ts +62 -0
- package/build/types/drivers/opcua.d.ts.map +1 -0
- package/build/types/drivers/opcua.js +41 -0
- package/build/types/drivers/opcua.js.map +1 -0
- package/build/types/drivers/{browse.d.ts → opcua_browse.d.ts} +1 -1
- package/build/types/drivers/opcua_browse.d.ts.map +1 -0
- package/build/types/drivers/{browse.js → opcua_browse.js} +1 -1
- package/build/types/drivers/opcua_browse.js.map +1 -0
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +6 -2
- package/build/types/index.js.map +1 -1
- package/package.json +2 -2
- package/build/types/drivers/browse.d.ts.map +0 -1
- package/build/types/drivers/browse.js.map +0 -1
package/.env.example
CHANGED
|
@@ -83,10 +83,17 @@ WINCCOA_FIELD=default
|
|
|
83
83
|
# - Datapoints: datapoints/dp_basic, datapoints/dp_create, datapoints/dp_set, datapoints/dp_types, datapoints/dp_type_create
|
|
84
84
|
# - Icons: icons/icon (for creating custom SVG icons for widget headers/footers)
|
|
85
85
|
# - OPC UA: opcua/opcua_connection, opcua/opcua_address
|
|
86
|
+
# - MQTT: mqtt/mqtt_connection
|
|
86
87
|
# - Common Config: common/common_query, common/common_set, common/common_delete
|
|
87
88
|
# - Alarms: alarms/alarm_set, alarms/alarm_delete
|
|
88
89
|
# - Archive: archive/archive_set, archive/archive_delete, archive/archive_query
|
|
89
90
|
# - Dashboards: dashboards/dashboard, dashboards/widget
|
|
90
91
|
# - PV Range: pv_range/pv_range_query, pv_range/pv_range_set, pv_range/pv_range_delete
|
|
91
92
|
# - Manager: manager/manager_list, manager/manager_add, manager/manager_remove, manager/manager_control, manager/manager_properties
|
|
92
|
-
|
|
93
|
+
|
|
94
|
+
# Default: Read-only tools only (safe starting point)
|
|
95
|
+
# Uncomment and modify for write access - see README.md for security considerations
|
|
96
|
+
TOOLS=datapoints/dp_basic,datapoints/dp_types,archive/archive_query,common/common_query,pv_range/pv_range_query,manager/manager_list
|
|
97
|
+
|
|
98
|
+
# Full feature set (includes write operations - use with caution):
|
|
99
|
+
# TOOLS=datapoints/dp_basic,datapoints/dp_create,datapoints/dp_set,datapoints/dp_types,datapoints/dp_type_create,icons/icon,opcua/opcua_connection,opcua/opcua_address,mqtt/mqtt_connection,common/common_query,common/common_set,common/common_delete,alarms/alarm_set,alarms/alarm_delete,archive/archive_set,archive/archive_delete,archive/archive_query,dashboards/dashboard,dashboards/widget,pv_range/pv_range_query,pv_range/pv_range_set,pv_range/pv_range_delete,manager/manager_list,manager/manager_control,manager/manager_add,manager/manager_remove,manager/manager_properties
|
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ This Model Context Protocol (MCP) server connects AI assistants to WinCC OA SCAD
|
|
|
25
25
|
- **Managers**: `manager/manager_control`, `manager/manager_add`, `manager/manager_remove`, `manager/manager_properties`
|
|
26
26
|
- **Dashboards**: `dashboards/dashboard`, `dashboards/widget`
|
|
27
27
|
- **OPC UA**: `opcua/opcua_connection`, `opcua/opcua_address`
|
|
28
|
+
- **MQTT**: `mqtt/mqtt_connection`
|
|
28
29
|
|
|
29
30
|
**Note**: Icon tools (`icons/icon`) create/delete SVG files but don't modify SCADA data.
|
|
30
31
|
|
|
@@ -101,16 +102,18 @@ WINCCOA_FIELD=default # or 'oil', 'transport'
|
|
|
101
102
|
|
|
102
103
|
# Configure available tools (examples - see docs/TOOLS.md for complete list)
|
|
103
104
|
# Full feature set
|
|
104
|
-
TOOLS=datapoints/dp_basic,datapoints/dp_set,opcua/opcua_connection,dashboards/dashboard,manager/manager_list
|
|
105
|
+
TOOLS=datapoints/dp_basic,datapoints/dp_set,opcua/opcua_connection,mqtt/mqtt_connection,dashboards/dashboard,manager/manager_list
|
|
106
|
+
# Default: Read-only monitoring (safe starting point)
|
|
107
|
+
TOOLS=datapoints/dp_basic,datapoints/dp_types,archive/archive_query,common/common_query,pv_range/pv_range_query,manager/manager_list
|
|
105
108
|
|
|
106
|
-
# Dashboard-focused setup
|
|
109
|
+
# Dashboard-focused setup (includes write operations)
|
|
107
110
|
# TOOLS=datapoints/dp_basic,dashboards/dashboard,dashboards/widget,icons/icon
|
|
108
111
|
|
|
109
|
-
# Manager control setup
|
|
112
|
+
# Manager control setup (includes write operations)
|
|
110
113
|
# TOOLS=manager/manager_list,manager/manager_control,manager/manager_add
|
|
111
114
|
|
|
112
|
-
#
|
|
113
|
-
# TOOLS=datapoints/dp_basic,
|
|
115
|
+
# Full feature set (includes all write operations - use with caution)
|
|
116
|
+
# TOOLS=datapoints/dp_basic,datapoints/dp_set,opcua/opcua_connection,dashboards/dashboard,manager/manager_list
|
|
114
117
|
```
|
|
115
118
|
|
|
116
119
|
### 3. Start Server
|
|
@@ -162,6 +165,33 @@ This method uses `cmd` to properly handle paths with spaces in Windows.
|
|
|
162
165
|
- On Windows: Close Claude through the task-tray menu by selecting "Exit", or end the task in Task Manager if needed
|
|
163
166
|
- On macOS/Linux: Quit Claude Desktop completely and restart
|
|
164
167
|
|
|
168
|
+
**Remote Host:** When connecting to a remote WinCC OA server (not `localhost`), you must add the `--allow-http` flag to the `mcp-remote` args. Example:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"mcpServers": {
|
|
173
|
+
"winccoa": {
|
|
174
|
+
"command": "npx",
|
|
175
|
+
"args": ["mcp-remote", "http://winccoaserver:3000/mcp", "--header", "Authorization: Bearer YOUR_TOKEN_HERE", "--allow-http"]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 5. Connect Claude Code (CLI)
|
|
182
|
+
|
|
183
|
+
If you are using [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (the CLI), you can add the MCP server directly from your terminal:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
claude mcp add --transport http winccoa http://localhost:3000/mcp --header "Authorization: Bearer your-secure-token-here"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Remote Host:** When connecting to a remote WinCC OA server (not `localhost`), add the `--allow-http` flag:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
claude mcp add --transport http winccoa http://winccoaserver:3000/mcp --header "Authorization: Bearer your-secure-token-here" --allow-http
|
|
193
|
+
```
|
|
194
|
+
|
|
165
195
|
## Documentation
|
|
166
196
|
|
|
167
197
|
- **[📦 Installation Guide](docs/INSTALLATION.md)** - Complete setup instructions
|
|
@@ -182,6 +212,7 @@ This method uses `cmd` to properly handle paths with spaces in Windows.
|
|
|
182
212
|
|
|
183
213
|
- **📊 Datapoints** - Read, write, and create datapoints and types
|
|
184
214
|
- **🔗 OPC UA** - Connect to OPC UA servers and browse address spaces
|
|
215
|
+
- **📡 MQTT** - Connect to MQTT brokers and map topics to datapoints
|
|
185
216
|
- **📈 Dashboards & Widgets** - Create and manage visualization dashboards
|
|
186
217
|
- **🚨 Alarms** - Configure alarm thresholds and notifications
|
|
187
218
|
- **📁 Archives** - Query and configure historical data storage
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MQTT Connection Manager
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to create, configure, and manage MQTT connections in WinCC OA.
|
|
5
|
+
* Based on WinCC OA _MqttConnection internal datapoint structure.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseConnection } from './BaseConnection.js';
|
|
8
|
+
import type { MqttConnectionConfig, MqttAddressParams } from '../../types/index.js';
|
|
9
|
+
import { MqttConnectionState } from '../../types/index.js';
|
|
10
|
+
export { MqttConnectionType, MqttConnectionState, MqttProtocolVersion, MqttSslVersion, MqttQoS, MqttAddressDirection, MqttTransformation, MQTT_DEFAULTS } from '../../types/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* MQTT Connection Manager Class
|
|
13
|
+
*
|
|
14
|
+
* Extends BaseConnection with MQTT-specific functionality.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MqttConnection extends BaseConnection {
|
|
17
|
+
/**
|
|
18
|
+
* Generate a unique connection name for MQTT
|
|
19
|
+
* @returns Connection name in format _MqttConnection<n>
|
|
20
|
+
*/
|
|
21
|
+
generateConnectionName(): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Get available MQTT driver numbers from Pmon
|
|
24
|
+
* Similar to CTRL paMqttCheckDrvNums()
|
|
25
|
+
* @returns Array of MQTT driver numbers, sorted ascending
|
|
26
|
+
*/
|
|
27
|
+
getMqttDriverNumbers(): Promise<number[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get all used driver numbers (MQTT, simulation, other drivers)
|
|
30
|
+
* @returns Array of used driver numbers
|
|
31
|
+
*/
|
|
32
|
+
getUsedDriverNumbers(): Promise<number[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get the lowest available MQTT driver number (avoiding sim driver conflicts)
|
|
35
|
+
* @returns Lowest available driver number for MQTT
|
|
36
|
+
*/
|
|
37
|
+
getDefaultMqttDriverNumber(): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Ensure MQTT driver with specified number is running
|
|
40
|
+
* Creates and starts the driver if it doesn't exist
|
|
41
|
+
* @param managerNumber - The driver number to ensure
|
|
42
|
+
* @returns Object with success status and optional warnings
|
|
43
|
+
*/
|
|
44
|
+
ensureMqttDriverRunning(managerNumber: number): Promise<{
|
|
45
|
+
success: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
warnings?: string[];
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Build the JSON address string for Config.Address
|
|
51
|
+
* This is the format stored in _MqttConnection.Config.Address
|
|
52
|
+
* Required keys: Username, ConnectionType, ConnectionString, Certificate, Password, Identity, PSK
|
|
53
|
+
*/
|
|
54
|
+
private buildAddressJson;
|
|
55
|
+
/**
|
|
56
|
+
* Add a new MQTT connection
|
|
57
|
+
*
|
|
58
|
+
* @param config - MQTT connection configuration
|
|
59
|
+
* @returns Object with success status, connection name, and any errors
|
|
60
|
+
*/
|
|
61
|
+
addConnection(config: MqttConnectionConfig): Promise<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
connectionName?: string;
|
|
64
|
+
error?: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Delete an MQTT connection
|
|
68
|
+
*
|
|
69
|
+
* @param connectionName - Name of the connection to delete (with or without leading _)
|
|
70
|
+
* @returns Object with success status and any errors
|
|
71
|
+
*/
|
|
72
|
+
deleteConnection(connectionName: string): Promise<{
|
|
73
|
+
success: boolean;
|
|
74
|
+
error?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get the connection state of an MQTT connection
|
|
78
|
+
*
|
|
79
|
+
* @param connectionName - Name of the connection
|
|
80
|
+
* @returns Connection state or error
|
|
81
|
+
*/
|
|
82
|
+
getConnectionState(connectionName: string): Promise<{
|
|
83
|
+
success: boolean;
|
|
84
|
+
state?: MqttConnectionState;
|
|
85
|
+
stateText?: string;
|
|
86
|
+
error?: string;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* List all MQTT connections
|
|
90
|
+
*
|
|
91
|
+
* @returns Array of connection names and their states
|
|
92
|
+
*/
|
|
93
|
+
listConnections(): Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
connections?: Array<{
|
|
96
|
+
name: string;
|
|
97
|
+
state: MqttConnectionState;
|
|
98
|
+
stateText: string;
|
|
99
|
+
connectionString?: string;
|
|
100
|
+
}>;
|
|
101
|
+
error?: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Configure address settings for a datapoint (peripheral address)
|
|
105
|
+
* Implementation of abstract method from BaseConnection
|
|
106
|
+
*
|
|
107
|
+
* @param params - MQTT address parameters
|
|
108
|
+
* @returns true on success
|
|
109
|
+
* @throws Error with detailed message on failure
|
|
110
|
+
*/
|
|
111
|
+
addAddressConfig(params: MqttAddressParams): Promise<boolean>;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=MqttConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MqttConnection.d.ts","sourceRoot":"","sources":["../../../src/helpers/drivers/MqttConnection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,mBAAmB,EAOpB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,OAAO,EACP,oBAAoB,EACpB,kBAAk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