Plugwise MCP Server

Plugwise MCP Server

TypeScript-based Model Context Protocol server for Plugwise smart home integration.

0
Stars
1
Forks
0
Watchers
0
Issues
Plugwise MCP Server is a TypeScript-based server that implements the Model Context Protocol (MCP) for integrating Plugwise smart home devices. It enables automatic discovery and secure management of Plugwise hubs, provides control over thermostats, switches, and smart plugs, and supports real-time device updates and energy monitoring. Designed for compatibility with popular MCP clients such as Claude Desktop, Cline, Cursor, and VS Code Copilot via standard I/O transport, it offers robust support for multiple hubs and both mock and real hardware environments.

Key Features

Automatic network scanning for Plugwise hubs
Secure credential management via .env files
Control of thermostats, switches, and smart plugs
Temperature scheduling and presets
Real-time updates of device states and measurements
Energy consumption monitoring
Multi-hub management
Supports mock and real hardware environments
Standard I/O (stdio) MCP support for various clients
Easy installation via npm or npx

Use Cases

Integrating Plugwise devices with AI-powered assistant tools
Automating home climate and energy management
Monitoring real-time energy consumption from multiple gateways
Centralized control of thermostats and smart plugs
Developing custom MCP clients for Plugwise networks
Running automated tests on smart home configurations without hardware
Expanding existing smart home automation setups
Managing credentials and hub access securely
Providing standardized smart home connectivity via MCP protocol
Supporting developers in prototyping or deploying Plugwise integrations

README

Plugwise MCP Server

A TypeScript-based Model Context Protocol (MCP) server for Plugwise smart home integration with automatic network discovery.

โœจ Key Features

  • ๐Ÿ” Automatic Network Scanning: Discovers all Plugwise hubs on your network
  • ๐Ÿ” Credential Management: Stores hub passwords securely from .env file
  • ๐Ÿ”Œ Device Control: Control thermostats, switches, and smart plugs
  • ๐ŸŒก๏ธ Temperature Management: Set temperatures, presets, and schedules
  • ๐Ÿ“Š Energy Monitoring: Read power consumption and sensor data
  • ๐Ÿ  Multi-Hub Support: Manage multiple gateways simultaneously
  • ๐Ÿ”„ Real-time Updates: Get current device states and measurements

๐Ÿš€ Quick Start

Installation via npm (Recommended)

Install globally to use with any MCP client:

bash
npm install -g plugwise-mcp-server

Or use directly with npx (no installation needed):

bash
npx plugwise-mcp-server

Installation from Source

bash
git clone https://github.com/Tommertom/plugwise-mcp-server.git
cd plugwise-mcp-server
npm install
npm run build

Prerequisites

  • Node.js 17 or higher
  • npm or yarn
  • Plugwise gateway (Adam, Anna, Smile P1, or Stretch)

Quick Test

Test the installation without real hardware using mock mode:

bash
# Test all read operations
npm run test:read-only -- --mock

# Test protocol features
npm run test:features -- --mock

Or with real hardware:

bash
# Set up gateway credentials
echo "PLUGWISE_HOST=192.168.1.100" > .env
echo "PLUGWISE_PASSWORD=your-gateway-password" >> .env

# Run tests
npm run test:read-only

See Quick Test Guide for more options.

Start the Server

When installed via npm:

bash
plugwise-mcp-server

When running from source:

bash
npm start

Server runs at:

  • MCP Endpoint: http://localhost:3000/mcp
  • Health Check: http://localhost:3000/health

๐Ÿ”Œ Adding the MCP Server to Your Client

The Plugwise MCP server can work with any MCP client that supports standard I/O (stdio) as the transport medium. Here are specific instructions for some popular tools:

Claude Desktop

To configure Claude Desktop to use the Plugwise MCP server, edit the claude_desktop_config.json file. You can open or create this file from the Claude > Settings menu. Select the Developer tab, then click Edit Config.

json
{
  "mcpServers": {
    "plugwise": {
      "command": "npx",
      "args": ["-y", "plugwise-mcp-server@latest"],
      "env": {
        "HUB1": "abc12345",
        "HUB1IP": "192.168.1.100",
        "HUB2": "def67890",
        "HUB2IP": "192.168.1.101"
      }
    }
  }
}

Cline

To configure Cline to use the Plugwise MCP server, edit the cline_mcp_settings.json file. You can open or create this file by clicking the MCP Servers icon at the top of the Cline pane, then clicking the Configure MCP Servers button.

json
{
  "mcpServers": {
    "plugwise": {
      "command": "npx",
      "args": ["-y", "plugwise-mcp-server@latest"],
      "disabled": false,
      "env": {
        "HUB1": "abc12345",
        "HUB1IP": "192.168.1.100",
        "HUB2": "def67890",
        "HUB2IP": "192.168.1.101"
      }
    }
  }
}

Cursor

To configure Cursor to use the Plugwise MCP server, edit either the file .cursor/mcp.json (to configure only a specific project) or the file ~/.cursor/mcp.json (to make the MCP server available in all projects):

json
{
  "mcpServers": {
    "plugwise": {
      "command": "npx",
      "args": ["-y", "plugwise-mcp-server@latest"],
      "env": {
        "HUB1": "abc12345",
        "HUB1IP": "192.168.1.100",
        "HUB2": "def67890",
        "HUB2IP": "192.168.1.101"
      }
    }
  }
}

Visual Studio Code Copilot

To configure a single project, edit the .vscode/mcp.json file in your workspace:

json
{
  "servers": {
    "plugwise": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "plugwise-mcp-server@latest"],
      "env": {
        "HUB1": "abc12345",
        "HUB1IP": "192.168.1.100",
        "HUB2": "def67890",
        "HUB2IP": "192.168.1.101"
      }
    }
  }
}

To make the server available in every project you open, edit your user settings:

json
{
  "mcp": {
    "servers": {
      "plugwise": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "plugwise-mcp-server@latest"],
        "env": {
          "HUB1": "abc12345",
          "HUB1IP": "192.168.1.100",
          "HUB2": "def67890",
          "HUB2IP": "192.168.1.101"
        }
      }
    }
  }
}

Windsurf Editor

To configure Windsurf Editor, edit the file ~/.codeium/windsurf/mcp_config.json:

json
{
  "mcpServers": {
    "plugwise": {
      "command": "npx",
      "args": ["-y", "plugwise-mcp-server@latest"],
      "env": {
        "HUB1": "abc12345",
        "HUB1IP": "192.168.1.100",
        "HUB2": "def67890",
        "HUB2IP": "192.168.1.101"
      }
    }
  }
}

Environment Variables

The server reads hub passwords from environment variables. You can provide these in two ways:

Option 1: MCP Configuration (Recommended) Add the env field directly to your MCP client configuration as shown in the examples above.

Option 2: .env File Create a .env file in your project root or set system-wide environment variables:

env
# Hub passwords (8-character codes from gateway stickers)
HUB1=abc12345
HUB2=def67890

# Optional: Known IP addresses for faster discovery and auto-loading
HUB1IP=192.168.1.100
HUB2IP=192.168.1.101

Security Note: When using the MCP configuration env field, credentials are passed securely to the server process. For enhanced security, consider using .env files which are typically excluded from version control.

Quick Test

bash
# Automatically discover and connect to your hubs
node scripts/workflow-demo.js

๐Ÿ“ก MCP Tools

Network Discovery

connect

Connect to a Plugwise gateway.

javascript
// Connect to specific hub
await mcpClient.callTool('connect', { host: '192.168.1.100' });

// Manual connection
await mcpClient.callTool('connect', { 
  host: '192.168.1.100', 
  password: 'abc12345' 
});

Device Management

get_devices

Get all devices and their current states.

javascript
const result = await mcpClient.callTool('get_devices', {});
// Returns all devices, zones, sensors, and their current values

Climate Control

set_temperature

Set thermostat temperature setpoint.

javascript
await mcpClient.callTool('set_temperature', {
  location_id: 'zone123',
  setpoint: 21.0
});

set_preset

Change thermostat preset mode.

javascript
await mcpClient.callTool('set_preset', {
  location_id: 'zone123',
  preset: 'away'  // Options: home, away, sleep, vacation
});

Device Control

control_switch

Turn switches/plugs on or off.

javascript
await mcpClient.callTool('control_switch', {
  appliance_id: 'plug123',
  state: 'on'  // 'on' or 'off'
});

Gateway Management

  • set_gateway_mode: Set gateway mode (home, away, vacation)
  • set_dhw_mode: Set domestic hot water mode (auto, boost, comfort, off)
  • set_regulation_mode: Set heating regulation mode
  • delete_notification: Clear gateway notifications
  • reboot_gateway: Reboot the gateway (use with caution)

MCP Resources

  • plugwise://devices: Access current state of all devices as a resource

MCP Prompts

  • setup_guide: Get comprehensive step-by-step setup instructions

๐Ÿงช Testing

Comprehensive Read-Only Test Suite

bash
npm run test:all

This runs a complete test of all read-only MCP operations:

  • โœ… Server health check
  • โœ… MCP protocol initialization
  • โœ… Network scanning for hubs
  • โœ… Gateway connection and info retrieval
  • โœ… Device state reading
  • โœ… Resources and prompts

Safe: Only tests read operations, never changes device states.

See Test Documentation for details.

Complete Workflow Demo

bash
node scripts/workflow-demo.js

This demonstrates:

  1. โœ… Network scanning with .env passwords
  2. โœ… Auto-connection without credentials
  3. โœ… Device discovery and listing
  4. โœ… Multi-hub management

Network Scanning Test

bash
node scripts/test-network-scan.js

Full MCP Test Suite

bash
node scripts/test-mcp-server.js

Bash Script for Hub Discovery

bash
./scripts/find-plugwise-hub.sh

๐Ÿ—๏ธ Supported Devices

Gateways

  • Adam: Smart home hub with OpenTherm support (thermostat control, floor heating)
  • Anna: Standalone thermostat gateway
  • Smile P1: Energy monitoring gateway (electricity, gas, solar)
  • Stretch: Legacy hub for connecting Circle smart plugs

Connected Devices

  • Jip: Motion sensor with illuminance detection
  • Lisa: Radiator valve (requires hub)
  • Tom/Floor: Floor heating controller
  • Koen: Radiator valve (requires a Plug as intermediary)
  • Plug: Smart plug with power monitoring (Zigbee)
  • Aqara Plug: Third-party Zigbee smart plug
  • Circle: Legacy Circle/Circle+ plugs (via Stretch only)

๐Ÿ“– Documentation

๐Ÿ”ง Development

Development Mode

Run with hot-reload:

bash
npm run dev

Build

Compile TypeScript to JavaScript:

bash
npm run build

Project Structure

plugwise/
โ”œโ”€โ”€ src/mcp/              # TypeScript source
โ”‚   โ”œโ”€โ”€ server.ts         # MCP server with tools
โ”‚   โ”œโ”€โ”€ plugwise-client.ts # Plugwise API client
โ”‚   โ””โ”€โ”€ plugwise-types.ts  # Type definitions
โ”œโ”€โ”€ build/mcp/            # Compiled JavaScript
โ”œโ”€โ”€ docs/                 # Documentation
โ”œโ”€โ”€ scripts/              # Test scripts
โ”‚   โ”œโ”€โ”€ workflow-demo.js
โ”‚   โ”œโ”€โ”€ test-network-scan.js
โ”‚   โ”œโ”€โ”€ test-mcp-server.js
โ”‚   โ””โ”€โ”€ find-plugwise-hub.sh
โ”œโ”€โ”€ .env                  # Hub credentials
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ tsconfig.json

๐Ÿ” Security

  1. Password Storage: Store passwords in .env file only (never in code)
  2. Git Ignore: .env is in .gitignore to prevent committing secrets
  3. Network Security: Plugwise uses HTTP Basic Auth (not HTTPS)
    • Keep gateways on secure local network
    • Use VPN for remote access
    • Consider separate VLAN for IoT devices
  4. API Access: The API has full control over your heating system - restrict access accordingly

๐Ÿ› Troubleshooting

No Hubs Found During Scan

  1. Check .env file has HUB1, HUB2, etc. defined
  2. Verify passwords are correct (case-sensitive, check gateway sticker)
  3. Ensure gateways are powered on and connected to network
  4. Confirm you're on the same network as the hubs
  5. Try: ping <gateway_ip> to test connectivity

Connection Errors

  1. Verify IP address is correct
  2. Check firewall isn't blocking port 80
  3. Test with manual connection: curl http://<ip>/core/domain_objects
  4. Ensure gateway isn't overloaded with requests

๐Ÿค Integration Examples

Using with Claude Code

bash
claude mcp add --transport http plugwise-server http://localhost:3000/mcp

Using with VS Code Copilot

Add to .vscode/mcp.json:

json
{
  "mcpServers": {
    "plugwise": {
      "type": "http",
      "url": "http://localhost:3000/mcp"
    }
  }
}

Using MCP Inspector

bash
npx @modelcontextprotocol/inspector

Connect to: http://localhost:3000/mcp

๐Ÿ“Š Example Workflows

Morning Routine

javascript
// Connect to hub
await mcpClient.callTool('connect', { host: '192.168.1.100' });

// Set home mode
await mcpClient.callTool('set_preset', {
  location_id: 'living_room',
  preset: 'home'
});

// Warm up bathroom
await mcpClient.callTool('set_temperature', {
  location_id: 'bathroom',
  setpoint: 22.0
});

Energy Monitoring

javascript
const devices = await mcpClient.callTool('get_devices', {});

for (const [id, device] of Object.entries(devices.data)) {
  if (device.sensors?.electricity_consumed) {
    console.log(`${device.name}: ${device.sensors.electricity_consumed}W`);
  }
}

Multi-Hub Management

javascript
// List all hubs
const hubsList = await mcpClient.callTool('list_hubs', {});

// Get devices from each hub
for (const hub of hubsList.hubs) {
  await mcpClient.callTool('connect', { host: hub.ip });
  const devices = await mcpClient.callTool('get_devices', {});
  console.log(`Hub ${hub.ip}: ${Object.keys(devices.data).length} devices`);
}

๐Ÿ“š Documentation

Migration Guides

Architecture & Design

Implementation Guides

Quick References

Testing & Development

Publishing & Setup

๐ŸŒŸ Credits

Based on the excellent python-plugwise library.

Architectural patterns inspired by sonos-ts-mcp.

๐Ÿ“„ License

MIT License - See LICENSE file for details

๐Ÿš€ Version

Current version: 1.0.2

  • โœ… Full MCP protocol support
  • โœ… Automatic network scanning
  • โœ… Multi-hub management
  • โœ… Complete device control
  • โœ… Comprehensive documentation
  • โœ… Structure migration planning

Star History

Star History Chart

Repository Owner

Tommertom
Tommertom

User

Repository Details

Language TypeScript
Default Branch main
Size 324 KB
Contributors 1
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

TypeScript
85.54%
JavaScript
14.46%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • mcp-cli

    mcp-cli

    A command-line inspector and client for the Model Context Protocol

    mcp-cli is a command-line interface tool designed to interact with Model Context Protocol (MCP) servers. It allows users to run and connect to MCP servers from various sources, inspect available tools, resources, and prompts, and execute commands non-interactively or interactively. The tool supports OAuth for various server types, making integration and automation seamless for developers working with MCP-compliant servers.

    • โญ 391
    • MCP
    • wong2/mcp-cli
  • ws-mcp

    ws-mcp

    WebSocket bridge for MCP stdio servers.

    ws-mcp wraps Model Context Protocol (MCP) stdio servers with a WebSocket interface, enabling seamless integration with web-based clients and tools. It allows users to configure and launch multiple MCP servers via a flexible configuration file or command-line arguments. The tool is designed to be compatible with services such as wcgw, fetch, and other MCP-compliant servers, providing standardized access to system operations, HTTP requests, and more. Integration with tools like Kibitz enables broader applications in model interaction workflows.

    • โญ 19
    • MCP
    • nick1udwig/ws-mcp
  • FastMCP

    FastMCP

    TypeScript framework for building robust MCP servers with minimal setup.

    FastMCP is a TypeScript framework designed for building servers that adhere to the Model Context Protocol (MCP), enabling efficient management of client sessions and context. It streamlines the creation of MCP servers by providing intuitive APIs, built-in authentication, session and request tracking, and support for handling various content types such as images and audio. The framework also enforces best practices around error handling, logging, and streaming outputs. Developers benefit from reduced boilerplate and a focus on core MCP functionality.

    • โญ 2,738
    • MCP
    • punkpeye/fastmcp
  • MCP Manager for Claude Desktop

    MCP Manager for Claude Desktop

    A desktop app to manage Model Context Protocol (MCP) servers for Claude Desktop on MacOS.

    MCP Manager for Claude Desktop provides a user-friendly interface to manage Model Context Protocol (MCP) servers, enabling Claude to access private data, APIs, and local or remote services securely from a MacOS desktop. It facilitates rapid configuration and integration with a wide variety of MCP servers, including productivity tools, databases, and web APIs. The app runs locally to ensure data privacy and streamlines connecting Claude to new sources through simple environment and server settings management.

    • โญ 270
    • MCP
    • zueai/mcp-manager
  • Firefly MCP Server

    Firefly MCP Server

    Seamless resource discovery and codification for Cloud and SaaS with Model Context Protocol integration.

    Firefly MCP Server is a TypeScript-based server implementing the Model Context Protocol to enable integration with the Firefly platform for discovering and managing resources across Cloud and SaaS accounts. It supports secure authentication, resource codification into infrastructure as code, and easy integration with tools such as Claude and Cursor. The server can be configured via environment variables or command line and communicates using standardized MCP interfaces. Its features facilitate automation and codification workflows for cloud resource management.

    • โญ 15
    • MCP
    • gofireflyio/firefly-mcp
  • mcp-server-home-assistant

    mcp-server-home-assistant

    A Model Context Protocol Server integration for Home Assistant.

    Provides an MCP server interface for Home Assistant, enabling context sharing between Home Assistant and AI models through the Model Context Protocol. Allows users to connect Claude Desktop and similar tools to Home Assistant via a WebSocket API and secure API token. Facilitates seamless integration by leveraging a custom Home Assistant component that is migrating into Home Assistant Core. Enables access and manipulation of smart home context data in standardized ways.

    • โญ 64
    • MCP
    • allenporter/mcp-server-home-assistant
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results