switch-bot
SwitchBot MCP Server
claude mcp add --transport stdio yasu89-switch-bot-mcp-server docker run -i --rm --name switch-bot-mcp-server -e SWITCH_BOT_TOKEN -e SWITCH_BOT_SECRET yasu89/switch-bot-mcp-server:latest \ --env SWITCH_BOT_TOKEN="YOUR_SWITCH_BOT_TOKEN" \ --env SWITCH_BOT_SECRET="YOUR_SWITCH_BOT_SECRET"
How to use
This MCP server exposes tools to interact with SwitchBot devices through the MCP (Model Context Protocol) interface. It leverages the SwitchBotAPI to discover devices, check their statuses, and issue commands to control them. Available tools include get_switch_bot_devices for listing devices, get_switch_bot_device_status for obtaining the current state of a device, and execute_command to perform actions on a device. To use it, connect to the MCP server from your MCP client, reference the tool names, and pass the required parameters (for example, deviceId and command payload) as per the MCP tool specifications. The server authenticates via SWITCH_BOT_TOKEN and SWITCH_BOT_SECRET provided as environment variables in the container. This enables you to build interactive automations across multiple SwitchBot devices or to chain device data to drive other actions.
How to install
Prerequisites:
- Docker installed and running on your host
- SwitchBot token and secret from the SwitchBotAPI Getting Started guide
- Access to the internet to pull the Docker image
Option 1: Run with Docker (recommended)
- Ensure Docker is running and you have token/secret values ready.
- Run the container (fill in your tokens):
docker run -i --rm --name switch-bot-mcp-server \
-e SWITCH_BOT_TOKEN="YOUR_SWITCH_BOT_TOKEN" \
-e SWITCH_BOT_SECRET="YOUR_SWITCH_BOT_SECRET" \
yasu89/switch-bot-mcp-server:latest
Option 2: Integrate into MCP config file (example shown in README)
- Save the following snippet into your MCP configuration file under mcpServers.switchbot (adjust tokens as needed):
{
"mcpServers": {
"switchbot": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--name",
"switch-bot-mcp-server",
"-e",
"SWITCH_BOT_TOKEN",
"-e",
"SWITCH_BOT_SECRET",
"yasu89/switch-bot-mcp-server:latest"
],
"env": {
"SWITCH_BOT_TOKEN": "YOUR_SWITCH_BOT_TOKEN",
"SWITCH_BOT_SECRET": "YOUR_SWITCH_BOT_SECRET"
}
}
}
}
- Start your MCP runner which will in turn start the Docker container as configured.
Additional notes
Tips and notes:
- Ensure the SWITCH_BOT_TOKEN and SWITCH_BOT_SECRET are kept secure and not checked into version control.
- If you run into connectivity issues, verify that your Docker container has network access to SwitchBot services and that the token/secret are valid.
- The available tools (get_switch_bot_devices, get_switch_bot_device_status, execute_command) can be combined in MCP flows to automate multi-device scenarios.
- If you need to run multiple devices or groups, consider creating multiple tool invocations and aggregating results within your MCP client.
- When using the docker approach, you can override env values at runtime if needed, or bind them via a file-based env approach for easier management.
Related MCP Servers
weather
A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. Discuss on Hacker News:
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
github-brain
An experimental GitHub MCP server with local database.
mcp-tts
MCP Server for Text to Speech
tasker
An MCP server for Android's Tasker automation app.
kai
An MCP Server for Kubernetes