Get the FREE Ultimate OpenClaw Setup Guide →

switch-bot

SwitchBot MCP Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)

  1. Ensure Docker is running and you have token/secret values ready.
  2. 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)

  1. 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"
      }
    }
  }
}
  1. 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

Sponsor this space

Reach thousands of developers