deco-mcp 0.3.1__tar.gz
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.
- deco_mcp-0.3.1/.github/workflows/release.yml +86 -0
- deco_mcp-0.3.1/.gitignore +5 -0
- deco_mcp-0.3.1/LICENSE +21 -0
- deco_mcp-0.3.1/PKG-INFO +166 -0
- deco_mcp-0.3.1/README.md +145 -0
- deco_mcp-0.3.1/pyproject.toml +31 -0
- deco_mcp-0.3.1/server.json +49 -0
- deco_mcp-0.3.1/src/deco_mcp/__init__.py +0 -0
- deco_mcp-0.3.1/src/deco_mcp/app.py +261 -0
- deco_mcp-0.3.1/src/deco_mcp/config.py +63 -0
- deco_mcp-0.3.1/src/deco_mcp/connections.py +24 -0
- deco_mcp-0.3.1/src/deco_mcp/errors.py +10 -0
- deco_mcp-0.3.1/src/deco_mcp/registry.py +30 -0
- deco_mcp-0.3.1/src/deco_mcp/server.py +77 -0
- deco_mcp-0.3.1/src/deco_mcp/spake2p.py +113 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/__init__.py +49 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/clients.py +120 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/diagnostics.py +71 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/mesh.py +60 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/nat.py +99 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/network.py +46 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/security.py +44 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/settings.py +64 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/system.py +95 -0
- deco_mcp-0.3.1/src/deco_mcp/tools/wifi.py +73 -0
- deco_mcp-0.3.1/src/deco_mcp/web.py +170 -0
- deco_mcp-0.3.1/tests/test_app_protocol.py +39 -0
- deco_mcp-0.3.1/tests/test_config.py +19 -0
- deco_mcp-0.3.1/tests/test_settings.py +25 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v5
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Check the tag matches the package and server.json versions
|
|
19
|
+
run: |
|
|
20
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
21
|
+
package="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
|
22
|
+
server="$(jq -r .version server.json)"
|
|
23
|
+
package_entry="$(jq -r '.packages[0].version' server.json)"
|
|
24
|
+
echo "tag=$tag pyproject=$package server.json=$server/$package_entry"
|
|
25
|
+
test "$tag" = "$package" && test "$tag" = "$server" && test "$tag" = "$package_entry"
|
|
26
|
+
- name: Test
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install -e .
|
|
29
|
+
python -m unittest discover -s tests
|
|
30
|
+
- name: Build
|
|
31
|
+
run: |
|
|
32
|
+
python -m pip install build
|
|
33
|
+
python -m build
|
|
34
|
+
- uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
|
|
39
|
+
pypi:
|
|
40
|
+
needs: build
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
environment: pypi
|
|
43
|
+
permissions:
|
|
44
|
+
id-token: write
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
51
|
+
|
|
52
|
+
mcp-registry:
|
|
53
|
+
needs: pypi
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
permissions:
|
|
56
|
+
id-token: write
|
|
57
|
+
contents: read
|
|
58
|
+
env:
|
|
59
|
+
MCP_PUBLISHER_VERSION: v1.8.1
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v5
|
|
62
|
+
- name: Install cosign
|
|
63
|
+
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
|
|
64
|
+
- name: Download and verify mcp-publisher
|
|
65
|
+
run: |
|
|
66
|
+
set -euo pipefail
|
|
67
|
+
archive="mcp-publisher_linux_amd64.tar.gz"
|
|
68
|
+
base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"
|
|
69
|
+
curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive"
|
|
70
|
+
curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json"
|
|
71
|
+
cosign verify-blob \
|
|
72
|
+
--bundle "$archive.sigstore.json" \
|
|
73
|
+
--certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
|
|
74
|
+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
|
|
75
|
+
"$archive"
|
|
76
|
+
tar xzf "$archive" mcp-publisher
|
|
77
|
+
- name: Log in to the MCP Registry
|
|
78
|
+
run: ./mcp-publisher login github-oidc
|
|
79
|
+
- name: Publish to the MCP Registry
|
|
80
|
+
run: |
|
|
81
|
+
for attempt in 1 2 3 4 5; do
|
|
82
|
+
./mcp-publisher publish && exit 0
|
|
83
|
+
echo "Attempt $attempt failed; PyPI may not have served the new release yet. Retrying in 30 s."
|
|
84
|
+
sleep 30
|
|
85
|
+
done
|
|
86
|
+
exit 1
|
deco_mcp-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oscar Nord
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
deco_mcp-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: deco-mcp
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: MCP server for TP-Link Deco mesh routers: clients, Wi-Fi, port forwarding, HomeShield, firmware, logs and diagnostics over the local web and app protocols, no cloud
|
|
5
|
+
Project-URL: Repository, https://github.com/oscnord/deco-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/oscnord/deco-mcp/issues
|
|
7
|
+
Author: Oscar Nord
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: deco,home-network,mcp,mcp-server,mesh-wifi,model-context-protocol,router,tp-link
|
|
11
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: System :: Networking
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: cryptography>=43
|
|
17
|
+
Requires-Dist: httpx2>=2.16
|
|
18
|
+
Requires-Dist: mcp>=2.3
|
|
19
|
+
Requires-Dist: pydantic>=2
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# deco-mcp
|
|
23
|
+
|
|
24
|
+
<!-- mcp-name: io.github.oscnord/deco-mcp -->
|
|
25
|
+
|
|
26
|
+
An [MCP](https://modelcontextprotocol.io) server for managing a TP-Link Deco mesh network from an AI assistant, so you rarely need the Deco app: see what the network is doing, find what is eating the bandwidth, block devices, hand out fixed IPs, forward ports, switch guest Wi-Fi on and off, check HomeShield, firmware and logs, and diagnose a slow connection.
|
|
27
|
+
|
|
28
|
+
It talks to the Deco directly on your home network, never through TP-Link's cloud. The Deco has two ways in, and the server uses both, with its own client for each (no third-party router library):
|
|
29
|
+
|
|
30
|
+
| | What it is | How it logs in | What it covers |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| **Web API** | The interface behind the Deco's admin page at `https://192.168.68.1` | The Deco's local admin password | Status, clients, blocking, fixed IPs, logs, firmware, reboot |
|
|
33
|
+
| **App protocol** | The connection the Deco mobile app makes to the Deco on your network (port 30001) | The Deco owner's TP-Link ID, the same email and password you use in the Deco app | Everything the admin page can't do: port forwarding, guest Wi-Fi, HomeShield, parental controls, QoS and other app-only settings |
|
|
34
|
+
|
|
35
|
+
Tools marked 📱 below use the app protocol, so they only work once the TP-Link ID is set up (see [Setup](#setup)). The rest need only the admin password.
|
|
36
|
+
|
|
37
|
+
Tested on a Deco BE25 running firmware 1.1.8. Other Deco models speak the same protocols but may support fewer features.
|
|
38
|
+
|
|
39
|
+
## Tools
|
|
40
|
+
|
|
41
|
+
Read-only tools are always available. Tools marked ✎ change something and only exist when the server runs with `DECO_ALLOW_WRITES=1`; ⚠marks ones that delete something, expose a device or cut the network.
|
|
42
|
+
|
|
43
|
+
### Network and mesh
|
|
44
|
+
|
|
45
|
+
| Tool | |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `deco_get_network` | Internet state, WAN/LAN addressing, IPv6, mode, main Deco CPU/memory |
|
|
48
|
+
| `deco_list_units` | Each Deco unit: role, IP, mesh/internet status, uplink signal, firmware |
|
|
49
|
+
| `deco_diagnose_path` | Packet loss/latency to the first hops and public resolvers, plus macOS `networkQuality`. Runs on your machine, needs no Deco login |
|
|
50
|
+
| `deco_list_port_forwards` 📱 | Port forwarding rules |
|
|
51
|
+
| `deco_add_port_forward` 📱✎⚠/ `deco_remove_port_forward` 📱✎⚠| Expose a LAN device's port to the internet, or stop |
|
|
52
|
+
| `deco_reboot` ✎⚠| Reboot one unit or the whole mesh |
|
|
53
|
+
|
|
54
|
+
### Wi-Fi
|
|
55
|
+
|
|
56
|
+
| Tool | |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `deco_get_wifi` | Main, guest, IoT and MLO networks per band. Passwords are never returned |
|
|
59
|
+
| `deco_set_wifi_network` 📱✎ | Turn the guest, IoT or MLO network on or off |
|
|
60
|
+
|
|
61
|
+
### Clients
|
|
62
|
+
|
|
63
|
+
| Tool | |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `deco_list_clients` | Devices with live download/upload rates in kbit/s, busiest first |
|
|
66
|
+
| `deco_list_blocked_clients` | Devices blocked from the internet |
|
|
67
|
+
| `deco_block_client` ✎ / `deco_unblock_client` ✎ | Block or restore a device's internet access |
|
|
68
|
+
| `deco_list_reservations` | Configured fixed IPs |
|
|
69
|
+
| `deco_add_reservation` ✎ / `deco_remove_reservation` ✎⚠| Give a device a fixed IP, or remove it |
|
|
70
|
+
| `deco_list_dhcp_leases` 📱 | Addresses handed out right now |
|
|
71
|
+
|
|
72
|
+
### Security, parental controls and QoS
|
|
73
|
+
|
|
74
|
+
| Tool | |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `deco_get_security` 📱 | HomeShield protections and recent security events |
|
|
77
|
+
| `deco_get_parental_controls` 📱 | Parental-control profiles |
|
|
78
|
+
| `deco_get_qos` 📱 | QoS mode, priorities and bandwidth limits |
|
|
79
|
+
|
|
80
|
+
### System and settings
|
|
81
|
+
|
|
82
|
+
| Tool | |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `deco_get_system_log` | Recent log lines by severity, with optional search |
|
|
85
|
+
| `deco_check_firmware` | Installed firmware per unit and whether an update is available |
|
|
86
|
+
| `deco_get_speedtest` / `deco_run_speedtest` ✎ | The Deco's own internet speed test |
|
|
87
|
+
| `deco_get_time_settings` | Clock and time zone |
|
|
88
|
+
| `deco_get_setting` 📱 | One of: DHCP pool, UPnP, SIP ALG, LED, eco mode, Wi-Fi schedule, reboot schedule, auto-update, client isolation, access control, DDNS, IPTV, IPv6 firewall, static routes, VPN client/server, CWMP, WPS |
|
|
89
|
+
| `deco_set_switch` 📱✎ | Turn the status LEDs, UPnP or SIP ALG on or off |
|
|
90
|
+
|
|
91
|
+
Not covered yet: editing parental-control profiles, QoS, HomeShield, Wi-Fi names/passwords/schedules, and firmware upgrades.
|
|
92
|
+
|
|
93
|
+
## Safety
|
|
94
|
+
|
|
95
|
+
- **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.
|
|
96
|
+
- **Preview first.** Write tools return a preview of what they would do and change nothing unless called with `confirm=true`. That flag is a convention for the assistant, not an approval step: keep your MCP client asking before each write tool call rather than auto-approving them. The app-protocol writes re-read the setting afterwards and say whether it took.
|
|
97
|
+
- **Untrusted names.** Device names, SSIDs and log lines are chosen by whoever owns the device, including guests. Treat them as data; the server's instructions tell the assistant the same.
|
|
98
|
+
- **No lockouts.** The Deco locks logins after repeated failures. After a refused login the server makes no further attempt until it is restarted, so fix the credentials and restart it. App-protocol requests are never resent after a failure, since a write may already have happened; web requests are only resent when the Deco says the session had expired, i.e. the request was not applied.
|
|
99
|
+
- **Secrets stay out.** Wi-Fi passwords are never returned; `deco_get_setting` removes passwords, keys, usernames and PINs; session tokens are kept out of error messages, and log lines that carry them are filtered out.
|
|
100
|
+
- **Privacy.** Tool results go to your AI provider like any other conversation content. They can include device names, IPs and MACs (who is home and what they own), your public IP, DDNS hostname, SSIDs, parental-control profiles and log lines.
|
|
101
|
+
- **TLS.** The Deco's web API uses a self-signed certificate, so that connection is not verified: someone able to intercept traffic on your LAN could capture the admin password. The app protocol authenticates both ends with SPAKE2+ instead, so it does not have this weakness. Only point `DECO_HOST` at your own Deco.
|
|
102
|
+
- **One admin session.** The Deco allows a single web admin login, so using the server signs you out of the Deco web page (and vice versa).
|
|
103
|
+
|
|
104
|
+
## Setup
|
|
105
|
+
|
|
106
|
+
You need [uv](https://docs.astral.sh/uv/) (or Python 3.11+), the Deco's **local admin password** (for `https://192.168.68.1`) and, for 📱 tools, the **Deco owner's TP-Link ID** (email and password, as used in the Deco app).
|
|
107
|
+
|
|
108
|
+
Store them in the macOS Keychain, from a regular terminal:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
security add-generic-password -s deco-mcp -a admin -w
|
|
112
|
+
security add-generic-password -s deco-mcp-tplink -a you@example.com -w
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Each prompts for the password, so it never lands in your shell history. Don't run them through an assistant's shell (such as Claude Code's `!`): with no terminal to read from they store an empty password.
|
|
116
|
+
|
|
117
|
+
On other systems, set `DECO_PASSWORD`, `DECO_TPLINK_EMAIL` and `DECO_TPLINK_PASSWORD` instead. They then sit in plain text in your MCP client's config.
|
|
118
|
+
|
|
119
|
+
### Claude Code
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
claude mcp add deco -- uvx deco-mcp
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Add `-e DECO_ALLOW_WRITES=1` before `--` to enable the write tools.
|
|
126
|
+
|
|
127
|
+
### Other MCP clients
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"deco": {
|
|
133
|
+
"command": "uvx",
|
|
134
|
+
"args": ["deco-mcp"],
|
|
135
|
+
"env": { "DECO_ALLOW_WRITES": "0" }
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
| Variable | Default | |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `DECO_HOST` | `https://192.168.68.1` | Main Deco, including the scheme |
|
|
146
|
+
| `DECO_ALLOW_WRITES` | unset | `1` registers the write tools |
|
|
147
|
+
| `DECO_PASSWORD` | | Local admin password; overrides the Keychain |
|
|
148
|
+
| `DECO_TPLINK_EMAIL` / `DECO_TPLINK_PASSWORD` | | Owner's TP-Link ID; overrides the Keychain |
|
|
149
|
+
| `DECO_KEYCHAIN_SERVICE` | `deco-mcp` | Keychain item for the admin password |
|
|
150
|
+
| `DECO_TPLINK_KEYCHAIN_SERVICE` | `deco-mcp-tplink` | Keychain item for the TP-Link ID |
|
|
151
|
+
|
|
152
|
+
`deco_diagnose_path` needs `ping` and, for the hop list, `traceroute` (macOS or Linux).
|
|
153
|
+
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
python3 -m venv .venv && .venv/bin/pip install -e .
|
|
158
|
+
.venv/bin/python -m unittest discover -s tests
|
|
159
|
+
npx @modelcontextprotocol/inspector .venv/bin/deco-mcp
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The app-protocol client was written from a clean-room description of the protocol, not from any existing implementation.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT
|
deco_mcp-0.3.1/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# deco-mcp
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.oscnord/deco-mcp -->
|
|
4
|
+
|
|
5
|
+
An [MCP](https://modelcontextprotocol.io) server for managing a TP-Link Deco mesh network from an AI assistant, so you rarely need the Deco app: see what the network is doing, find what is eating the bandwidth, block devices, hand out fixed IPs, forward ports, switch guest Wi-Fi on and off, check HomeShield, firmware and logs, and diagnose a slow connection.
|
|
6
|
+
|
|
7
|
+
It talks to the Deco directly on your home network, never through TP-Link's cloud. The Deco has two ways in, and the server uses both, with its own client for each (no third-party router library):
|
|
8
|
+
|
|
9
|
+
| | What it is | How it logs in | What it covers |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| **Web API** | The interface behind the Deco's admin page at `https://192.168.68.1` | The Deco's local admin password | Status, clients, blocking, fixed IPs, logs, firmware, reboot |
|
|
12
|
+
| **App protocol** | The connection the Deco mobile app makes to the Deco on your network (port 30001) | The Deco owner's TP-Link ID, the same email and password you use in the Deco app | Everything the admin page can't do: port forwarding, guest Wi-Fi, HomeShield, parental controls, QoS and other app-only settings |
|
|
13
|
+
|
|
14
|
+
Tools marked 📱 below use the app protocol, so they only work once the TP-Link ID is set up (see [Setup](#setup)). The rest need only the admin password.
|
|
15
|
+
|
|
16
|
+
Tested on a Deco BE25 running firmware 1.1.8. Other Deco models speak the same protocols but may support fewer features.
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
Read-only tools are always available. Tools marked ✎ change something and only exist when the server runs with `DECO_ALLOW_WRITES=1`; ⚠marks ones that delete something, expose a device or cut the network.
|
|
21
|
+
|
|
22
|
+
### Network and mesh
|
|
23
|
+
|
|
24
|
+
| Tool | |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `deco_get_network` | Internet state, WAN/LAN addressing, IPv6, mode, main Deco CPU/memory |
|
|
27
|
+
| `deco_list_units` | Each Deco unit: role, IP, mesh/internet status, uplink signal, firmware |
|
|
28
|
+
| `deco_diagnose_path` | Packet loss/latency to the first hops and public resolvers, plus macOS `networkQuality`. Runs on your machine, needs no Deco login |
|
|
29
|
+
| `deco_list_port_forwards` 📱 | Port forwarding rules |
|
|
30
|
+
| `deco_add_port_forward` 📱✎⚠/ `deco_remove_port_forward` 📱✎⚠| Expose a LAN device's port to the internet, or stop |
|
|
31
|
+
| `deco_reboot` ✎⚠| Reboot one unit or the whole mesh |
|
|
32
|
+
|
|
33
|
+
### Wi-Fi
|
|
34
|
+
|
|
35
|
+
| Tool | |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `deco_get_wifi` | Main, guest, IoT and MLO networks per band. Passwords are never returned |
|
|
38
|
+
| `deco_set_wifi_network` 📱✎ | Turn the guest, IoT or MLO network on or off |
|
|
39
|
+
|
|
40
|
+
### Clients
|
|
41
|
+
|
|
42
|
+
| Tool | |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `deco_list_clients` | Devices with live download/upload rates in kbit/s, busiest first |
|
|
45
|
+
| `deco_list_blocked_clients` | Devices blocked from the internet |
|
|
46
|
+
| `deco_block_client` ✎ / `deco_unblock_client` ✎ | Block or restore a device's internet access |
|
|
47
|
+
| `deco_list_reservations` | Configured fixed IPs |
|
|
48
|
+
| `deco_add_reservation` ✎ / `deco_remove_reservation` ✎⚠| Give a device a fixed IP, or remove it |
|
|
49
|
+
| `deco_list_dhcp_leases` 📱 | Addresses handed out right now |
|
|
50
|
+
|
|
51
|
+
### Security, parental controls and QoS
|
|
52
|
+
|
|
53
|
+
| Tool | |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `deco_get_security` 📱 | HomeShield protections and recent security events |
|
|
56
|
+
| `deco_get_parental_controls` 📱 | Parental-control profiles |
|
|
57
|
+
| `deco_get_qos` 📱 | QoS mode, priorities and bandwidth limits |
|
|
58
|
+
|
|
59
|
+
### System and settings
|
|
60
|
+
|
|
61
|
+
| Tool | |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `deco_get_system_log` | Recent log lines by severity, with optional search |
|
|
64
|
+
| `deco_check_firmware` | Installed firmware per unit and whether an update is available |
|
|
65
|
+
| `deco_get_speedtest` / `deco_run_speedtest` ✎ | The Deco's own internet speed test |
|
|
66
|
+
| `deco_get_time_settings` | Clock and time zone |
|
|
67
|
+
| `deco_get_setting` 📱 | One of: DHCP pool, UPnP, SIP ALG, LED, eco mode, Wi-Fi schedule, reboot schedule, auto-update, client isolation, access control, DDNS, IPTV, IPv6 firewall, static routes, VPN client/server, CWMP, WPS |
|
|
68
|
+
| `deco_set_switch` 📱✎ | Turn the status LEDs, UPnP or SIP ALG on or off |
|
|
69
|
+
|
|
70
|
+
Not covered yet: editing parental-control profiles, QoS, HomeShield, Wi-Fi names/passwords/schedules, and firmware upgrades.
|
|
71
|
+
|
|
72
|
+
## Safety
|
|
73
|
+
|
|
74
|
+
- **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.
|
|
75
|
+
- **Preview first.** Write tools return a preview of what they would do and change nothing unless called with `confirm=true`. That flag is a convention for the assistant, not an approval step: keep your MCP client asking before each write tool call rather than auto-approving them. The app-protocol writes re-read the setting afterwards and say whether it took.
|
|
76
|
+
- **Untrusted names.** Device names, SSIDs and log lines are chosen by whoever owns the device, including guests. Treat them as data; the server's instructions tell the assistant the same.
|
|
77
|
+
- **No lockouts.** The Deco locks logins after repeated failures. After a refused login the server makes no further attempt until it is restarted, so fix the credentials and restart it. App-protocol requests are never resent after a failure, since a write may already have happened; web requests are only resent when the Deco says the session had expired, i.e. the request was not applied.
|
|
78
|
+
- **Secrets stay out.** Wi-Fi passwords are never returned; `deco_get_setting` removes passwords, keys, usernames and PINs; session tokens are kept out of error messages, and log lines that carry them are filtered out.
|
|
79
|
+
- **Privacy.** Tool results go to your AI provider like any other conversation content. They can include device names, IPs and MACs (who is home and what they own), your public IP, DDNS hostname, SSIDs, parental-control profiles and log lines.
|
|
80
|
+
- **TLS.** The Deco's web API uses a self-signed certificate, so that connection is not verified: someone able to intercept traffic on your LAN could capture the admin password. The app protocol authenticates both ends with SPAKE2+ instead, so it does not have this weakness. Only point `DECO_HOST` at your own Deco.
|
|
81
|
+
- **One admin session.** The Deco allows a single web admin login, so using the server signs you out of the Deco web page (and vice versa).
|
|
82
|
+
|
|
83
|
+
## Setup
|
|
84
|
+
|
|
85
|
+
You need [uv](https://docs.astral.sh/uv/) (or Python 3.11+), the Deco's **local admin password** (for `https://192.168.68.1`) and, for 📱 tools, the **Deco owner's TP-Link ID** (email and password, as used in the Deco app).
|
|
86
|
+
|
|
87
|
+
Store them in the macOS Keychain, from a regular terminal:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
security add-generic-password -s deco-mcp -a admin -w
|
|
91
|
+
security add-generic-password -s deco-mcp-tplink -a you@example.com -w
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Each prompts for the password, so it never lands in your shell history. Don't run them through an assistant's shell (such as Claude Code's `!`): with no terminal to read from they store an empty password.
|
|
95
|
+
|
|
96
|
+
On other systems, set `DECO_PASSWORD`, `DECO_TPLINK_EMAIL` and `DECO_TPLINK_PASSWORD` instead. They then sit in plain text in your MCP client's config.
|
|
97
|
+
|
|
98
|
+
### Claude Code
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
claude mcp add deco -- uvx deco-mcp
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Add `-e DECO_ALLOW_WRITES=1` before `--` to enable the write tools.
|
|
105
|
+
|
|
106
|
+
### Other MCP clients
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"mcpServers": {
|
|
111
|
+
"deco": {
|
|
112
|
+
"command": "uvx",
|
|
113
|
+
"args": ["deco-mcp"],
|
|
114
|
+
"env": { "DECO_ALLOW_WRITES": "0" }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
| Variable | Default | |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `DECO_HOST` | `https://192.168.68.1` | Main Deco, including the scheme |
|
|
125
|
+
| `DECO_ALLOW_WRITES` | unset | `1` registers the write tools |
|
|
126
|
+
| `DECO_PASSWORD` | | Local admin password; overrides the Keychain |
|
|
127
|
+
| `DECO_TPLINK_EMAIL` / `DECO_TPLINK_PASSWORD` | | Owner's TP-Link ID; overrides the Keychain |
|
|
128
|
+
| `DECO_KEYCHAIN_SERVICE` | `deco-mcp` | Keychain item for the admin password |
|
|
129
|
+
| `DECO_TPLINK_KEYCHAIN_SERVICE` | `deco-mcp-tplink` | Keychain item for the TP-Link ID |
|
|
130
|
+
|
|
131
|
+
`deco_diagnose_path` needs `ping` and, for the hop list, `traceroute` (macOS or Linux).
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
python3 -m venv .venv && .venv/bin/pip install -e .
|
|
137
|
+
.venv/bin/python -m unittest discover -s tests
|
|
138
|
+
npx @modelcontextprotocol/inspector .venv/bin/deco-mcp
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The app-protocol client was written from a clean-room description of the protocol, not from any existing implementation.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "deco-mcp"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
description = "MCP server for TP-Link Deco mesh routers: clients, Wi-Fi, port forwarding, HomeShield, firmware, logs and diagnostics over the local web and app protocols, no cloud"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = [{ name = "Oscar Nord" }]
|
|
8
|
+
keywords = ["mcp", "mcp-server", "model-context-protocol", "tp-link", "deco", "router", "mesh-wifi", "home-network"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Operating System :: OS Independent",
|
|
12
|
+
"Topic :: System :: Networking",
|
|
13
|
+
"Intended Audience :: End Users/Desktop",
|
|
14
|
+
]
|
|
15
|
+
requires-python = ">=3.11"
|
|
16
|
+
dependencies = ["mcp>=2.3", "httpx2>=2.16", "cryptography>=43", "pydantic>=2"]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
deco-mcp = "deco_mcp.server:main"
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Repository = "https://github.com/oscnord/deco-mcp"
|
|
23
|
+
Issues = "https://github.com/oscnord/deco-mcp/issues"
|
|
24
|
+
|
|
25
|
+
[build-system]
|
|
26
|
+
requires = ["hatchling"]
|
|
27
|
+
build-backend = "hatchling.build"
|
|
28
|
+
|
|
29
|
+
[tool.ruff]
|
|
30
|
+
line-length = 120
|
|
31
|
+
target-version = "py311"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.oscnord/deco-mcp",
|
|
4
|
+
"title": "TP-Link Deco",
|
|
5
|
+
"description": "Manage a TP-Link Deco mesh over its local API: clients, Wi-Fi, port forwarding, HomeShield, logs",
|
|
6
|
+
"version": "0.3.1",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/oscnord/deco-mcp",
|
|
9
|
+
"source": "github"
|
|
10
|
+
},
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "pypi",
|
|
14
|
+
"identifier": "deco-mcp",
|
|
15
|
+
"version": "0.3.1",
|
|
16
|
+
"runtimeHint": "uvx",
|
|
17
|
+
"transport": {
|
|
18
|
+
"type": "stdio"
|
|
19
|
+
},
|
|
20
|
+
"environmentVariables": [
|
|
21
|
+
{
|
|
22
|
+
"name": "DECO_HOST",
|
|
23
|
+
"description": "Main Deco, including the scheme",
|
|
24
|
+
"default": "https://192.168.68.1"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "DECO_PASSWORD",
|
|
28
|
+
"description": "The Deco's local admin password (on macOS the Keychain item deco-mcp can be used instead)",
|
|
29
|
+
"isSecret": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "DECO_TPLINK_EMAIL",
|
|
33
|
+
"description": "Deco owner's TP-Link ID email, for app-protocol tools (or the Keychain item deco-mcp-tplink)"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "DECO_TPLINK_PASSWORD",
|
|
37
|
+
"description": "Deco owner's TP-Link ID password, for app-protocol tools",
|
|
38
|
+
"isSecret": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "DECO_ALLOW_WRITES",
|
|
42
|
+
"description": "Set to 1 to register the tools that change settings",
|
|
43
|
+
"choices": ["0", "1"],
|
|
44
|
+
"default": "0"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
File without changes
|