SwitchBot

by genm

Not rated
GitHub

About

Integrates with SwitchBot devices to enable smart home automation, device control, and status monitoring using the SwitchBot API.

Details

Author
genm
Repository
genm/switchbot-mcp
License
ISC License
Categories
Other, API, Productivity, Developer Tools, Design, Workplace, AI, Search, Communication
Tags
#integration

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name SwitchBot
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @genm-dev/switchbot-mcp
    Environment
    • MCP_TRANSPORT stdio
    • SWITCHBOT_TOKEN YOUR_SWITCHBOT_TOKEN
    • SWITCHBOT_SECRET YOUR_SWITCHBOT_SECRET

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install in Cursor
Install in VS Code

These links currently target the planned public npm package. After publication,
replace SWITCHBOT_TOKEN and SWITCHBOT_SECRET with your credentials and review
the configuration before starting the server.

switchbot_list_devices

Retrieve a list of all devices connected to the SwitchBot system.

switchbot_get_device_status

Get the current status of a specific device. Parameters: device_id (string)

switchbot_set_power

Turn a device on or off. Parameters: device_id (string), power_state (boolean)

switchbot_send_command

Send a specific command to a device. Parameters: device_id (string), command (string)

switchbot_list_scenes

Retrieve a list of scenes configured in the SwitchBot system.

switchbot_execute_scene

Execute a specific scene. Parameters: scene_id (string)

switchbot_list_devices_raw

Retrieve a list of all devices with advanced, raw upstream fields.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "switchbot": {
            "env": {
                "MCP_TRANSPORT": "stdio",
                "SWITCHBOT_TOKEN": "YOUR_SWITCHBOT_TOKEN",
                "SWITCHBOT_SECRET": "YOUR_SWITCHBOT_SECRET"
            },
            "args": [
                "-y",
                "@genm-dev/switchbot-mcp"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": {
        "MCP_TRANSPORT": "stdio",
        "SWITCHBOT_TOKEN": "YOUR_SWITCHBOT_TOKEN",
        "SWITCHBOT_SECRET": "YOUR_SWITCHBOT_SECRET"
    },
    "args": [
        "-y",
        "@genm-dev/switchbot-mcp"
    ],
    "command": "npx"
}

Macos

{
    "env": {
        "MCP_TRANSPORT": "stdio",
        "SWITCHBOT_TOKEN": "YOUR_SWITCHBOT_TOKEN",
        "SWITCHBOT_SECRET": "YOUR_SWITCHBOT_SECRET"
    },
    "args": [
        "-y",
        "@genm-dev/switchbot-mcp"
    ],
    "command": "npx"
}

Windows

{
    "env": {
        "MCP_TRANSPORT": "stdio",
        "SWITCHBOT_TOKEN": "YOUR_SWITCHBOT_TOKEN",
        "SWITCHBOT_SECRET": "YOUR_SWITCHBOT_SECRET"
    },
    "args": [
        "/c",
        "npx",
        "-y",
        "@genm-dev/switchbot-mcp"
    ],
    "command": "cmd"
}

SwitchBot MCP Server v3 for AI assistants.

The source repository is public, but v3 is not yet published to npm or the official MCP Registry. The npm,npx, and one-click commands in this README become usable only after the first release tracked inIssue #7. Build from source for current evaluation.

This is an unofficial community integration and is not affiliated with or endorsed by SwitchBot. Tool calls can control physical devices and execute scenes. Review requested actions, credential access, and network exposure before use; do not treat an AI client's confirmation as an authorization boundary.

git clone https://github.com/genm/switchbot-mcp.git cd switchbot-mcp npm ci --ignore-scripts npm run build

Runnode build/index.jswith the required configuration below. The process fails closed when credentials are missing.

Package install (after the first release)

These links currently target the planned public npm package. After publication, replaceSWITCHBOT_TOKENandSWITCHBOT_SECRETwith your credentials and review the configuration before starting the server.

code --add-mcp '{"name":"switchbot","command":"npx","args":["-y","@genm-dev/switchbot-mcp"],"env":{"SWITCHBOT_TOKEN":"YOUR_SWITCHBOT_TOKEN","SWITCHBOT_SECRET":"YOUR_SWITCHBOT_SECRET","MCP_TRANSPORT":"stdio"}}'
{ "mcpServers": { "switchbot": { "command": "npx", "args": ["-y", "@genm-dev/switchbot-mcp"], "env": { "SWITCHBOT_TOKEN": "YOUR_SWITCHBOT_TOKEN", "SWITCHBOT_SECRET": "YOUR_SWITCHBOT_SECRET", "MCP_TRANSPORT": "stdio" } } } }

- v3.0.0 on the Node.js 24 LTS platform
- MCP SDK v2 with explicit MCP 2026-07-28 protocol negotiation coverage
- Nativefetchwith strict upstream response validation
- Layered architecture (SwitchBot client / MCP tools / transports)
- stdioand Streamable HTTP transports
- API key required for HTTP transport
- Same-host Origin and Host validation for HTTP deployments
- Structured MCP tool outputs (structuredContent)
- MCP risk annotations and bounded retries for read-only SwitchBot requests
- Redacted JSONL operational logs
- Public-repository CI across supported runtimes, package artifacts, and containers

- Node.js 24.15+
- SwitchBot Open API token and secret

- MCP_TRANSPORT=stdio|http(default:stdio)
- MCP_SERVER_API_KEY(required forhttp; use a high-entropy secret without surrounding whitespace)
- MCP_HTTP_HOST(default:127.0.0.1)
- MCP_HTTP_ALLOWED_HOSTS(optional comma-separated proxy/public hostnames)
- MCP_HTTP_PORT(default:8787)
- MCP_HTTP_PATH(default:/mcp)

HTTP requests with anOriginheader must use a hostname from the same allowlist as theHostheader. Localhost and the configured bind host are included automatically. Add reverse-proxy hostnames explicitly; malformed or cross-origin requests are rejected.

- SWITCHBOT_TIMEOUT_MS(default:10000)
- SWITCHBOT_LIST_CACHE_TTL_MS(default:30000)
- LOG_LEVEL=debug|info|warn|error(default:info)

- SWITCHBOT_BASE_URL(override SwitchBot API endpoint for deterministic e2e tests)

The override is accepted only whenNODE_ENV=testand the URL useslocalhost,127.0.0.0/8, or[::1]. This prevents production credentials from being redirected to another origin.
- switchbot_list_devices
- switchbot_get_device_status
- switchbot_set_power
- switchbot_send_command
- switchbot_list_scenes
- switchbot_execute_scene
- switchbot_list_devices_raw(advanced, raw upstream fields)

See migration details:docs/migration-v2-to-v3.md

stdio (package / npx, after the first release)

{ "mcpServers": { "switchbot": { "command": "npx", "args": ["-y", "@genm-dev/switchbot-mcp"], "env": { "SWITCHBOT_TOKEN": "...", "SWITCHBOT_SECRET": "...", "MCP_TRANSPORT": "stdio" } } } }
{ "mcpServers": { "switchbot": { "command": "node", "args": ["/absolute/path/to/build/index.js"], "env": { "SWITCHBOT_TOKEN": "...", "SWITCHBOT_SECRET": "...", "MCP_TRANSPORT": "stdio" } } } }
MCP_TRANSPORT=http \ MCP_SERVER_API_KEY=your_api_key \ SWITCHBOT_TOKEN=... \ SWITCHBOT_SECRET=... \ npx -y @genm-dev/switchbot-mcp

Generate the bearer credential with a cryptographically secure generator, for exampleopenssl rand -hex 32, and inject it from your secret manager. The Node server speaks plain HTTP. For any non-loopback deployment, terminate TLS at a trusted reverse proxy, restrict network access, and configure its hostname inMCP_HTTP_ALLOWED_HOSTS; do not expose the Node listener directly to the public internet.

Optional third-party integration: Smithery

Smithery is not an official distribution channel for this project. npm, the Official MCP Registry, and the direct client configurations above are the canonical installation and discovery paths.

The retained Smithery configuration uses its legacy repository format and has not been revalidated against Smithery's current MCPB/URL publication model. The command below is informational and must not be advertised as supported until it is verified separately after the first release.

npx -y @smithery/cli@latest install @genm-dev/switchbot-mcp --client claude

npm run checkincludes type-checking, linting, formatting, MCP protocol and transport tests, a build, package metadata validation, installation/execution of the packed artifact, and a validated production-dependency SBOM.npm run test:coverageenforces coverage thresholds.

When changing the Docker runtime, also run:

This verifies missing-configuration failure, HTTP authentication, MCP initialization, and the non-root runtime user.

Run this only when you want to validate real API connectivity with your own credentials.

SWITCHBOT_TOKEN=... SWITCHBOT_SECRET=... npm run test:live

- Uses real SwitchBot API (not mocked)
- Read-only checks (list_devicesandlist_scenes)
- If credentials are missing, the live test suite is skipped

Use Inspector only for local manual debugging. Do not expose it to public networks.

npx @modelcontextprotocol/inspector node build/index.js
npx @modelcontextprotocol/inspector \ -e SWITCHBOT_TOKEN=... \ -e SWITCHBOT_SECRET=... \ -e MCP_TRANSPORT=stdio \ -- node build/index.js

This repository does not pin Inspector as a dependency. Usenpxto get the latest patched release.

- The server sends SwitchBot API requests only to the fixed official API origin. The test-only override is restricted to loopback addresses.
- Device and scene lists are cached in process memory only. The server does not persist SwitchBot device data, run analytics, send telemetry, or perform automatic update checks.
- Operational logs are structured JSON on stderr. Credential-shaped fields are redacted, and API operation logs do not include device or scene identifiers.
- To uninstall, remove the MCP client/server configuration and the installed npm package or container. Remove or rotate credentials separately in the secret manager or client configuration that owns them; this server has no persistent credential store to clean up.

- CONTRIBUTING.md
-
CODE_OF_CONDUCT.md
-
GOVERNANCE.md
-
SECURITY.md
-
docs/security-model.md
-
SUPPORT.md
-
docs/github-flow.md
-
docs/release-process.md

Use secret managers as primary storage (AWS Secrets Manager,AWS SSM Parameter Store,Doppler). Environment variable injection at runtime is supported, but plaintext.envfiles are not the recommended primary workflow.

ISC. SwitchBot names and marks belong to their respective owners; the software license does not grant trademark rights.

Control smart home devices and query information by connecting large models to smart home backend APIs.

A comprehensive FastMCP 2.0 server and client for interacting with SmartThings devices, locations, rooms, modes, scenes, and automation rules through the SmartThings API.

Control SwitchBot devices interactively using the SwitchBot API.

A free, private, and secure remote MCP server for Home Assistant.

MCP server for Google Cast — discover devices, play media, control volume, launch apps, and manage queues over stdio

A safe-by-default MCP server that exposes your Control4 home automation (lights, scenes, locks, thermostats, and media) as structured tools over HTTP and Claude Desktop STDIO for reliable AI-powered control on your local network.

Control and query the status of Ecovacs cleaning robots using the MCP protocol.

A production-ready Model Context Protocol (MCP) server written in Go that wraps the Conso API, giving AI assistants like Claude direct access to your Enedis Linky smart meter data.

Control AVM FRITZ!Box routers - manage devices, WiFi, network settings, parental controls, and schedule time-delayed actions

Allows an LLM agent to control your Gaggimate espresso machine

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.