Shelly Smart Home

v0.1.3
io.github.Buggy1111/shelly-mcp Checked 1 day ago Published 1 month ago

Local-first MCP server for Shelly smart-home devices (Gen1-Gen4): control, energy, automation.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

shelly_switch_set

Turn a switch/relay channel on or off (optionally auto-revert after N seconds). Returns the post-action ``ChannelState``. Audit-logged.

ParameterTypeDescription
device *string
on *boolean
channelinteger
toggle_after_s

shelly_switch_toggle

Toggle a switch/relay channel. Returns the post-action ``ChannelState``. Audit-logged.

ParameterTypeDescription
device *string
channelinteger

shelly_light_set

Set a light/dimmer/RGB(W)/CCT channel (Gen1 /color,/light ↔ Gen2 Light/RGB/RGBW/CCT.Set). Only the provided fields are changed. ``brightness`` 0-100, ``rgb`` three 0-255 values, ``temp_k`` white colour temperature. Returns the post-action ``LightState``. Audit-logged.

ParameterTypeDescription
device *string
brightness
channelinteger
on
rgb
temp_k
transition_s
white

shelly_cover_move

Move a roller/cover: ``action`` is open|close|stop, or pass ``position`` (0-100) to go to it. Returns the post-action ``CoverState``. Audit-logged.

ParameterTypeDescription
action *string
device *string
channelinteger
position

shelly_energy_live

Live power/energy per channel: power_w, voltage, current, pf, freq, totals. ``None`` where a device can't report it (e.g. Gen1 plugs have no voltage/current). Pass ``channel`` to narrow to one. Safe, read-only.

ParameterTypeDescription
device *string
channel

shelly_energy_history

Best-effort energy history: lifetime totals plus any per-minute series the device exposes in its status; notes when richer history needs a local connection. Detailed historical queries (Pro 3EM ``EMData``/CSV, Gen1 ``em_data.csv``) land with the local backends (M2) — over cloud only totals + recent by-minute are available.

ParameterTypeDescription
device *string
channel

shelly_rpc

Call any **read-only** RPC method (``*.Get*``/``*.List*``/``*.Check*``) on a device. Mutating methods are refused here — use ``shelly_rpc_write``. The method name is classified server-side; unknown methods are treated as writes and rejected.

ParameterTypeDescription
device *string
method *string
params

shelly_rpc_write

Call any **mutating** RPC method. Requires ``confirm:true``; audit-logged. Read methods are rejected (use ``shelly_rpc``). Destructive methods (factory reset, wipe-all, reset-wifi) need a second gate: ``params.i_understand_data_loss = true``.

ParameterTypeDescription
device *string
method *string
confirmboolean
params

shelly_list_methods

List the RPC methods a device supports (Gen2+ ``Shelly.ListMethods``). Returns an actionable error on Gen1/cloud where the device can't enumerate methods.

ParameterTypeDescription
device *string

shelly_kvs_list

List KVS keys (with their etags). ``match`` is a wildcard pattern (default all).

ParameterTypeDescription
device *string
matchstring

shelly_kvs_get

Get one KVS value (with its etag) by key.

ParameterTypeDescription
device *string
key *string

shelly_kvs_set

Set a KVS key to a JSON value. Audit-logged.

ParameterTypeDescription
device *string
key *string
value *

shelly_kvs_delete

Delete a KVS key. Requires ``confirm:true``. Audit-logged.

ParameterTypeDescription
device *string
key *string
confirmboolean

shelly_version

Return the shelly-mcp server version (health check).

shelly_discover

Discover Shelly devices on the LAN via mDNS, merged with the cloud account list. ``timeout_s`` is the mDNS browse window. Set ``use_cloud=false`` to skip the cloud list (LAN-only). Safe, read-only; returns lightweight identities (probe for detail).

ParameterTypeDescription
timeout_snumber
use_cloudboolean

shelly_list_devices

List every Shelly device known to this server (configured + cloud account). Safe, read-only. Returns each device's canonical identity (id, name, generation, model, online state) — the starting point before any status or control call.

shelly_get_info

Identify one device (generation, model, firmware, online state, capabilities). ``device`` is a device id or a configured name. Safe, read-only.

ParameterTypeDescription
device *string

shelly_get_status

Get a device's **normalized** live status (Gen1/Gen2/Cloud folded into one shape). Returns canonical channels/lights/covers plus the raw per-generation payload. Pass ``component`` (e.g. ``"switch:0"``) to narrow to a single component. Safe, read-only.

ParameterTypeDescription
device *string
component

shelly_list_components

List the component keys present on a device (e.g. ['switch:0', 'input:0']). Safe, read-only. Use this to discover what a specific device exposes before reading status or controlling it.

ParameterTypeDescription
device *string

shelly_get_config

Get a device's configuration, with credential fields masked as ``***`` (Gen1 ``/settings`` returns Wi-Fi/MQTT secrets in the clear — they must not reach the model). Local-first — the Shelly Cloud API can't expose config, so this returns an actionable error for cloud-only devices.

ParameterTypeDescription
device *string
component

shelly_scene_list

List defined scenes (name, description, action count). Read-only.

shelly_scene_get

Show a scene's full definition (its ordered actions). Read-only.

ParameterTypeDescription
name *string

shelly_scene_create

Define (save) a named scene from an ordered list of ``{device, method, params}``. Every method must be a non-destructive mutating method; every device must be known. Fails if the name already exists unless ``overwrite=true``. Prefer absolute ``Set`` methods over ``Toggle`` so the scene is safe to run twice (you'll get a warning otherwise).

ParameterTypeDescription
actions *array
name *string
description
overwriteboolean

shelly_scene_run

Run a named scene: attempt every action in order, report per-action results. Best-effort and sequential — a failing action does **not** abort the rest. ``status`` is ``ok`` (all succeeded), ``partial`` (some failed), or ``failed`` (none succeeded). A partial run can simply be re-run later to finish it (scenes use absolute states, so re-running is safe). Every action is audit-logged.

ParameterTypeDescription
name *string

shelly_scene_delete

Delete a named scene. Requires ``confirm:true``.

ParameterTypeDescription
name *string
confirmboolean

shelly_schedule_list

List the schedules configured on a device. Local-only (cloud can't manage schedules).

ParameterTypeDescription
device *string

shelly_schedule_create

Create a schedule: ``timespec`` + ``calls`` (1-5 × {method, params}). ``timespec``: cron ``"sec min hour day month dow"`` (e.g. ``"0 0 22 * * MON-THU"``; 5 or 7 fields also accepted), a shorthand (``@daily``), or sun-relative ``"@sunset"``, ``"@sunset+30m"``, ``"@sunrise-1h * * MON-FRI"`` (offset max ±12 h; the device needs its location set). Validates the timespec, ≤5 calls, the ≤20-per-device limit, and each call's method. Audit-logged.

ParameterTypeDescription
calls *array
device *string
timespec *string
enableboolean

shelly_schedule_update

Update fields of an existing schedule by ``id``. Audit-logged.

ParameterTypeDescription
device *string
id *integer
calls
enable
timespec

shelly_schedule_delete

Delete a schedule by ``id``. Requires ``confirm:true``. Audit-logged.

ParameterTypeDescription
device *string
id *integer
confirmboolean

shelly_script_list

List scripts on a device (id, name, enable, running). Local-only.

ParameterTypeDescription
device *string

shelly_script_get_code

Get a script's full source, reassembling the device's paginated ``GetCode``.

ParameterTypeDescription
device *string
id *integer

shelly_script_create

Create an empty script (optionally named). Returns its ``id``. Audit-logged. Use ``shelly_script_put_code`` to give it code (that step is confirm-gated).

ParameterTypeDescription
device *string
name

shelly_script_put_code

Upload code into a script (chunked). **Arbitrary code on the device** → ``confirm:true``. ``append=false`` replaces the script body; ``true`` appends. Large code is split into ≤1 KB chunks automatically. Audit-logged.

ParameterTypeDescription
code *string
device *string
id *integer
appendboolean
confirmboolean

shelly_script_start

Start a script by ``id``. Returns ``was_running``. Audit-logged.

ParameterTypeDescription
device *string
id *integer

shelly_script_stop

Stop a script by ``id``. Returns ``was_running``. Audit-logged.

ParameterTypeDescription
device *string
id *integer

shelly_script_eval

Evaluate an expression inside a running script. **Arbitrary code** → ``confirm:true``. Returns the stringified result. Audit-logged.

ParameterTypeDescription
code *string
device *string
id *integer
confirmboolean

shelly_script_delete

Delete a script by ``id``. Requires ``confirm:true``. Audit-logged.

ParameterTypeDescription
device *string
id *integer
confirmboolean

shelly_system_reboot

Reboot a device. Requires ``confirm:true``. Audit-logged.

ParameterTypeDescription
device *string
confirmboolean
delay_ms

shelly_system_update

Trigger a firmware update (``channel`` = stable|beta). Requires ``confirm:true``.

ParameterTypeDescription
device *string
channelstring
confirmboolean

shelly_system_set_auth

Enable/rotate the device login password (≥12 chars). Requires ``confirm:true``. The password is write-only — never returned, and redacted in the audit log.

ParameterTypeDescription
device *string
password *string
confirmboolean

shelly_virtual_list

List the device's virtual (dynamic) components via ``Shelly.GetComponents``.

ParameterTypeDescription
device *string

shelly_virtual_add

Add a virtual component of ``type`` (boolean/number/text/enum/button/group). Optional ``config`` and ``id`` (200-299). Returns the new component id. Audit-logged.

ParameterTypeDescription
device *string
type *string
config
id

shelly_virtual_delete

Delete a virtual component by ``key`` (``<type>:<cid>``). Requires ``confirm:true``.

ParameterTypeDescription
device *string
key *string
confirmboolean

shelly_webhook_list

List webhooks configured on a device. Local-only.

ParameterTypeDescription
device *string

shelly_webhook_create

Create a webhook: ``event`` (e.g. 'switch.on'), ``cid`` component id, ``urls`` 1-5. Optional ``condition`` (JS expression) and ``repeat_period`` (seconds; 0=always, negative=once). Audit-logged.

ParameterTypeDescription
cid *integer
device *string
event *string
urls *array
condition
enableboolean
name
repeat_period

shelly_webhook_update

Update fields of an existing webhook by ``id``. Audit-logged.

ParameterTypeDescription
device *string
id *integer
condition
enable
name
repeat_period
urls

shelly_webhook_delete

Delete a webhook by ``id``. Requires ``confirm:true``. Audit-logged.

ParameterTypeDescription
device *string
id *integer
confirmboolean