# Shelly Smart Home [Health: Active]

**Category:** 🏠 Home Automation  
**Repository:** https://github.com/Buggy1111/shelly-mcp  
**GitHub Stars:** 2  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/shelly-smart-home

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

## Tools
Capabilities this server exposes over MCP:

- **shelly_switch_set** — Turn a switch/relay channel on or off (optionally auto-revert after N seconds).

Returns the post-action ``ChannelState``. Audit-logged.
- **shelly_switch_toggle** — Toggle a switch/relay channel. Returns the post-action ``ChannelState``. Audit-logged.
- **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.
- **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.
- **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.
- **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.
- **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.
- **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``.
- **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.
- **shelly_kvs_list** — List KVS keys (with their etags). ``match`` is a wildcard pattern (default all).
- **shelly_kvs_get** — Get one KVS value (with its etag) by key.
- **shelly_kvs_set** — Set a KVS key to a JSON value. Audit-logged.
- **shelly_kvs_delete** — Delete a KVS key. Requires ``confirm:true``. Audit-logged.
- **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).
- **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.
- **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.
- **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.
- **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.
- **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.
- **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).
- **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.
- **shelly_scene_delete** — Delete a named scene. Requires ``confirm:true``.
- **shelly_schedule_list** — List the schedules configured on a device. Local-only (cloud can't manage schedules).
- **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.
- **shelly_schedule_update** — Update fields of an existing schedule by ``id``. Audit-logged.
- **shelly_schedule_delete** — Delete a schedule by ``id``. Requires ``confirm:true``. Audit-logged.
- **shelly_script_list** — List scripts on a device (id, name, enable, running). Local-only.
- **shelly_script_get_code** — Get a script's full source, reassembling the device's paginated ``GetCode``.
- **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).
- **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.
- **shelly_script_start** — Start a script by ``id``. Returns ``was_running``. Audit-logged.
- **shelly_script_stop** — Stop a script by ``id``. Returns ``was_running``. Audit-logged.
- **shelly_script_eval** — Evaluate an expression inside a running script. **Arbitrary code** → ``confirm:true``.

Returns the stringified result. Audit-logged.
- **shelly_script_delete** — Delete a script by ``id``. Requires ``confirm:true``. Audit-logged.
- **shelly_system_reboot** — Reboot a device. Requires ``confirm:true``. Audit-logged.
- **shelly_system_update** — Trigger a firmware update (``channel`` = stable|beta). Requires ``confirm:true``.
- **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.
- **shelly_virtual_list** — List the device's virtual (dynamic) components via ``Shelly.GetComponents``.
- **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.
- **shelly_virtual_delete** — Delete a virtual component by ``key`` (``<type>:<cid>``). Requires ``confirm:true``.
- **shelly_webhook_list** — List webhooks configured on a device. Local-only.
- **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.
- **shelly_webhook_update** — Update fields of an existing webhook by ``id``. Audit-logged.
- **shelly_webhook_delete** — Delete a webhook by ``id``. Requires ``confirm:true``. Audit-logged.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "shelly-smart-home": {
    "command": "uvx",
    "args": ["shelly-mcp"]
  }
}
```

## Documentation

## What Shelly Smart Home MCP server does

The Shelly Smart Home MCP server gives MCP clients one interface for Shelly devices across Gen1, Gen2, Gen3, and Gen4. It can discover devices, inspect metadata and component capabilities, read normalized status, and retrieve configuration with credentials masked. Supported controls include switches, RGBW/CCT/white lights, and covers.

Energy tools provide live readings and local historical data. The server also exposes local automation features for Gen2 and newer devices, including schedules, scripts, webhooks, key-value storage, virtual components, and named scenes. Scenes are stored in a local YAML file and can combine plain control methods across multiple devices.

## How it works

The Shelly Smart Home MCP server normally communicates directly with devices on the local network. mDNS discovery can find devices on the local subnet, while manually configured IP addresses support devices on other subnets or environments where mDNS is unavailable. An optional Shelly Cloud connection provides off-LAN access.

Local mode supports discovery, status, control, live and historical energy data, and automation. Cloud mode supports status and control plus live energy readings, but not schedules, scripts, webhooks, or key-value storage. The project is an unofficial community implementation and is marked alpha.

Read operations are identified as read-only, mutations are audit-logged, and generic writes or destructive system operations require explicit confirmation. Irreversible operations require an additional data-loss confirmation. The generic RPC tools provide broader API coverage, including support for methods not represented by dedicated tools.

## Setup and configuration

Install with `uvx shelly-mcp` or install the package with `pip`. Register it as an MCP server using a standard command and the `shelly-mcp` executable. With the default setup, run discovery through the `shelly_discover` tool.

For named devices, passwords, fixed addresses, locations, or cloud access, create `~/.config/shelly-mcp/config.yaml` and protect a secret-containing file with permissions `600`. Device passwords can also be supplied through a per-device environment variable using the configured device name. Cloud authentication uses the optional `SHELLY_CLOUD_AUTH_KEY` environment variable.

In WSL or containers, mDNS commonly does not work; configure each device by IP instead. If a device requires authentication, add its password to the device configuration or provide the corresponding environment variable.

## Tools and capabilities

The Shelly Smart Home MCP server includes tools for:

- Discovering, listing, inspecting, and diagnosing devices and components.
- Reading status, configuration, firmware information, and supported methods.
- Setting or toggling switches, controlling lights, and moving covers.
- Reading live and historical energy measurements locally.
- Listing, creating, updating, and deleting schedules.
- Managing Gen2+ scripts, webhooks, KVS entries, and virtual components locally.
- Creating, running, listing, and deleting named scenes.
- Calling generic read-only or confirmed write RPC methods.

It also publishes device resources and prompts for evening scenes, energy reports, and diagnosis.

## Limitations and notes

Automation features require local device access and are unavailable through Shelly Cloud. Historical energy data is also local-only. BLU devices can be reached through their gateway or the generic RPC engine, while dedicated BLU tools are not yet available. The server sends no telemetry or phone-home data beyond calls to the user’s Shelly devices and, when enabled, the user’s Shelly Cloud account.

_Full upstream README: https://allmcps.com/mcp/shelly-smart-home/readme_

