Switchr MCP Server
Allows monitoring and controlling SwitchBot devices (temperature sensors, plugs, bots) directly from Home Assistant via MCP server with HTTP/SSE transport.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Switchr MCP Server Show me all my SwitchBot devices"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Switchr MCP Server
A Node.js MCP (Model Context Protocol) server that exposes SwitchBot temperature sensors for monitoring via Claude Desktop or Home Assistant.
Features
Device Discovery: Automatically discovers all SwitchBot devices (Meter, MeterPlus, WoIOSensor, Plug Mini, Bot)
Temperature Monitoring: Read temperature and humidity from any sensor
Energy Monitoring: Read power, voltage, and current from Plug Mini devices (UPS/load monitoring)
Switching: Turn plugs on/off, press Bot finger simulators
Flexible Units: Support for both Fahrenheit and Celsius
Device Lookup: Find devices by ID or nickname (case-insensitive)
Dual Transport: Supports both stdio (Claude Desktop) and HTTP/SSE (Home Assistant)
Request Logging: Optional logging of all tool calls for debugging
Related MCP server: Homey MCP Server
Installation
cd switchr-mcp
npm installConfiguration
SwitchBot Credentials
SwitchBot API credentials are managed by @caseman72/switchr-api via .env.local. The file is searched in:
Current working directory
~/.config/switchr-api/.env.local~/.switchbot.env.local
Create a .env.local file with your SwitchBot credentials:
SWITCHBOT_TOKEN=your-switchbot-token
SWITCHBOT_SECRET=your-switchbot-secretVisit the SwitchBot Developer Portal to obtain your API credentials.
Server Configuration (Optional)
Copy config.example.json to config.json to customize server settings:
{
"server": {
"transport": "stdio",
"httpPort": 8001,
"httpHost": "127.0.0.1"
},
"devices": {
"refreshIntervalMinutes": 60
},
"monitoring": {
"enabled": false,
"logFile": "./switchr-mcp-requests.log"
}
}Usage
stdio Transport (Claude Desktop)
node src/index.jsHTTP Transport (Home Assistant)
The HA custom component requires the MCP server to be exposed over HTTP/SSE. Use mcp-proxy to bridge the stdio server.
Install mcp-proxy
brew install mcp-proxyStart the proxy
# Binds to all interfaces so Docker can reach it
mcp-proxy --port 8082 --host 0.0.0.0 -- node /path/to/switchr-mcp/src/index.jsHome Assistant Integration
Copy the custom component to your HA config directory:
cp -r custom_components/switchr_mcp ~/.home-assistant/custom_components/Restart Home Assistant
Add the integration: Settings → Devices & Services → Add Integration → "Switchr MCP"
Enter connection details:
Host:
host.docker.internal(for Docker) or your Mac's IPPort:
8082
Entities created
Temperature sensors (
Meter,MeterPlus,WoIOSensor): one combined entity per device with temperature as the native value and humidity/battery as attributes.Plug Mini: four sensors plus a switch —
<name> Power(W),<name> Voltage(V),<name> Current(mA),<name> Energy(kWh), andswitch.<name>(on/off control). The Energy entity integrates instantaneous power between polls and persists across HA restarts viaRestoreEntity, so it can be used directly in the HA Energy dashboard with no Riemann helper.Bot (finger simulator):
button.<name>_press— sends a momentary press (extend then retract). Suitable forpressModeBots.
Auto-start mcp-proxy with launchd
Create ~/Library/LaunchAgents/com.switchr.mcp-proxy.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.switchr.mcp-proxy</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/mcp-proxy</string>
<string>--port</string>
<string>8082</string>
<string>--host</string>
<string>0.0.0.0</string>
<string>--</string>
<string>/opt/homebrew/bin/node</string>
<string>/path/to/switchr-mcp/src/index.js</string>
</array>
<key>WorkingDirectory</key>
<string>/path/to/switchr-mcp</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/switchr-mcp-proxy.log</string>
<key>StandardErrorPath</key>
<string>/tmp/switchr-mcp-proxy.err</string>
</dict>
</plist>Then load it:
launchctl load ~/Library/LaunchAgents/com.switchr.mcp-proxy.plistTo stop/unload:
launchctl unload ~/Library/LaunchAgents/com.switchr.mcp-proxy.plistManaging the service
# Check status
launchctl list | grep switchr
# View logs
tail -f /tmp/switchr-mcp-proxy.err
# Restart
launchctl unload ~/Library/LaunchAgents/com.switchr.mcp-proxy.plist
launchctl load ~/Library/LaunchAgents/com.switchr.mcp-proxy.plist
# Stop
launchctl unload ~/Library/LaunchAgents/com.switchr.mcp-proxy.plistClaude Desktop Integration
Add to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"switchr": {
"command": "node",
"args": ["/path/to/switchr-mcp/src/index.js"],
"env": {}
}
}
}MCP Tools
list_devices
List all discovered SwitchBot devices. Optionally filter to show only temperature sensors.
Parameters:
sensorsOnly(optional): If true, only return temperature sensors (Meter, MeterPlus, WoIOSensor)refresh(optional): Force refresh device list from SwitchBot API
get_device_status
Get detailed status of any SwitchBot device. Returns device-specific properties like power state, battery level, etc.
Parameters:
deviceId: Device ID or device name
get_temperature
Get temperature and humidity reading from a specific SwitchBot temperature sensor.
Parameters:
deviceId: Device ID or device name of the temperature sensorunit(optional): Temperature unit -Ffor Fahrenheit (default),Cfor Celsius
Response includes:
temperature: Current temperature in requested unithumidity: Current humidity percentagebattery: Battery level percentage
get_all_temperatures
Get temperature and humidity readings from all SwitchBot temperature sensors at once.
Parameters:
unit(optional): Temperature unit -Ffor Fahrenheit (default),Cfor Celsius
get_plug_status
Get power state and energy data from a SwitchBot Plug Mini. Use for UPS/energy monitoring.
Parameters:
deviceId: Device ID or device name of the plug
Response includes:
power:"on"or"off"voltage: Voltswatts: Instantaneous power draw (W)currentMilliamps: Current draw (mA)electricityOfDay: Today's on-time accumulator from the device
get_all_plugs
Get power and energy readings from all SwitchBot Plug Mini devices at once.
turn_on / turn_off
Turn a SwitchBot Plug Mini (or a Bot in switch mode) on/off.
Parameters:
deviceId: Device ID or device name
press_bot
Send a momentary press to a SwitchBot Bot (finger simulator). The finger extends then retracts.
Parameters:
deviceId: Device ID or device name of the Bot
get_api_status
Get SwitchBot API rate limit status. Returns remaining calls, reset time, and cache info.
Response includes:
rate_limit.remaining: API calls remainingrate_limit.reset_by: When the rate limit resetscache.last_refresh: When devices were last refreshedcache.device_count: Total devices discoveredcache.sensor_count: Temperature sensors discovered
Request Monitoring
Enable request logging in config.json:
{
"monitoring": {
"enabled": true,
"logFile": "./switchr-mcp-requests.log"
}
}Logs are written in JSON Lines format with timestamps, tool names, parameters, and results.
License
MIT
Available Tools
10 toolsget_all_plugsA
Get power and energy readings from all SwitchBot Plug Mini devices at once.
Inputs: no named parameters.
get_all_temperaturesA
Get temperature and humidity readings from all SwitchBot temperature sensors at once.
Inputs: unit.
get_api_statusA
Get SwitchBot API rate limit status. Returns remaining calls and reset time.
Inputs: no named parameters.
get_device_statusB
Get detailed status of any SwitchBot device. Returns device-specific properties like power state, battery level, etc.
Inputs: deviceId (required).
get_plug_statusA
Get power state and energy data (voltage, watts, current) from a SwitchBot Plug Mini. Use for UPS/energy monitoring.
Inputs: deviceId (required).
get_temperatureA
Get temperature and humidity reading from a specific SwitchBot temperature sensor.
Inputs: deviceId (required), unit.
list_devicesB
List all discovered SwitchBot devices. Optionally filter to show only temperature sensors.
Inputs: refresh, sensorsOnly.
press_botA
Send a momentary press to a SwitchBot Bot (finger simulator). The finger extends then retracts.
Inputs: deviceId (required).
turn_offA
Turn off a SwitchBot Plug Mini or a Bot in switch mode.
Inputs: deviceId (required).
turn_onA
Turn on a SwitchBot Plug Mini or a Bot in switch mode.
Inputs: deviceId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools are clearly tied to distinct resources and actions, such as discovery, individual status, batch reads, and control. The only minor overlap is between get_device_status and the specialized get_temperature/get_plug_status tools, but the descriptions make the specialized use cases clear.
All tools follow a predictable lowercase snake_case verb_noun pattern: list_*, get_*, turn_on/_off, press_bot, and get_ap_i_status. There are no mixed conventions or vague verbs, making the naming highly consistent.
Ten tools is well-scoped for a smart home device server. Each tool serves a clear purpose without unnecessary bloat or a thin surface.
The tool set covers device discovery, detailed status, specialized temperature and plug readings, on/off control, Bot pressing, and API rate-limit checks. No critical workflows for the advertised SwitchBot device types are missing.
Related MCP Connectors
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
Read your tracked time and projects, pause tracking or add a note, from Claude or ChatGPT.
Manage your IoT device fleet directly from Claude. Create device templates with datastreams and events, provision new devices, read live sensor data, and control outputs. The Blynk connector integrates with the Blynk IoT platform, enabling direct configuration and monitoring of connected devices and infrastructure.
Control your existing Philips lights, Sonos speakers, Roborock vacuums and other supported devices through Port OS cloud. Give ChatGPT, Claude and other MCP-compatible assistants access to the devices you connect. Turn off the living room lights, play music on your speakers, adjust the thermostat, run a vacuum in a room, check a camera snapshot or find a connected tracker. Available actions depend on your linked provider accounts and each device’s supported capabilities. Port OS runs in the cloud; no local server is required. You choose the account, device and capability permissions each assistant receives. Device operations require user OAuth; public tool discovery does not grant device access. Port OS is in alpha. Setup: https://portoperatingsystem.com/docs/getting-started/ Support: https://portoperatingsystem.com/contact/
Related MCP Servers
- AlicenseCqualityFmaintenanceEnables AI assistants to control SwitchBot devices, providing functionalities like device management, scene execution, and sensor information monitoring through the SwitchBot API.37ISC
- AlicenseNot gradedqualityDmaintenanceEnables Claude AI to control and manage Homey Pro smart home devices, flows, and analytics through natural language.12MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to read and control Home Assistant devices via natural language, with configurable safety restrictions on sensitive actions.3MIT
- AlicenseNot gradedqualityDmaintenanceIntegrates Claude AI with Home Assistant to control smart home devices via natural language.156 npmMIT