alexa-mcp
Allows controlling Amazon Alexa devices and smart-home features, including speaking announcements, sending text voice commands, managing volume and Do Not Disturb, listing and querying smart-home devices, managing groups/rooms, running routines, and accessing shopping/to-do lists.
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., "@alexa-mcp announce that dinner is ready on the kitchen echo"
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.
alexa-mcp
A robust, TypeScript-based MCP (Model Context Protocol) server that lets Claude, Perplexity, and any other MCP-compatible LLM control Amazon Alexa devices: speak announcements, execute text voice commands, manage smart-home groups, run routines, query sensor states, and more.
Built on top of alexa-remote2 (the actively maintained client for Amazon's Alexa API) with complete compile-time type safety, automated tests, and dual-transport architecture (Stdio + Streamable HTTP / SSE).
Architecture & Transports
alexa-mcp offers two flexible transport modes:
┌────────────────────────────────────────────────────────────────────────┐
│ Clients │
│ Claude Desktop │ Claude Code │ Antigravity IDE │ Perplexity │ Web UIs │
└────────────────────────────────────┬───────────────────────────────────┘
│
┌────────────────────────┴────────────────────────┐
│ │
[1] Stdio Transport (Local) [2] HTTP / SSE Transport
node dist/index.js (or src/index.js) node dist/server.js
• Standard input/output pipe • Streamable HTTP (POST /mcp)
• Opens no network ports • Legacy SSE (GET /sse)
• Ideal for desktop assistants • CORS-enabled for web/remote
│ │
└────────────────────────┬────────────────────────┘
▼
┌───────────────────────────────┐
│ AlexaClient │
│ • Session token cache │
│ • Atomic 0600/0700 storage │
│ • Amazon Alexa REST & Push │
└───────────────┬───────────────┘
▼
┌───────────────────────────────┐
│ Amazon Alexa API │
│ Echoes • Smart Home • Rooms │
└───────────────────────────────┘Stdio Transport (
src/index.ts/dist/index.js/src/index.js): Standard input/output communication for local LLM clients (Claude Desktop, Claude Code, Antigravity IDE). Opens no network ports.Streamable HTTP & SSE Server (
src/server.ts/dist/server.js): High-performance Express server supporting the modern MCP Streamable HTTP specification (POST /mcporPOST /) as well as Legacy SSE (GET /ssewithPOST /messages). Includes CORS headers and session management, ideal for remote LLMs, Perplexity, Open WebUI, and Cloudflare Tunnels.
Related MCP server: Home Assistant MCP Server
Features (19 Tools)
Every tool is strictly typed with Zod schema validation and comprehensive error handling:
Tool Name | Domain | Description | Key Arguments |
| Echo Devices | List all Amazon Echo devices with serial numbers, model types, and online status | None |
| Audio Control | Set device volume (0–100) |
|
| Audio Control | Read current volume levels across all Echo devices | None |
| Device Settings | Enable or disable Do Not Disturb mode |
|
| Voice & Audio | Push a spoken announcement with chime to an Echo |
|
| Voice Simulation | Send any voice command as text (e.g., "turn on kitchen lights") |
|
| Voice & Audio | Make Alexa speak plain text directly (no chime) |
|
| Voice & Audio | Speak SSML markup with pauses, whispers, and emphasis |
|
| Smart Home | List paired smart-home entities (lights, plugs, thermostats, sensors) | None |
| Smart Home | Query real-time power, brightness, or sensor states |
|
| Smart Home Rooms | List configured smart-home groups/rooms and assigned appliances | None |
| Smart Home Rooms | Create a new room/group and assign appliance IDs |
|
| Smart Home Rooms | Update name and appliances in an existing room/group |
|
| Smart Home Rooms | Remove a smart-home group/room |
|
| Automations | List all routines, trigger phrases, and sequence actions | None |
| Automations | Trigger an existing automation routine |
|
| Lists | List shopping, to-do, and custom lists | None |
| Lists | Retrieve all items from a specified list |
|
| Lists | Append a new item to a shopping or to-do list |
|
Requirements
Node.js ≥ 18.0.0
An Amazon account with at least one registered Alexa/Echo device
An MCP-compatible client (Claude Desktop, Claude Code, Antigravity IDE, Perplexity, etc.)
Installation & Setup
# Clone repository
git clone https://github.com/James-Tucke-r/alexa-mcp.git
cd alexa-mcp
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run automated tests
npm testAuthentication
Amazon's Alexa API is private and requires a browser-based login. The server includes an interactive authentication helper:
npm run authWhat npm run auth does:
Starts a secure local HTTP proxy on
127.0.0.1:3457(automatically opens your default browser on macOS).You log in to your Amazon account securely. Handles 2FA / OTP seamlessly because it proxies Amazon's real authentication pages.
The proxy captures both the session cookies and the device registration (
macDms) Amazon issues.Credentials are automatically saved to
.auth-data/auth.jsonwith owner-only permissions (0600, directory0700).
You only need to run this once. alexa-remote2 refreshes the token automatically during normal operation.
Why manual cookie pasting is unsupported:
alexa-remote2 gates initialization on macDms (device private key and ADP token) minted during browser registration. A raw session cookie lacks macDms, causing infinite initialization loops. The browser proxy is the only supported, reliable authentication mechanism.
Multi-Account / Multi-Instance Setup
To serve multiple Alexa accounts from a single installation, point ALEXA_MCP_AUTH_DIR to a dedicated directory per instance:
# Authenticate personal account
ALEXA_MCP_AUTH_DIR=~/.alexa-mcp/personal npm run auth
# Authenticate work / second account
ALEXA_MCP_AUTH_DIR=~/.alexa-mcp/work npm run authEach instance maintains its own credentials in isolation.
Client Configurations
1. Claude Desktop (Stdio)
Edit your Claude Desktop configuration:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"alexa": {
"command": "node",
"args": ["/absolute/path/to/alexa-mcp/dist/index.js"]
}
}
}Backward Compatibility: Existing configurations pointing to
/Users/jtucker/src/alexa-mcp/src/index.jscontinue working seamlessly through the built-in forwarder shim.
2. Claude Code (CLI)
claude mcp add alexa -- node "$(pwd)/dist/index.js"Verify connection:
claude mcp list3. Streamable HTTP / SSE Server (Remote Clients & Web UIs)
Run the server:
# Production
npm run serve
# Development (hot reload)
npm run serve:devBy default, the server listens on 0.0.0.0:8000 (configurable via PORT environment variable):
Streamable HTTP Endpoint (Recommended):
http://localhost:8000/mcporhttp://localhost:8000/Legacy SSE Endpoint:
http://localhost:8000/sse(messages atPOST /messages)
Configure in remote MCP clients (e.g., Perplexity, Open WebUI, LibreChat):
{
"mcpServers": {
"alexa": {
"url": "http://localhost:8000/mcp"
}
}
}Environment Variables
Variable | Default | Purpose |
|
| Path to store |
|
| Amazon marketplace host (e.g., |
|
| Preferred HTTP Accept-Language header (e.g., |
|
| Proxy language parameter (e.g., |
|
| Local port used exclusively during |
|
| HTTP port used by |
Development & Scripts
Command | Action |
| Compiles TypeScript source to |
| Runs |
| Runs the full automated test suite (builds first) |
| Runs the compiled Stdio server ( |
| Runs the Stdio server directly in TS via |
| Starts the production HTTP/SSE server ( |
| Starts the HTTP/SSE server in TS via |
| Starts the interactive browser proxy auth flow |
Testing & Quality Assurance
alexa-mcp ships with a comprehensive test suite built on Node's native test runner (node:test) and @modelcontextprotocol/sdk/inMemory.js:
npm testTest Coverage (19 Tests across 4 Suites):
test/tools.test.ts:In-memory MCP client/server integration.
Verifies registration, schemas, and descriptions for all 19 tools.
Tests mock execution of every device, routine, smart home, audio, and list tool.
Verifies Zod input validation (e.g. volume out-of-bounds rejection).
Tests error handling when the upstream Alexa API fails.
test/stdio-transport.test.ts:Spawns subprocesses over actual stdin/stdout pipes.
Tests MCP
initializeandtools/listhandshakes onsrc/index.js(backward-compat shim).Tests MCP handshakes on
dist/index.js(compiled binary).Verifies JSON-RPC error codes on unrecognized methods (
-32601).
test/server-transport.test.ts:Express server lifecycle and ephemeral port binding.
Tests CORS headers (
Access-Control-Allow-Origin: *,mcp-session-id).Tests Streamable HTTP
POST /mcpstateful sessions.Tests SSE
GET /ssestreams.Tests automatic
Acceptheader normalization (application/json, text/event-stream).
test/auth-storage.test.ts:Atomic file write verification (temp file -> sync -> atomic rename).
File permission verification (
0600forauth.json,0700for directory).Automatic tightening of insecure directory permissions.
Rejection of corrupt or missing device registrations (
macDms).
See docs/TESTING.md for deep-dive testing documentation.
Security Model
Atomic File Writing: Credentials in
.auth-data/auth.jsonare written to a unique temporary file opened withO_CREAT | O_EXCLat mode0600, flushed to disk viafsync, and atomically replaced viarename. No partial files, race conditions, or unencrypted leaks.Directory Hardening: Auth directories are verified at mode
0700and tightened immediately if found looser.Local Proxy Binding:
npm run authbinds strictly to127.0.0.1, never exposing authentication cookies to external network interfaces.Git Safety:
.auth-data/, cookies, and tokens are permanently ignored in.gitignore.Dependency Pinning: Enforces
alexa-cookie2 >= 5.0.4to avoid Amazon400 InvalidTokenrefresh regressions.
Project Structure
alexa-mcp/
├── src/
│ ├── index.ts # MCP Stdio server entrypoint & factory
│ ├── index.js # Backward-compatibility shim (forwards to dist/)
│ ├── alexa-client.ts # Typed wrapper around alexa-remote2 with atomic auth
│ ├── tools.ts # 19 MCP tool registrations with Zod schemas
│ ├── server.ts # Streamable HTTP & SSE Express server
│ ├── auth.ts # Interactive proxy login flow
│ └── types/
│ └── alexa.ts # Domain interfaces (AuthData, Devices, Groups, etc.)
├── dist/ # Compiled JavaScript, TypeScript declarations & maps
├── test/
│ ├── tools.test.ts # In-memory tests for all 19 tools & schemas
│ ├── stdio-transport.test.ts # Subprocess stdio JSON-RPC handshake tests
│ ├── server-transport.test.ts # Express Streamable HTTP & SSE transport tests
│ └── auth-storage.test.ts # File mode (0600/0700) & atomic write security tests
├── docs/
│ ├── ARCHITECTURE.md # Architectural deep dive & protocol mechanics
│ └── TESTING.md # Comprehensive test strategy & execution guide
├── .auth-data/ # Git-ignored local credentials store (mode 0700)
│ └── auth.json # Session cookies & device registration (mode 0600)
├── CHANGELOG.md # Detailed release and migration history
├── package.json # Package manifest & build scripts
├── tsconfig.json # TypeScript compiler configuration (ES2022/NodeNext)
├── LICENSE # MIT License
└── README.md # Project documentationAcknowledgments
Renato Ascencio for authoring the original
alexa-mcpproject.Apollon77 for maintaining
alexa-remote2, which powers communication with Amazon's private Alexa endpoints.The Model Context Protocol team at Anthropic.
License
MIT © Renato Ascencio, James Tucker
Available Tools
19 toolsalexa_add_list_itemAdd Item to ListB
Add an item to an Alexa list (shopping, to-do, etc).
Inputs: value (required), listId (required).
alexa_announceSend Alexa AnnouncementB
Send a voice announcement to a specific Echo device. The message will be spoken aloud.
Inputs: message (required), serialNumber (required).
alexa_create_groupCreate Smart Home GroupA
Create a new Alexa smart home group/room with a name and optional list of appliance IDs.
Inputs: name (required), applianceIds.
alexa_delete_groupDelete Smart Home GroupB
Delete an Alexa smart home group/room.
Inputs: groupId (required).
alexa_do_not_disturbSet Do Not DisturbA
Enable or disable Do Not Disturb on a specific Echo device.
Inputs: enabled (required), serialNumber (required).
alexa_execute_routineExecute Alexa RoutineA
Execute an existing Alexa routine by providing its automation definition (from alexa_list_routines).
Inputs: routine (required).
alexa_get_list_itemsGet List ItemsA
Get all items from a specific Alexa list.
Inputs: listId (required).
alexa_get_volumesGet All Device VolumesA
Get the current volume levels of all Echo devices.
Inputs: no named parameters.
alexa_list_devicesList Alexa DevicesA
List all Amazon Echo devices in your account with their serial numbers, types, and online status.
Inputs: no named parameters.
alexa_list_groupsList Smart Home GroupsA
List all smart home groups/rooms configured in Alexa. Shows which devices are assigned to each group.
Inputs: no named parameters.
alexa_list_listsList Alexa ListsA
Get all Alexa lists (shopping lists, to-do lists, custom lists).
Inputs: no named parameters.
alexa_list_routinesList Alexa RoutinesA
List all Alexa routines configured in the account. Shows routine names, triggers, and actions.
Inputs: no named parameters.
alexa_list_smarthome_devicesList Smart Home DevicesB
List all smart home devices registered in Alexa (lights, switches, sensors, etc).
Inputs: no named parameters.
alexa_query_deviceQuery Smart Home DeviceA
Query the current state of one or more smart home devices (on/off, brightness, temperature, etc).
Inputs: entityIds (required).
alexa_set_volumeSet Device VolumeA
Set the volume of a specific Echo device (0-100).
Inputs: volume (required), serialNumber (required).
alexa_speakSpeak TextA
Make Alexa speak plain text directly on a specific Echo device using native text-to-speech (no announcement chime).
Inputs: text (required), serialNumber (required).
alexa_speak_ssmlSpeak SSMLC
Make Alexa speak using SSML (Speech Synthesis Markup Language) for advanced voice control.
Inputs: ssml (required), serialNumber (required).
alexa_text_commandSend Text Command to AlexaB
Send a text command to Alexa as if you spoke it. Example: "turn on the kitchen lights"
Inputs: command (required), serialNumber (required).
alexa_update_groupUpdate Smart Home GroupA
Update an existing Alexa smart home group/room. Sets the name and full list of appliance IDs.
Inputs: name (required), groupId (required), applianceIds (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Tools mostly target distinct resources/actions; however the three speaking tools (alexa_announce, alexa_speak, alexa_speak_ssml) plus alexa_text_command create some overlap in output modality. Descriptions clarify differences (chime vs TTS vs SSML vs simulated command), so an agent can usually distinguish them, but confusion is possible.
All tools use the alexa_ snake_case prefix and typically follow verb_noun (list_devices, set_volume, create_group). Minor deviations (alexa_announce, alexa_text_command, alexa_do_not_disturb) are still readable and consistent enough.
19 tools is slightly above the ideal 3-15 range, but the breadth of Alexa's domain (devices, smart home, groups, routines, lists, TTS, DND) justifies most tools. No excessive redundancy, though some consolidation could be possible.
Core workflows for announcements, routines, volume, groups, and querying are covered, but list management lacks update/delete/remove-item operations, and there is no direct set-device-state tool for smart home control (only natural-language alexa_text_command). These are notable gaps an agent must work around.
Related MCP Connectors
Skills, agents and memory in the cloud, plus a gateway to your other MCP servers.
Manage Superlist tasks and lists in plain language from any MCP-compatible AI agent.
Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Connect any AI agent to 1,000+ apps and 27,000+ actions through one remote MCP server (OAuth).
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to control Alexa-connected smart home devices, including voice announcements, music control, smart lighting, sensor monitoring, and volume management through the Alexa API.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control Home Assistant smart home devices via MCP, with zero external dependencies. Supports calling services, getting states, and looking up service parameters.49 npmMIT
- AlicenseAqualityBmaintenanceAn MCP server that lets LLMs control Amazon Alexa devices, including announcements, text commands, smart-home group management, routines, and list operations.188MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to control Apple Home devices, scenes, and automations through MCP.11 npm39MIT