Skip to main content
Glama
README.md
# shelly-local-mcp

MCP server for discovering and managing local Shelly devices. Exposes device
discovery and management over the
[Model Context Protocol](https://modelcontextprotocol.io/) (stdio transport),
so you can query and configure Shelly devices from Claude Code or any other MCP
client. Supports Gen1, Gen2, and Gen3 devices. No cloud connection required.

## Prerequisites

- Python 3.13+
- [uv](https://docs.astral.sh/uv/)
- Shelly devices reachable on the local network

## Configuration

The server is configured via environment variables:

| Variable | Default | Description |
|---|---|---|
| `SHELLY_TIMEOUT` | `5` | HTTP timeout in seconds per device |
| `SHELLY_PASSWORDS` | *(empty)* | Per-device auth: `ip1=pass1,ip2=pass2` |

## Running

### With uv (development)

```sh
uv run shelly-local-mcp
```

### Directly from GitHub (no clone needed)

```sh
uv run --with git+https://github.com/daniel-k/shelly-local-mcp shelly-local-mcp
```

## Claude Code integration

Add to your MCP config (e.g. `~/.claude/settings.json` or `.claude/settings.json`):

### From GitHub (no local checkout)

```json
{
  "mcpServers": {
    "shelly": {
      "command": "uv",
      "args": ["run", "--with", "git+https://github.com/daniel-k/shelly-local-mcp", "shelly-local-mcp"],
      "env": {
        "SHELLY_PASSWORDS": "192.168.1.100=mypass,192.168.1.101=otherpass"
      }
    }
  }
}
```

### From a local checkout

```json
{
  "mcpServers": {
    "shelly": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/shelly-local-mcp", "shelly-local-mcp"],
      "env": {
        "SHELLY_PASSWORDS": "192.168.1.100=mypass,192.168.1.101=otherpass"
      }
    }
  }
}
```

Leave `SHELLY_PASSWORDS` empty if none of your devices have authentication enabled.

## Available tools

| Tool | Description |
|---|---|
| `discover_devices` | Find Shelly devices via mDNS and/or IP range scanning. Targets support single IPs, ranges (`192.168.1.1-254`), and CIDR (`192.168.1.0/24`). |
| `get_device_info` | Get detailed info for a device: identity, firmware, WiFi/cloud/MQTT status, uptime, components, and update availability. |

## Development

Install dev dependencies:

```sh
uv sync
```

Run all checks:

```sh
uv run tox
```

Format code:

```sh
uv run ruff format src/
```