Plugwise MCP Server
Enables control and monitoring of Plugwise smart home devices including thermostats, switches, and energy meters with automatic network discovery. Supports temperature control, energy monitoring, and multi-hub management through natural language commands.
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:
npm install -g plugwise-mcp-server
Or use directly with npx (no installation needed):
npx plugwise-mcp-server
Installation from Source
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:
# Test all read operations
npm run test:read-only -- --mock
# Test protocol features
npm run test:features -- --mock
Or with real hardware:
# 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:
plugwise-mcp-server
When running from source:
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.
{
"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.
{
"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):
{
"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:
{
"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:
{
"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:
{
"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:
# 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
# Automatically discover and connect to your hubs
node scripts/workflow-demo.js
📡 MCP Tools
Network Discovery
scan_network
Automatically scan your network for Plugwise hubs using passwords from .env.
await mcpClient.callTool('scan_network', {});
// Returns: { discovered: [ { name, ip, model, firmware } ], scanned_ips: 2 }
Features:
- Tests known IPs first if
HUBxIPvariables are provided (instant) - Falls back to full network scan if needed (1-2 minutes)
- Stores credentials automatically for later use
connect
Connect to a Plugwise gateway. After scanning, credentials are automatic!
// Auto-connect to first discovered hub
await mcpClient.callTool('connect', {});
// Connect to specific hub (password from scan)
await mcpClient.callTool('connect', { host: '192.168.1.100' });
// Manual connection (without scanning)
await mcpClient.callTool('connect', {
host: '192.168.1.100',
password: 'abc12345'
});
Device Management
get_devices
Get all devices and their current states.
const result = await mcpClient.callTool('get_devices', {});
// Returns all devices, zones, sensors, and their current values
Climate Control
set_temperature
Set thermostat temperature setpoint.
await mcpClient.callTool('set_temperature', {
location_id: 'zone123',
setpoint: 21.0
});
set_preset
Change thermostat preset mode.
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.
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 modedelete_notification: Clear gateway notificationsreboot_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
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
node scripts/workflow-demo.js
This demonstrates:
- ✅ Network scanning with .env passwords
- ✅ Auto-connection without credentials
- ✅ Device discovery and listing
- ✅ Multi-hub management
Network Scanning Test
node scripts/test-network-scan.js
Full MCP Test Suite
node scripts/test-mcp-server.js
Bash Script for Hub Discovery
./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
- Setup Guide - Detailed setup instructions
- MCP Server Documentation - Complete API reference
- Network Scanning Guide - Network discovery deep dive
- Network Scanning Summary - Feature overview
🔧 Development
Development Mode
Run with hot-reload:
npm run dev
Build
Compile TypeScript to JavaScript:
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
- Password Storage: Store passwords in
.envfile only (never in code) - Git Ignore:
.envis in.gitignoreto prevent committing secrets - 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
- API Access: The API has full control over your heating system - restrict access accordingly
🐛 Troubleshooting
No Hubs Found During Scan
- Check
.envfile hasHUB1,HUB2, etc. defined - Verify passwords are correct (case-sensitive, check gateway sticker)
- Ensure gateways are powered on and connected to network
- Confirm you're on the same network as the hubs
- Try:
ping <gateway_ip>to test connectivity
Connection Errors
- Verify IP address is correct
- Check firewall isn't blocking port 80
- Test with manual connection:
curl http://<ip>/core/domain_objects - Ensure gateway isn't overloaded with requests
Scan Takes Too Long
- Add
HUBxIPvariables to.envfor instant scanning - Specify network:
scan_network({ network: '192.168.1.0/24' }) - Check network size (scanning /16 is much slower than /24)
🤝 Integration Examples
Using with Claude Code
claude mcp add --transport http plugwise-server http://localhost:3000/mcp
Using with VS Code Copilot
Add to .vscode/mcp.json:
{
"mcpServers": {
"plugwise": {
"type": "http",
"url": "http://localhost:3000/mcp"
}
}
}
Using MCP Inspector
npx @modelcontextprotocol/inspector
Connect to: http://localhost:3000/mcp
📊 Example Workflows
Morning Routine
// Scan and connect
await mcpClient.callTool('scan_network', {});
await mcpClient.callTool('connect', {});
// 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
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
// Discover all hubs
const scan = await mcpClient.callTool('scan_network', {});
// Get devices from each hub
for (const hub of scan.discovered) {
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
- Structure Migration Plan - Complete plan for restructuring project
- Structure Comparison - Visual comparison of architectures
- Migration Checklist - Step-by-step migration checklist
- Migration Summary - Quick reference summary
Architecture & Design
- Architecture Diagram - System architecture overview
- Code Organization - Project structure and conventions
- Reorganization Overview - Historical reorganization notes
Implementation Guides
- Autoload Hubs - Automatic hub loading implementation
- Network Scanning - Network discovery implementation
- Temperature Tools - Temperature control features
- Sensor & Switch Parsing - Device parsing logic
Quick References
- Quick Reference - Common commands and patterns
- Autoload Quick Reference - Autoload feature guide
- Temperature Tools Quick Reference - Temperature API guide
Testing & Development
- Quick Test Guide - Fast start testing guide
- Test Scripts Documentation - Comprehensive testing documentation
- Test All Script - HTTP-based testing guide
- Multi-Hub Testing - Testing with multiple hubs
- List Devices Script - Device enumeration guide
Publishing & Setup
- Publishing Guide - How to publish to npm
- Setup Guide - Initial setup instructions
- Publish Checklist - Pre-publish verification
🌟 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。