Skip to main content
Glama
README.md
# deco-mcp

An [MCP](https://modelcontextprotocol.io) server for managing a TP-Link Deco mesh network from an AI assistant: see what the network is doing, find what is eating the bandwidth, block devices, hand out fixed IPs, check firmware and logs, and diagnose a slow connection.

It talks to the Deco directly on your LAN through its local API, with its own client (no TP-Link cloud, no third-party router library). Tested on a Deco BE25 running firmware 1.1.8; other Deco models use the same local API but may expose fewer features.

## Tools

Read-only tools are always available. Tools that change something only exist when the server runs with `DECO_ALLOW_WRITES=1`.

### Network and mesh

| Tool | |
|---|---|
| `deco_get_network` | Internet state, WAN/LAN addressing, IPv6, mode, main Deco CPU/memory |
| `deco_list_units` | Each Deco unit: role, IP, mesh/internet status, uplink signal, firmware |
| `deco_get_wifi` | Main, guest, IoT and MLO networks per band. Passwords are never returned |
| `deco_diagnose_path` | Packet loss/latency to the first hops and public resolvers, plus macOS `networkQuality`. Runs on your machine and needs no Deco login |
| `deco_reboot` ✎⚠ | Reboot one unit or the whole mesh |

### Clients

| Tool | |
|---|---|
| `deco_list_clients` | Devices with live download/upload rates in kbit/s, busiest first |
| `deco_list_blocked_clients` | Devices blocked from the internet |
| `deco_list_reservations` | Fixed IP reservations |
| `deco_block_client` ✎ / `deco_unblock_client` ✎ | Block or restore a device's internet access |
| `deco_add_reservation` ✎ / `deco_remove_reservation` ✎ | Give a device a fixed IP, or remove it |

### System

| Tool | |
|---|---|
| `deco_get_system_log` | Recent log lines by severity, with optional search |
| `deco_check_firmware` | Installed firmware per unit and whether an update is available |
| `deco_get_speedtest` / `deco_run_speedtest` ✎ | The Deco's own internet speed test |
| `deco_get_time_settings` | Clock and time zone |

✎ needs `DECO_ALLOW_WRITES=1` · ⚠ destructive

Not available yet: parental controls, QoS, port forwarding, HomeShield, Wi-Fi changes, LED and other settings the Deco only exposes to its mobile app.

## Safety

- **Read-only by default.** Write tools are not registered at all unless `DECO_ALLOW_WRITES=1` is set, and every tool carries MCP annotations (`readOnlyHint`, `destructiveHint`) so clients can ask before running one.
- **Preview first.** Write tools return a preview of what they would do; nothing changes until they are called again with `confirm=true`.
- **No lockouts.** The Deco locks logins after about ten failures. A rejected password is never retried until it changes.
- **Secrets stay out.** Wi-Fi passwords are never returned, and log lines that carry session tokens are filtered out.
- **Privacy.** Tool results go to your AI provider like any other conversation content. Client lists include device names, IPs and MACs, which can say who is home and what they own.
- **TLS.** The Deco uses a self-signed certificate, so the connection is not verified. Someone able to intercept traffic on your LAN could capture the admin password. Only point `DECO_HOST` at your own Deco.
- **One admin session.** The Deco allows a single admin login, so using the server signs you out of the Deco web page (and vice versa).

## Setup

You need [uv](https://docs.astral.sh/uv/) and the Deco's **local** admin password (the one for `https://192.168.68.1`).

Store the password in the macOS Keychain, from a regular terminal:

```sh
security add-generic-password -s deco-mcp -a admin -w
```

It prompts for the password, so it never lands in your shell history. Don't run it through an assistant's shell (such as Claude Code's `!`): with no terminal to read from it stores an empty password.

On other systems, set `DECO_PASSWORD` instead. Note that it then sits in plain text in your MCP client's config.

### Claude Code

```sh
claude mcp add deco -- uvx --from git+https://github.com/oscnord/deco-mcp@v0.2.0 deco-mcp
```

Add `-e DECO_ALLOW_WRITES=1` before `--` to enable the write tools.

### Other MCP clients

```json
{
  "mcpServers": {
    "deco": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/oscnord/deco-mcp@v0.2.0", "deco-mcp"],
      "env": { "DECO_ALLOW_WRITES": "0" }
    }
  }
}
```

## Configuration

| Variable | Default | |
|---|---|---|
| `DECO_HOST` | `https://192.168.68.1` | Main Deco, including the scheme |
| `DECO_ALLOW_WRITES` | unset | `1` registers the write tools |
| `DECO_PASSWORD` | | Local admin password; overrides the Keychain |
| `DECO_KEYCHAIN_SERVICE` | `deco-mcp` | Keychain item to read on macOS |

`deco_diagnose_path` needs `ping` and, for the hop list, `traceroute` (macOS or Linux).

## Development

```sh
python3 -m venv .venv && .venv/bin/pip install -e .
.venv/bin/python -m unittest discover -s tests
npx @modelcontextprotocol/inspector .venv/bin/deco-mcp
```

## License

MIT