Skip to main content

Model Context Protocol server for WeMo smart home device discovery and control

Project description

WeMo MCP Server

Control WeMo smart home devices through AI assistants using natural language.

Install with Claude Desktop Install with Claude Code Install with VS Code Add to Cursor

PyPI version Python 3.10+ License: MIT MCP

Quick Start

Install this package:

pip install wemo-mcp-server

or use uvx for isolated execution:

uvx wemo-mcp-server

Then click one of the badges above to add to your MCP client, or see Configuration for manual setup.

Overview

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 library, it offers reliable device management with intelligent multi-phase discovery.

Example: Controlling Devices with Claude

Claude Desktop controlling WeMo devices

Natural language control of WeMo devices through Claude Desktop - just ask in plain English and the MCP server handles the rest.

Features

  • 🔍 Smart Discovery: Multi-phase device discovery combining UPnP/SSDP multicast and network scanning
  • ⚡ Fast Scanning: Parallel network probing with configurable concurrency (23-30s for full subnet)
  • 🎛️ Device Control: Turn devices on/off, toggle state, and control brightness for dimmers
  • ✏️ Device Management: Rename devices and extract HomeKit setup codes
  • 📊 Status Monitoring: Real-time device state and brightness queries
  • 💾 Device Caching: Automatic caching of discovered devices for quick access
  • 🔌 MCP Integration: Works with any MCP-compatible application (Claude Desktop, VS Code, etc.)

Configuration

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "wemo-mcp-server": {
      "command": "uvx",
      "args": ["wemo-mcp-server"]
    }
  }
}

Claude Code CLI

claude mcp add wemo-mcp-server --command uvx --args wemo-mcp-server

VS Code

Edit ~/.vscode/mcp.json:

{
  "servers": {
    "wemo-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": ["wemo-mcp-server"]
    }
  }
}

Cursor

Click the "Add to Cursor" badge above, or edit ~/.cursor/mcp.json:

{
  "servers": {
    "wemo-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": ["wemo-mcp-server"]
    }
  }
}

Available Tools

1. scan_network

Discover WeMo devices on your network using intelligent multi-phase scanning.

Example Prompts:

  • "Scan for WeMo devices on my network"
  • "Find all WeMo devices"
  • "Discover devices on 192.168.1.0/24"

Example Response:

Found 12 WeMo devices in 23.5 seconds:

1. Office Light (Dimmer) - 192.168.1.100 - OFF
2. Living Room (Switch) - 192.168.1.101 - ON
3. Bedroom Lamp (Dimmer) - 192.168.1.102 - OFF  
...

2. list_devices

List all devices cached from previous scans.

Example Prompts:

  • "List all my WeMo devices"
  • "Show me all devices"
  • "What devices do you know about?"

Example Response:

12 devices in cache:

- Office Light (Dimmer) at 192.168.1.100
- Living Room (Switch) at 192.168.1.101
- Bedroom Lamp (Dimmer) at 192.168.1.102
...

3. get_device_status

Get current state and information for a specific device.

Example Prompts:

  • "Is the office light on?"
  • "What's the status of the bedroom lamp?"
  • "Check the living room switch"
  • "What's the brightness of office light?"

Example Response:

Office Light (Dimmer):
- State: OFF
- Brightness: 75%
- IP: 192.168.1.100
- Model: DimmerLongPress

4. control_device

Control a WeMo device (on/off/toggle/brightness).

Example Prompts:

  • "Turn on the office light"
  • "Turn off the living room"
  • "Toggle the bedroom lamp"
  • "Set office light to 75%"
  • "Dim the bedroom lamp to 50%"

Example Response:

✓ Office Light turned ON
  Brightness set to 75%
  Current state: ON

5. rename_device

Rename a WeMo device (change its friendly name).

Example Prompts:

  • "Rename Office Dimmer to Office Light"
  • "Change the name of the bedroom device to Bedroom Lamp"
  • "Call the living room switch 'Main Light'"

Example Response:

✓ Device renamed successfully
  'Office Dimmer' → 'Office Light'
  IP: 192.168.1.100
  
The new name will appear in the WeMo app and all control interfaces.

6. get_homekit_code

Get the HomeKit setup code for a WeMo device.

Example Prompts:

  • "Get the HomeKit code for Office Light"
  • "What's the HomeKit setup code for the bedroom lamp?"
  • "Show me the HomeKit code for all devices"

Example Response:

HomeKit Setup Code for 'Office Light':
  123-45-678
  
Use this code to add the device to Apple Home.

Note: Not all WeMo devices support HomeKit. If a device doesn't support HomeKit, you'll get an error message.

How It Works

Multi-Phase Discovery

The server uses a three-phase discovery process optimized for reliability:

  1. Phase 1 - UPnP/SSDP Discovery (Primary)

    • Multicast discovery finds all responsive devices (~12s)
    • Most reliable method, finds devices that don't respond to port probes
    • Uses pywemo's built-in discovery mechanism
  2. Phase 2 - Network Port Scanning (Backup)

    • Parallel probing of WeMo ports (49152-49155) across subnet
    • 60 concurrent workers for fast scanning (~10s for 254 IPs)
    • Catches devices missed by UPnP
  3. Phase 3 - Device Verification (Backup)

    • HTTP verification of active IPs via /setup.xml
    • Parallel verification with 60 workers
    • Validates and extracts device information

This approach achieves 100% device discovery reliability while maintaining fast scan times (23-30 seconds for complete networks).

Feature Comparison

MCP Server vs wemo-ops-center

Comparison of features between this MCP server and the main wemo-ops-center project:

Feature wemo-ops-center MCP Server Notes
Device Discovery ✅ UPnP + Port Scan ✅ Implemented Multi-phase discovery with 100% reliability
Device Control ✅ On/Off/Toggle ✅ Implemented Includes brightness control for dimmers
Device Status ✅ Real-time ✅ Implemented Query by name or IP address
Device Rename ✅ Friendly names ✅ Implemented Updates device cache automatically
HomeKit Codes ✅ Extract codes ✅ Implemented For HomeKit-compatible devices
Multi-subnet ✅ VLAN support ❌ Planned Currently single subnet per scan
WiFi Provisioning ✅ Smart setup ❌ Not planned Requires PC WiFi connection changes
Scheduling ✅ Time + Solar ❌ Not planned Requires persistent daemon (incompatible with MCP model)
Maintenance Tools ✅ Resets ❌ Not planned Factory reset, clear WiFi, clear data
Profile Management ✅ Save/Load ❌ Not planned WiFi credential profiles for bulk setup
User Interface ✅ GUI + Web ❌ N/A MCP uses AI assistant interface

Legend:

  • Implemented - Feature is available
  • Not planned - Feature conflicts with MCP architecture or use case
  • Planned - Feature could be added in future

Why some features aren't planned for MCP:

  • Scheduling: Requires 24/7 background daemon polling. MCP servers are typically invoked on-demand by AI assistants, not run as persistent services.
  • WiFi Provisioning: Requires changing the host PC's WiFi connection to device setup networks, which is disruptive and platform-specific.
  • Maintenance Tools: Destructive operations (factory reset, etc.) better suited for dedicated GUI with confirmation dialogs.

Current MCP Coverage: 5 of 11 core features (45%) - focused on device discovery, monitoring, and control use cases that fit the MCP model.

Development

Setup

git clone https://github.com/qrussell/wemo-ops-center.git
cd wemo-ops-center/mcp
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv sync --dev

Running Tests

# E2E tests (requires WeMo devices on network)
python tests/test_e2e.py

# Unit tests
pytest tests/test_server.py -v

Using Development Version

In your MCP client config, use:

{
  "command": "python",
  "args": ["-m", "wemo_mcp_server"],
  "env": {
    "PYTHONPATH": "/path/to/mcp/src"
  }
}

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with tests
  4. Run the test suite (python tests/test_e2e.py)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

MIT License - see LICENSE file for details.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wemo_mcp_server-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wemo_mcp_server-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file wemo_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: wemo_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wemo_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e0c95b37674b476fca2e12dbf0735f9204bae0be5c4fc005dca6dbf67320fe2
MD5 26bf7b7a080d1ea20b3fea4bedb98171
BLAKE2b-256 1072daa0ab169d1406279d7d7e2f1a4ffd6397a08a5e726c66755451637085f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for wemo_mcp_server-0.1.0.tar.gz:

Publisher: pypi-publish.yml on qrussell/wemo-ops-center

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wemo_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wemo_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa13a4ec69c3724a6e35f062897055454490ee3c061f76b3ebe5b1c2179880d7
MD5 d24698c8f5cd0919ae714e26be0255a5
BLAKE2b-256 d9b15a7c7c82ed0a8f1e51eb0bd14bb28db4e7ec0d6e56d2672ef875ede3ed92

See more details on using hashes here.

Provenance

The following attestation bundles were made for wemo_mcp_server-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on qrussell/wemo-ops-center

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page