@iobroker/mcp-server 1.3.0 → 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/README.md CHANGED
@@ -109,16 +109,42 @@ permissions regardless of which user authenticated. Give the Default User an ioB
109
109
  the ACLs the MCP client should have.
110
110
 
111
111
  ### Permissions
112
- - **Allow setting states**: Allow MCP clients to write state values (the `set_state` and `set_states` tools).
113
- Default: **on**. Which states can be written is decided by the ACLs of the Default User. `set_states` checks the
114
- write permission of all states first and writes nothing if one of them is not writable.
112
+ All options that change the system are **off** by default; turn on only what the MCP client really needs.
113
+
114
+ **States and objects**
115
+ - **Allow setting states**: Allow MCP clients to write state values and to acknowledge system notifications (the
116
+ `set_state`, `set_states` and `clear_notifications` tools). Default: **on**. Which states can be written is
117
+ decided by the ACLs of the Default User. `set_states` checks the write permission of all states first and writes
118
+ nothing if one of them is not writable.
115
119
  - **Mark setting states as destructive** (`setStateDestructive`): Declare `set_state` and `set_states` with
116
120
  `destructiveHint: true`, so MCP clients can warn before a state is written. Default: **on**. When off, both tools
117
121
  are declared as non-destructive writes (`readOnlyHint` stays `false`); whether a client still asks for
118
122
  confirmation then depends on the client.
119
- - **Allow object/file changes**: Allow MCP clients to create/modify/delete objects and files (the `set_object`,
120
- `delete_object`, `create_state`, `create_scene`, `write_file`, `delete_file`, `rename_file` and `mkdir`
121
- tools). Default: **off**. When off, these tools are not exposed at all.
123
+ - **Allow object/file changes** (`allowObjectChange`): Allow MCP clients to create/modify/delete objects, aliases
124
+ and files (the `set_object`, `delete_object`, `create_state`, `create_scene`, `create_alias`, `write_file`,
125
+ `delete_file`, `rename_file` and `mkdir` tools). Default: **off**.
126
+
127
+ **System**
128
+ - **Allow controlling instances** (`allowInstanceControl`): Start, stop and restart adapter instances and change
129
+ their log level (`start_instance`, `stop_instance`, `restart_instance`, `set_log_level`). Default: **off**.
130
+ - **Allow managing adapters** (`allowAdapterManagement`): Add and delete instances and upgrade adapters from the
131
+ repository (`add_instance`, `delete_instance`, `upgrade_adapter`). Default: **off**.
132
+ - **Allow changing scripts** (`allowScriptChange`): Create, change, start/stop and delete scripts of the
133
+ javascript adapter and run code once (`set_script`, `enable_script`, `delete_script`, `run_script`). Reading
134
+ scripts (`list_scripts`, `get_script`) is always possible. Scripts run with full access to ioBroker. Default:
135
+ **off**.
136
+ - **Allow messages to adapters** (`sendToAllowlist`): Adapters (`telegram`) or instances (`backitup.0`) the
137
+ `send_to` tool may send messages to, separated by commas; `*` allows all. Default: empty, then there is no
138
+ `send_to` tool.
139
+
140
+ **Safety**
141
+ - **Ask for confirmation before dangerous actions** (`confirmDangerous`): MCP clients that support
142
+ [elicitation](https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation) ask the user before an
143
+ object or instance is deleted, an instance stopped, an adapter upgraded or installed, a script saved or run, or a
144
+ message sent. Clients without elicitation rely on the `destructiveHint` of the tools and their own confirmation.
145
+ Default: **on**.
146
+
147
+ **Developers**
122
148
  - **Allow installing packages (developers only)** (`allowPackageInstall`): Offer the `install_package` tool, which
123
149
  installs an adapter package on an ioBroker host - from npm, GitHub, a URL or a `.tgz` file - exactly like
124
150
  *Install from custom URL / file* in ioBroker.admin (`iobroker url ...`). Default: **off**. This option is only
@@ -163,18 +189,36 @@ Point your MCP client at:
163
189
  | `get_logs` | Retrieve recent ioBroker log lines; optional filters by `level` (error/warn/info/debug), source `adapter` and start time (`from_ts`) |
164
190
  | `write_log` | Write a message to the ioBroker log |
165
191
  | `system_info` | Get system and js-controller information |
192
+ | `list_adapter_updates` | List installed adapters that have a newer version in the active repository |
193
+ | `list_notifications` | List the system notifications of the hosts (the bell in admin): disk space, crashed adapters, ... |
194
+ | `list_scripts` | List the scripts of the javascript adapter (without source) |
195
+ | `get_script` | Read a script including its source |
166
196
  | `ping_host` | Diagnose connectivity to a network device: ICMP ping to `host` plus an optional TCP connect to `port` — useful to investigate adapter `ETIMEDOUT`/connection errors |
167
197
  | `set_state` | Set the value of a state (value coerced to the state type) — requires *Allow setting states* |
168
198
  | `set_states` | Set multiple states in one call (for scenes/group actions like "all lights off") — requires *Allow setting states* |
199
+ | `clear_notifications` | Acknowledge system notifications, optionally of one scope/category/instance — requires *Allow setting states* |
169
200
  | `set_object` | Create/update an object (merges common/native) — requires *Allow object/file changes* |
170
201
  | `delete_object` | Delete an object, optionally with all children — requires *Allow object/file changes* |
171
202
  | `create_state` | Create a new state object with type/role/unit/min/max and optional initial value — requires *Allow object/file changes* |
172
203
  | `create_scene` | Create or update a scene for the ioBroker `scenes` adapter (state/value pairs applied together) — requires *Allow object/file changes* |
204
+ | `create_alias` | Create an alias (`alias.0.*`) pointing to a state, optionally with a separate write state — requires *Allow object/file changes* |
173
205
  | `write_file` | Write a file to an adapter file storage — requires *Allow object/file changes* |
174
206
  | `delete_file` | Delete a file from an adapter file storage — requires *Allow object/file changes* |
175
207
  | `rename_file` | Rename/move a file within the same adapter file storage — requires *Allow object/file changes* |
176
208
  | `mkdir` | Create a directory in an adapter file storage — requires *Allow object/file changes* |
177
209
  | `install_package` | Install an adapter package (npm, GitHub, URL, `.tgz` from the file storage or as base64) on a host and restart its enabled instances — requires *Allow installing packages*, developers only |
210
+ | `start_instance` | Start (enable) an instance — requires *Allow controlling instances* |
211
+ | `stop_instance` | Stop (disable) an instance — requires *Allow controlling instances* |
212
+ | `restart_instance` | Restart a running instance — requires *Allow controlling instances* |
213
+ | `set_log_level` | Change the log level of an instance, temporarily or persistently — requires *Allow controlling instances* |
214
+ | `add_instance` | Create an instance of an adapter from the repository (`iobroker add`) — requires *Allow managing adapters* |
215
+ | `delete_instance` | Delete an instance with its objects and states (`iobroker del`) — requires *Allow managing adapters* |
216
+ | `upgrade_adapter` | Upgrade an adapter to the repository or a given version (`iobroker upgrade`) — requires *Allow managing adapters* |
217
+ | `set_script` | Create a JavaScript/TypeScript script or change its source — requires *Allow changing scripts* |
218
+ | `enable_script` | Start or stop a script — requires *Allow changing scripts* |
219
+ | `delete_script` | Delete a script — requires *Allow changing scripts* |
220
+ | `run_script` | Run code once in the javascript adapter and return its log output (javascript ≥ 10.1.0) — requires *Allow changing scripts* |
221
+ | `send_to` | Send a message to an adapter instance (`sendTo`) and return the answer — only instances in *Allow messages to adapters* |
178
222
 
179
223
  All object/state access runs with the permissions of the configured **Default User**. The write tools are only
180
224
  registered when their respective permission option is enabled.
@@ -184,6 +228,14 @@ Every tool declares a JSON input schema and all four MCP behaviour hints (`readO
184
228
  for confirmation before a writing tool runs. All reading tools are `readOnlyHint: true`; `ping_host` is the only
185
229
  tool with `openWorldHint: true`, because it talks to hosts outside of ioBroker.
186
230
 
231
+ ### Prompts
232
+ MCP clients offer these as ready-made commands (e.g. as slash commands):
233
+
234
+ - `diagnose_adapter` (`instance`) - find out why an instance does not work: status, log, notifications,
235
+ connectivity and available updates.
236
+ - `room_overview` (`room`) - summary of the devices of a room and anything unusual.
237
+ - `create_automation` (`description`) - turn a description into a script for the javascript adapter.
238
+
187
239
  ### Resources & live updates (SSE)
188
240
 
189
241
  States and objects are also exposed as MCP **resources** using the canonical ioBroker URI scheme, so clients
@@ -233,6 +285,11 @@ client calls it and its result is verified:
233
285
  Placeholder for the next version (at the beginning of the line):
234
286
  ### **WORK IN PROGRESS**
235
287
  -->
288
+ ### 1.4.0 (2026-10-23)
289
+ * (@GermanBluefox) Added tools to control instances, manage adapters, read/change/run scripts, read and acknowledge notifications, create aliases and send messages to adapters, each behind its own option (off by default)
290
+ * (@GermanBluefox) Added the prompts `diagnose_adapter`, `room_overview` and `create_automation`
291
+ * (@GermanBluefox) Dangerous actions ask the user for a confirmation if the client supports elicitation (option `confirmDangerous`)
292
+
236
293
  ### 1.3.0 (2026-10-23)
237
294
  * (@GermanBluefox) Added the `install_package` tool (opt-in `allowPackageInstall`, only for developers): installs an adapter package from npm, GitHub, a URL or a `.tgz` file on a host
238
295
 
@@ -57,11 +57,21 @@ export interface InProcessMcpOptions {
57
57
  setStateDestructive?: boolean;
58
58
  /** Allow the object/file-changing tools (`create_state`, `set_object`, ...) (default: false). */
59
59
  allowObjectChange?: boolean;
60
+ /** Allow starting/stopping/restarting instances and changing their log level (default: false). */
61
+ allowInstanceControl?: boolean;
62
+ /** Allow adding/deleting instances and upgrading adapters from the repository (default: false). */
63
+ allowAdapterManagement?: boolean;
60
64
  /**
61
65
  * Allow the `install_package` tool, which installs adapter packages on a host (default: false).
62
66
  * Only relevant for adapter developers.
63
67
  */
64
68
  allowPackageInstall?: boolean;
69
+ /** Allow creating/changing/deleting/running scripts of the javascript adapter (default: false). */
70
+ allowScriptChange?: boolean;
71
+ /** Adapters or instances `send_to` may address, comma separated, `*` for all (default: none, no tool). */
72
+ sendToAllowlist?: string;
73
+ /** Ask the user before dangerous actions if the client supports elicitation (default: true). */
74
+ confirmDangerous?: boolean;
65
75
  /** Name reported to the server by the embedded client. */
66
76
  clientName?: string;
67
77
  /** Version reported to the server by the embedded client. */
@@ -23,21 +23,14 @@ const index_1 = __importDefault(require("./index"));
23
23
  * @returns a facade to list/call tools and to tear the connection down again
24
24
  */
25
25
  async function createInProcessMcp(options) {
26
- const mcp = index_1.default.createEmbedded({
27
- adapter: options.adapter,
28
- defaultUser: options.defaultUser,
29
- language: options.language,
30
- allowSetState: options.allowSetState,
31
- allowObjectChange: options.allowObjectChange,
32
- setStateDestructive: options.setStateDestructive,
33
- allowPackageInstall: options.allowPackageInstall,
34
- });
26
+ const { clientName, clientVersion, ...embedOptions } = options;
27
+ const mcp = index_1.default.createEmbedded(embedOptions);
35
28
  const server = mcp.createInProcessServer();
36
29
  const [clientTransport, serverTransport] = inMemory_js_1.InMemoryTransport.createLinkedPair();
37
30
  await server.connect(serverTransport);
38
31
  const client = new index_js_1.Client({
39
- name: options.clientName || 'iobroker-inprocess-client',
40
- version: options.clientVersion || '1.0.0',
32
+ name: clientName || 'iobroker-inprocess-client',
33
+ version: clientVersion || '1.0.0',
41
34
  }, { capabilities: {} });
42
35
  await client.connect(clientTransport);
43
36
  return {
@@ -1 +1 @@
1
- {"version":3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AM,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;YACnE,MAAM,MAAM,GAAI,GAAG,CAAC,OAA0C,IAAI,EAAE,CAAC;YACrE,MAAM,IAAI,GAAG,MAAM;iBACd,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;iBACxE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAc,CAAC;iBAClC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,KAAK;YACP,IAAI,CAAC;gBACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC;YAAC,MAAM,CAAC;gBACL,SAAS;YACb,CAAC;YACD,IAAI,CAAC;gBACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACzB,CAAC;YAAC,MAAM,CAAC;gBACL,SAAS;YACb,CAAC;YACD,GAAG,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Server as HttpServer } from 'node:http';
2
2
  import type { Server as HttpsServer } from 'node:https';
3
3
  import { type Express } from 'express';
4
4
  import { McpServer as McpSdkServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { type McpPermissions } from './types';
5
6
  import { createInProcessMcp } from './inProcessClient';
6
7
  export default class McpServer {
7
8
  private readonly adapter;
@@ -46,15 +47,7 @@ export default class McpServer {
46
47
  defaultUser?: string;
47
48
  auth?: boolean;
48
49
  language?: ioBroker.Languages;
49
- /** Explicit override for the `set_state`/`set_states` permission (embedded mode). */
50
- allowSetState?: boolean;
51
- /** Explicit override for the destructive hint of `set_state`/`set_states` (embedded mode). */
52
- setStateDestructive?: boolean;
53
- /** Explicit override for the object/file-changing tool permission (embedded mode). */
54
- allowObjectChange?: boolean;
55
- /** Explicit override for the package installation permission (embedded mode). */
56
- allowPackageInstall?: boolean;
57
- }, adapter: ioBroker.Adapter, instanceSettings: ioBroker.InstanceObject | null, app?: Express);
50
+ } & Partial<McpPermissions>, adapter: ioBroker.Adapter, instanceSettings: ioBroker.InstanceObject | null, app?: Express);
58
51
  /**
59
52
  * Build a fresh MCP SDK server with all ioBroker tools registered, ready to be connected to an
60
53
  * arbitrary transport. Used for in-process embedding (e.g. by ioBroker.admin) over an
@@ -71,20 +64,12 @@ export default class McpServer {
71
64
  * @param options.adapter The host adapter into which the MCP server is embedded. Used for receiving state/object changes and logs, and for performing actions with the host adapter's permissions.
72
65
  * @param options.defaultUser Default user
73
66
  * @param options.language Language
74
- * @param options.allowSetState Allow the state-writing tools `set_state`/`set_states` (opt-out, default true)
75
- * @param options.allowObjectChange Allow the object/file-changing tools (opt-in, default false)
76
- * @param options.setStateDestructive Declare `set_state`/`set_states` as destructive (default true)
77
- * @param options.allowPackageInstall Allow the `install_package` tool (opt-in, default false, developers only)
78
67
  */
79
68
  static createEmbedded(options: {
80
69
  adapter: ioBroker.Adapter;
81
70
  defaultUser?: `system.user.${string}`;
82
71
  language?: ioBroker.Languages;
83
- allowSetState?: boolean;
84
- allowObjectChange?: boolean;
85
- setStateDestructive?: boolean;
86
- allowPackageInstall?: boolean;
87
- }): McpServer;
72
+ } & Partial<McpPermissions>): McpServer;
88
73
  private initRoutes;
89
74
  /**
90
75
  * Guard for the MCP endpoint when authentication is enabled (standalone mode). By the time this
@@ -309,6 +294,87 @@ export default class McpServer {
309
294
  * ioBroker.admin installs from a custom URL or a .tgz file, and wait for the result.
310
295
  */
311
296
  private installPackage;
297
+ /** Normalize a host name (with or without `system.host.`) and check that the host exists. */
298
+ private resolveHost;
299
+ /**
300
+ * Run an ioBroker CLI command on a host via `cmdExec` and wait for its exit code. The host reports
301
+ * the output and the exit code as messages to this instance, see {@link onMessage}.
302
+ *
303
+ * @param host host name without `system.host.`
304
+ * @param command the CLI arguments, e.g. `upgrade hue@3.9.0`
305
+ * @param timeoutSeconds how long to wait; the command keeps running on the host after that
306
+ * @param files files sent along with the command (the command refers to them by name)
307
+ */
308
+ private runHostCommand;
309
+ /** Request something from a host (`getNotifications`, ...) and wait for the answer. */
310
+ private hostRequest;
311
+ /** Like admin after an installation: touching the instance objects makes the controller restart them. */
312
+ private restartAdapterInstances;
313
+ /** Read an instance object by its short id (`hue.0`) or full id (`system.adapter.hue.0`). */
314
+ private getInstance;
315
+ /** Start (enable) or stop (disable) an instance. */
316
+ private setInstanceEnabled;
317
+ /** Restart a running instance. */
318
+ private restartInstance;
319
+ /**
320
+ * Change the log level of an instance: temporarily via its `logLevel` state (no restart, until the
321
+ * next start), or persistently in the instance object (restarts the instance).
322
+ */
323
+ private setLogLevel;
324
+ /** Check an adapter name, as the CLI receives it as an argument. */
325
+ private static checkAdapterName;
326
+ /** Create an instance of an adapter (installs the adapter from the repository if necessary). */
327
+ private addInstance;
328
+ /** Delete an instance with its objects and states (on the host it runs on). */
329
+ private deleteInstance;
330
+ /** Upgrade an installed adapter to the repository version (or the given one). */
331
+ private upgradeAdapter;
332
+ /** List the installed adapters that have a newer version in the active repository. */
333
+ private listAdapterUpdates;
334
+ /**
335
+ * Read the JSON of the active repositories from `system.repositories` (or of all repositories if none
336
+ * is marked active). An adapter present in several repos is kept once (first/active repo wins). This
337
+ * matters when the user has custom repos active next to the default one.
338
+ */
339
+ private getRepositoryJson;
340
+ /** Read the current notifications of one or all hosts, one entry per category and instance. */
341
+ private listNotifications;
342
+ /** Acknowledge (delete) notifications on a host, optionally only of one scope/category/instance. */
343
+ private clearNotifications;
344
+ /**
345
+ * Normalize a script id: `script.js.common.lights`, `common.lights` or `lights` (folder `common`).
346
+ * Every segment is reduced to the characters the javascript editor uses for ids.
347
+ */
348
+ private static scriptId;
349
+ /** Summary of a script object, optionally with its source. */
350
+ private scriptInfo;
351
+ /** Read a script object, failing if it is missing or not a script. */
352
+ private getScriptObject;
353
+ /** List the scripts of the javascript adapter (without their source). */
354
+ private listScripts;
355
+ /**
356
+ * Create a script or change the source of an existing one. Blockly and Rules scripts keep their
357
+ * blocks in the source, so they are not changed. New scripts start disabled unless `enabled` is given.
358
+ */
359
+ private setScript;
360
+ /** Enable (start) or disable (stop) a script. */
361
+ private enableScript;
362
+ /** Delete a script. */
363
+ private deleteScript;
364
+ /**
365
+ * Run code once in the javascript adapter (its `execute` message) and return what it logged. Nothing
366
+ * is stored; timers and subscriptions are cleaned up after `timeout`.
367
+ */
368
+ private runScript;
369
+ /** Whether `send_to` may address this instance (by adapter name, instance or `*`). */
370
+ private isSendToAllowed;
371
+ /** Send a message to an adapter instance (`sendTo`) and return its answer. */
372
+ private sendToInstance;
373
+ /**
374
+ * Create an alias (`alias.0.*`) that points to another state. Type, role, unit and limits are copied
375
+ * from the target unless given.
376
+ */
377
+ private createAlias;
312
378
  /** Resolve the member ids of a room/function enum matched by id or (localized) name. */
313
379
  private getEnumMembers;
314
380
  /** Normalize an ioBroker name (string or {en, de, ...}) to a plain string. */