Control your Alexa devices and smart home from the command line or AI assistants.
MCP server and CLI for Alexa/Echo devices and smart home control via the unofficial Alexa API. Works with Claude Desktop, Cursor, VS Code, and other MCP-compatible tools.
- ποΈ Voice & Media Control - TTS, announcements, playback control
- π‘ Smart Home - Control lights, plugs, and devices by name, pattern, or room group
- β State Verification - Every control command returns live device state (power, brightness, colour temp)
- π Device Status - Query current state of any device by name without issuing a command
- π Group Membership - List all devices in a room group for post-action verification
- π€ Routines - List and run routines by name, partial name, or automation ID
- π Multi-Region - Supports US (amazon.com), UK (amazon.co.uk), and DE (amazon.de)
- π MCP Integration - Use with Claude, Cursor, and other AI assistants
- π οΈ CLI & Programmatic - Command-line tool or Node.js library
# Global install (recommended for CLI usage)
npm install -g alexa-mcp
# Or use without installing
npx alexa-mcp authInteractive (browser-based):
alexa-mcp authOpens a URL for you to log in to Amazon. Works locally or on remote servers using automatic tunneling (cloudflared or localtunnel).
Headless (token-based):
alexa-mcp auth --token "Atnr|..."
alexa-mcp auth --token-file /path/to/token.txt
alexa-mcp auth --domain amazon.com # US account (default: amazon.co.uk)Configuration is stored in ~/.alexa-mcp/config.json.
Authentication:
alexa-mcp auth # Interactive auth
alexa-mcp auth status [--verify] # Check auth status
alexa-mcp auth logout # Remove credentialsDevices & Voice:
alexa-mcp devices # List Echo devices
alexa-mcp speak "Hello" -d Office # Text-to-speech on device
alexa-mcp announce "Dinner ready" # Announce to all devices
alexa-mcp command -d Office "play jazz" # Voice commandSmart Home:
alexa-mcp groups # List room groups
alexa-mcp group-members Kitchen # List all devices in a group
alexa-mcp appliances # List smart home devices (with β¦suffix for disambiguation)
alexa-mcp appliances --type light # Filter by type: light, switch, plug, sensor, camera
alexa-mcp status "Lounge lamp" # Get current state (power, brightness, colour temp)
alexa-mcp switch-group Kitchen off # Turn off lights in room group β returns JSON result
alexa-mcp switch-room "kitchen lights" off # Turn off devices by pattern β returns JSON result
alexa-mcp switch "Lounge light 2" off # Turn off single device β returns live state JSON
alexa-mcp control <entityId> turnOn # Direct device control β returns live state JSON
alexa-mcp batch-control turnOff e1 e2 e3 # Batch control β returns per-device result mapRoutines & Media:
alexa-mcp routines # List routines (includes name field)
alexa-mcp run <automationId> # Run a routine by ID
alexa-mcp run --name "our bedtime" # Run a routine by exact name
alexa-mcp run --partial "bedtime" # Run a routine by partial name match
alexa-mcp now-playing -d Office # Show now-playing
alexa-mcp media play|pause|next -d Office # Media controlTips:
- Use
switch-groupfor "all lights in [room]" (e.g.,Kitchen) - Use
switch-roomfor pattern matching β tries all-words first, falls back to any-word - Use
switchfor single devices by exact name - Use
statusto verify device state without issuing a command - Use
group-membersafter aswitch-groupto see which devices were targeted - All control commands now return JSON state β no second API call needed to verify
appliancesoutput includesdisplayNamewith a 4-char endpoint suffix to disambiguate duplicates- Direct control methods avoid voice profile issues
- See docs/API.md for full API reference
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"alexa": {
"command": "npx",
"args": ["alexa-mcp"]
}
}
}Edit ~/.cursor/mcp.json or .vscode/mcp.json:
{
"mcpServers": {
"alexa": {
"command": "npx",
"args": ["alexa-mcp"]
}
}
}Pass token directly (no config file needed):
{
"mcpServers": {
"alexa": {
"command": "npx",
"args": ["alexa-mcp"],
"env": {
"ALEXA_REFRESH_TOKEN": "Atnr|...",
"ALEXA_DOMAIN": "amazon.co.uk"
}
}
}
}If installed locally, use the full path:
{
"mcpServers": {
"alexa": {
"command": "node",
"args": ["/path/to/node_modules/alexa-mcp/dist/index.js"]
}
}
}Devices & Voice:
alexa_list_devices- List Echo devicesalexa_speak- Text-to-speech on a devicealexa_announce- Announce to all devicesalexa_command- Send voice command
Smart Home:
alexa_list_appliances- List smart home devices; optionaltypefilter (light/switch/plug/sensor/camera); includesdisplayNamewith 4-char endpoint suffixalexa_device_status- Get live state of a device by name (power, brightness, colour temp, reachability)alexa_list_device_groups- List room groups with member countsalexa_group_members- List all appliances in a named room groupalexa_control_by_group- Control all lights in a room groupalexa_control_by_pattern- Control devices by name pattern (fuzzy fallback: any-word match if all-word fails)alexa_switch_by_name- Control single device by namealexa_control_appliance- Direct control by entity/endpoint IDalexa_batch_control_appliances- Batch control with same action; returns per-device{friendlyName, success, error}mapalexa_batch_control_appliances_custom- Batch control with per-device actions; returns per-device resultsalexa_get_brightness_by_name- Get device brightness and power statealexa_set_brightness_by_name- Set device brightnessalexa_get_color_temperature_by_name- Get device colour temperaturealexa_set_color_temperature_by_name- Set device colour temperature
Routines & Media:
alexa_list_routines- List Alexa routines with names and automation IDsalexa_run_routine- Execute a routine byautomationId, exactname, orpartialname matchalexa_list_audio_groups- List multi-room audio groupsalexa_now_playing- Get now-playing statealexa_media_control- Control playback (play/pause/next/etc.)alexa_get_volume/alexa_set_volume- Volume control
Authentication:
alexa_auth_status- Check authentication status
This error occurs when the Amazon account you authenticated with doesn't own the device.
Solution:
- Run
alexa-mcp auth logout - Run
alexa-mcp authand sign in with the account that owns the device - Verify with
alexa-mcp auth status --verify
Check device ownership:
alexa-mcp devices --owners # Show Echo device owners
alexa-mcp appliances # Show smart home device ownersThe deviceOwnerCustomerId must match between your authenticated account and the device.
npm install # Install dependencies
npm run build # Compile TypeScript
npm test # Run unit tests
npm run test:integration # Run integration tests (requires auth)
npm run lint # Check code style
npm run lint:fix # Fix code style issues- API Reference - Complete unofficial Alexa API documentation
- Device Capabilities - Device capability reference
- User Stories - Usage examples and patterns
- Node.js 18+
- Amazon Alexa account (amazon.com, amazon.co.uk, or amazon.de)
MIT - See LICENSE file for details
Contributions welcome! Please follow conventional commits format.
Built on the unofficial Alexa API. Uses alexa-cookie2 for authentication.