wemo-mcp-server 0.1.0__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.
@@ -0,0 +1,59 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ pip-wheel-metadata/
20
+ share/python-wheels/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ MANIFEST
25
+
26
+ # Virtual Environment
27
+ .venv/
28
+ venv/
29
+ ENV/
30
+ env/
31
+ .virtualenv/
32
+
33
+ # IDEs
34
+ .vscode/
35
+ .idea/
36
+ *.swp
37
+ *.swo
38
+ *~
39
+
40
+ # Testing
41
+ .pytest_cache/
42
+ .coverage
43
+ .coverage.*
44
+ htmlcov/
45
+ .tox/
46
+ .hypothesis/
47
+
48
+ # Package managers
49
+ uv.lock
50
+ poetry.lock
51
+ Pipfile.lock
52
+
53
+ # OS
54
+ .DS_Store
55
+
56
+ # Temporary files
57
+ *.log
58
+ *.tmp
59
+ *.bak
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WeMo MCP Server Contributors
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.
@@ -0,0 +1,364 @@
1
+ Metadata-Version: 2.4
2
+ Name: wemo-mcp-server
3
+ Version: 0.1.0
4
+ Summary: Model Context Protocol server for WeMo smart home device discovery and control
5
+ Project-URL: Homepage, https://github.com/qrussell/wemo-ops-center/tree/main/mcp
6
+ Project-URL: Repository, https://github.com/qrussell/wemo-ops-center.git
7
+ Project-URL: Issues, https://github.com/qrussell/wemo-ops-center/issues
8
+ Author-email: apiarya <izzasnvyp7@privaterelay.appleid.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: belkin,home-automation,iot,mcp,smart-home,wemo
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Home Automation
21
+ Classifier: Topic :: System :: Networking
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: httpx>=0.25.0
24
+ Requires-Dist: mcp>=1.2.0
25
+ Requires-Dist: pywemo>=1.4.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: black>=23.0.0; extra == 'dev'
28
+ Requires-Dist: isort>=5.12.0; extra == 'dev'
29
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # WeMo MCP Server
36
+
37
+ Control WeMo smart home devices through AI assistants using natural language.
38
+
39
+ [![Install with Claude Desktop](https://img.shields.io/badge/Claude_Desktop-Install_Server-5436DA?style=for-the-badge&logo=anthropic&logoColor=white)](#claude-desktop-integration)
40
+ [![Install with Claude Code](https://img.shields.io/badge/Claude_Code-Install_Server-8B5CF6?style=for-the-badge&logo=anthropic&logoColor=white)](#claude-code-cli)
41
+ [![Install with VS Code](https://img.shields.io/badge/VS_Code-Install_Server-007ACC?style=for-the-badge&logo=visualstudiocode&logoColor=white)](#vs-code-integration)
42
+ [![Add to Cursor](https://img.shields.io/badge/Add_to-Cursor-000000?style=for-the-badge&logo=cursor&logoColor=white)](cursor://anysphere.cursor-deeplink/mcp/install?name=WeMo%20MCP%20Server&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJ3ZW1vLW1jcC1zZXJ2ZXIiXX0%3D)
43
+
44
+ [![PyPI version](https://img.shields.io/pypi/v/wemo-mcp-server.svg)](https://pypi.org/project/wemo-mcp-server/)
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
47
+ [![MCP](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)
48
+
49
+ ## Quick Start
50
+
51
+ Install this package:
52
+
53
+ ```bash
54
+ pip install wemo-mcp-server
55
+ ```
56
+
57
+ or use [uvx](https://docs.astral.sh/uv/) for isolated execution:
58
+
59
+ ```bash
60
+ uvx wemo-mcp-server
61
+ ```
62
+
63
+ Then click one of the badges above to add to your MCP client, or see [Configuration](#configuration) for manual setup.
64
+
65
+ ## Overview
66
+
67
+ This MCP server provides seamless integration with WeMo smart home devices, enabling discovery, monitoring, and control through the Model Context Protocol. Built on the proven [pywemo](https://github.com/pywemo/pywemo) library, it offers reliable device management with intelligent multi-phase discovery.
68
+
69
+ ### Example: Controlling Devices with Claude
70
+
71
+ ![Claude Desktop controlling WeMo devices](assets/claude-example.png)
72
+
73
+ *Natural language control of WeMo devices through Claude Desktop - just ask in plain English and the MCP server handles the rest.*
74
+
75
+ ## Features
76
+
77
+ - **🔍 Smart Discovery**: Multi-phase device discovery combining UPnP/SSDP multicast and network scanning
78
+ - **⚡ Fast Scanning**: Parallel network probing with configurable concurrency (23-30s for full subnet)
79
+ - **🎛️ Device Control**: Turn devices on/off, toggle state, and control brightness for dimmers
80
+ - **✏️ Device Management**: Rename devices and extract HomeKit setup codes
81
+ - **📊 Status Monitoring**: Real-time device state and brightness queries
82
+ - **💾 Device Caching**: Automatic caching of discovered devices for quick access
83
+ - **🔌 MCP Integration**: Works with any MCP-compatible application (Claude Desktop, VS Code, etc.)
84
+
85
+ ## Configuration
86
+
87
+ ### Claude Desktop
88
+
89
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "wemo-mcp-server": {
95
+ "command": "uvx",
96
+ "args": ["wemo-mcp-server"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Claude Code CLI
103
+
104
+ ```bash
105
+ claude mcp add wemo-mcp-server --command uvx --args wemo-mcp-server
106
+ ```
107
+
108
+ ### VS Code
109
+
110
+ Edit `~/.vscode/mcp.json`:
111
+
112
+ ```json
113
+ {
114
+ "servers": {
115
+ "wemo-mcp-server": {
116
+ "type": "stdio",
117
+ "command": "uvx",
118
+ "args": ["wemo-mcp-server"]
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ ### Cursor
125
+
126
+ Click the "Add to Cursor" badge above, or edit `~/.cursor/mcp.json`:
127
+
128
+ ```json
129
+ {
130
+ "servers": {
131
+ "wemo-mcp-server": {
132
+ "type": "stdio",
133
+ "command": "uvx",
134
+ "args": ["wemo-mcp-server"]
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ ## Available Tools
141
+
142
+ ### 1. scan_network
143
+
144
+ Discover WeMo devices on your network using intelligent multi-phase scanning.
145
+
146
+ **Example Prompts:**
147
+ - "Scan for WeMo devices on my network"
148
+ - "Find all WeMo devices"
149
+ - "Discover devices on 192.168.1.0/24"
150
+
151
+ **Example Response:**
152
+ ```
153
+ Found 12 WeMo devices in 23.5 seconds:
154
+
155
+ 1. Office Light (Dimmer) - 192.168.1.100 - OFF
156
+ 2. Living Room (Switch) - 192.168.1.101 - ON
157
+ 3. Bedroom Lamp (Dimmer) - 192.168.1.102 - OFF
158
+ ...
159
+ ```
160
+
161
+ ### 2. list_devices
162
+
163
+ List all devices cached from previous scans.
164
+
165
+ **Example Prompts:**
166
+ - "List all my WeMo devices"
167
+ - "Show me all devices"
168
+ - "What devices do you know about?"
169
+
170
+ **Example Response:**
171
+ ```
172
+ 12 devices in cache:
173
+
174
+ - Office Light (Dimmer) at 192.168.1.100
175
+ - Living Room (Switch) at 192.168.1.101
176
+ - Bedroom Lamp (Dimmer) at 192.168.1.102
177
+ ...
178
+ ```
179
+
180
+ ### 3. get_device_status
181
+
182
+ Get current state and information for a specific device.
183
+
184
+ **Example Prompts:**
185
+ - "Is the office light on?"
186
+ - "What's the status of the bedroom lamp?"
187
+ - "Check the living room switch"
188
+ - "What's the brightness of office light?"
189
+
190
+ **Example Response:**
191
+ ```
192
+ Office Light (Dimmer):
193
+ - State: OFF
194
+ - Brightness: 75%
195
+ - IP: 192.168.1.100
196
+ - Model: DimmerLongPress
197
+ ```
198
+
199
+ ### 4. control_device
200
+
201
+ Control a WeMo device (on/off/toggle/brightness).
202
+
203
+ **Example Prompts:**
204
+ - "Turn on the office light"
205
+ - "Turn off the living room"
206
+ - "Toggle the bedroom lamp"
207
+ - "Set office light to 75%"
208
+ - "Dim the bedroom lamp to 50%"
209
+
210
+ **Example Response:**
211
+ ```
212
+ ✓ Office Light turned ON
213
+ Brightness set to 75%
214
+ Current state: ON
215
+ ```
216
+
217
+ ### 5. rename_device
218
+
219
+ Rename a WeMo device (change its friendly name).
220
+
221
+ **Example Prompts:**
222
+ - "Rename Office Dimmer to Office Light"
223
+ - "Change the name of the bedroom device to Bedroom Lamp"
224
+ - "Call the living room switch 'Main Light'"
225
+
226
+ **Example Response:**
227
+ ```
228
+ ✓ Device renamed successfully
229
+ 'Office Dimmer' → 'Office Light'
230
+ IP: 192.168.1.100
231
+
232
+ The new name will appear in the WeMo app and all control interfaces.
233
+ ```
234
+
235
+ ### 6. get_homekit_code
236
+
237
+ Get the HomeKit setup code for a WeMo device.
238
+
239
+ **Example Prompts:**
240
+ - "Get the HomeKit code for Office Light"
241
+ - "What's the HomeKit setup code for the bedroom lamp?"
242
+ - "Show me the HomeKit code for all devices"
243
+
244
+ **Example Response:**
245
+ ```
246
+ HomeKit Setup Code for 'Office Light':
247
+ 123-45-678
248
+
249
+ Use this code to add the device to Apple Home.
250
+ ```
251
+
252
+ **Note:** Not all WeMo devices support HomeKit. If a device doesn't support HomeKit, you'll get an error message.
253
+
254
+ ## How It Works
255
+
256
+ ### Multi-Phase Discovery
257
+
258
+ The server uses a three-phase discovery process optimized for reliability:
259
+
260
+ 1. **Phase 1 - UPnP/SSDP Discovery (Primary)**
261
+ - Multicast discovery finds all responsive devices (~12s)
262
+ - Most reliable method, finds devices that don't respond to port probes
263
+ - Uses pywemo's built-in discovery mechanism
264
+
265
+ 2. **Phase 2 - Network Port Scanning (Backup)**
266
+ - Parallel probing of WeMo ports (49152-49155) across subnet
267
+ - 60 concurrent workers for fast scanning (~10s for 254 IPs)
268
+ - Catches devices missed by UPnP
269
+
270
+ 3. **Phase 3 - Device Verification (Backup)**
271
+ - HTTP verification of active IPs via /setup.xml
272
+ - Parallel verification with 60 workers
273
+ - Validates and extracts device information
274
+
275
+ This approach achieves **100% device discovery reliability** while maintaining fast scan times (23-30 seconds for complete networks).
276
+
277
+ ## Feature Comparison
278
+
279
+ ### MCP Server vs wemo-ops-center
280
+
281
+ Comparison of features between this MCP server and the main [wemo-ops-center](https://github.com/qrussell/wemo-ops-center) project:
282
+
283
+ | Feature | wemo-ops-center | MCP Server | Notes |
284
+ |---------|-----------------|------------|-------|
285
+ | **Device Discovery** | ✅ UPnP + Port Scan | ✅ Implemented | Multi-phase discovery with 100% reliability |
286
+ | **Device Control** | ✅ On/Off/Toggle | ✅ Implemented | Includes brightness control for dimmers |
287
+ | **Device Status** | ✅ Real-time | ✅ Implemented | Query by name or IP address |
288
+ | **Device Rename** | ✅ Friendly names | ✅ Implemented | Updates device cache automatically |
289
+ | **HomeKit Codes** | ✅ Extract codes | ✅ Implemented | For HomeKit-compatible devices |
290
+ | **Multi-subnet** | ✅ VLAN support | ❌ Planned | Currently single subnet per scan |
291
+ | **WiFi Provisioning** | ✅ Smart setup | ❌ Not planned | Requires PC WiFi connection changes |
292
+ | **Scheduling** | ✅ Time + Solar | ❌ Not planned | Requires persistent daemon (incompatible with MCP model) |
293
+ | **Maintenance Tools** | ✅ Resets | ❌ Not planned | Factory reset, clear WiFi, clear data |
294
+ | **Profile Management** | ✅ Save/Load | ❌ Not planned | WiFi credential profiles for bulk setup |
295
+ | **User Interface** | ✅ GUI + Web | ❌ N/A | MCP uses AI assistant interface |
296
+
297
+ **Legend:**
298
+ - ✅ **Implemented** - Feature is available
299
+ - ❌ **Not planned** - Feature conflicts with MCP architecture or use case
300
+ - ❌ **Planned** - Feature could be added in future
301
+
302
+ **Why some features aren't planned for MCP:**
303
+ - **Scheduling**: Requires 24/7 background daemon polling. MCP servers are typically invoked on-demand by AI assistants, not run as persistent services.
304
+ - **WiFi Provisioning**: Requires changing the host PC's WiFi connection to device setup networks, which is disruptive and platform-specific.
305
+ - **Maintenance Tools**: Destructive operations (factory reset, etc.) better suited for dedicated GUI with confirmation dialogs.
306
+
307
+ **Current MCP Coverage:** 5 of 11 core features (45%) - focused on device discovery, monitoring, and control use cases that fit the MCP model.
308
+
309
+ ## Development
310
+
311
+ ### Setup
312
+
313
+ ```bash
314
+ git clone https://github.com/qrussell/wemo-ops-center.git
315
+ cd wemo-ops-center/mcp
316
+ uv venv
317
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
318
+ uv sync --dev
319
+ ```
320
+
321
+ ### Running Tests
322
+
323
+ ```bash
324
+ # E2E tests (requires WeMo devices on network)
325
+ python tests/test_e2e.py
326
+
327
+ # Unit tests
328
+ pytest tests/test_server.py -v
329
+ ```
330
+
331
+ ### Using Development Version
332
+
333
+ In your MCP client config, use:
334
+ ```json
335
+ {
336
+ "command": "python",
337
+ "args": ["-m", "wemo_mcp_server"],
338
+ "env": {
339
+ "PYTHONPATH": "/path/to/mcp/src"
340
+ }
341
+ }
342
+ ```
343
+
344
+ ## Contributing
345
+
346
+ Contributions welcome! Please:
347
+
348
+ 1. Fork the repository
349
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
350
+ 3. Make your changes with tests
351
+ 4. Run the test suite (`python tests/test_e2e.py`)
352
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
353
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
354
+ 7. Open a Pull Request
355
+
356
+ ## License
357
+
358
+ MIT License - see [LICENSE](LICENSE) file for details.
359
+
360
+ ## Acknowledgments
361
+
362
+ - Built with [Model Context Protocol SDK](https://github.com/modelcontextprotocol/python-sdk)
363
+ - Uses [pywemo](https://github.com/pywemo/pywemo) for WeMo device communication
364
+ - Part of the [wemo-ops-center](https://github.com/qrussell/wemo-ops-center) project