alexa-mcp 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -117
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,138 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Alexa MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/alexa-mcp)
|
|
4
|
+
[](https://github.com/m0nkmaster/alexa-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- Node.js 18+
|
|
8
|
-
- Amazon Alexa account (amazon.com, amazon.co.uk, or amazon.de)
|
|
7
|
+
**Control your Alexa devices and smart home from the command line or AI assistants.**
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
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.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install alexa-mcp # local install
|
|
15
|
-
npm install -g alexa-mcp # global install (adds alexa-mcp to PATH)
|
|
16
|
-
npx alexa-mcp auth # run without installing
|
|
17
|
-
```
|
|
11
|
+
## Features
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
- 🎙️ **Voice & Media Control** - TTS, announcements, playback control
|
|
14
|
+
- 💡 **Smart Home** - Control lights, plugs, and devices by name, pattern, or room group
|
|
15
|
+
- 🤖 **Routines** - List and trigger Alexa routines
|
|
16
|
+
- 🌍 **Multi-Region** - Supports US (amazon.com), UK (amazon.co.uk), and DE (amazon.de)
|
|
17
|
+
- 🔌 **MCP Integration** - Use with Claude, Cursor, and other AI assistants
|
|
18
|
+
- 🛠️ **CLI & Programmatic** - Command-line tool or Node.js library
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
alexa-mcp auth --token "Atnr|..."
|
|
28
|
-
alexa-mcp auth --token-file /path/to/token.txt
|
|
29
|
-
alexa-mcp auth --domain amazon.com # US account (default: amazon.co.uk)
|
|
30
|
-
alexa-mcp auth --no-save # validate token without saving
|
|
31
|
-
```
|
|
20
|
+
## Quick Start
|
|
32
21
|
|
|
33
|
-
|
|
22
|
+
### Installation
|
|
34
23
|
|
|
35
|
-
|
|
24
|
+
```bash
|
|
25
|
+
# Global install (recommended for CLI usage)
|
|
26
|
+
npm install -g alexa-mcp
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
| `ALEXA_DOMAIN` | Amazon domain when using env token (default: `amazon.co.uk`; options: `amazon.com`, `amazon.de`) |
|
|
41
|
-
| `ALEXA_DEBUG` | Set to any value to log API request/response details to stderr |
|
|
28
|
+
# Or use without installing
|
|
29
|
+
npx alexa-mcp auth
|
|
30
|
+
```
|
|
42
31
|
|
|
43
|
-
|
|
32
|
+
### Authentication
|
|
33
|
+
**Interactive (browser-based):**
|
|
34
|
+
```bash
|
|
35
|
+
alexa-mcp auth
|
|
36
|
+
```
|
|
37
|
+
Opens a URL for you to log in to Amazon. Works locally or on remote servers using automatic tunneling (cloudflared or localtunnel).
|
|
44
38
|
|
|
39
|
+
**Headless (token-based):**
|
|
45
40
|
```bash
|
|
46
|
-
alexa-mcp auth
|
|
47
|
-
alexa-mcp auth --token
|
|
48
|
-
alexa-mcp auth --
|
|
49
|
-
alexa-mcp auth --domain amazon.com # Specify Amazon domain (default: amazon.co.uk)
|
|
50
|
-
alexa-mcp auth --no-save # Validate token without saving
|
|
51
|
-
alexa-mcp auth status [--verify] # Show auth status (--verify calls API)
|
|
52
|
-
alexa-mcp auth logout # Remove credentials
|
|
53
|
-
alexa-mcp devices # List Echo devices
|
|
54
|
-
alexa-mcp devices --owners # Show device names and owner customer IDs (profile matching)
|
|
55
|
-
alexa-mcp speak "Hello" -d Office # Speak text on a specific device
|
|
56
|
-
alexa-mcp announce "Dinner ready" # Announce to all devices
|
|
57
|
-
alexa-mcp command -d Office "play jazz" # Voice command (no response returned)
|
|
58
|
-
alexa-mcp groups # List room/space groups (Kitchen, Living room, etc.)
|
|
59
|
-
alexa-mcp switch-group Kitchen off # Turn off all lights in a group
|
|
60
|
-
alexa-mcp switch-group Kitchen off --all # Turn off ALL appliances in group (not just lights)
|
|
61
|
-
alexa-mcp switch-room "kitchen lights" off # Turn off all devices matching name pattern
|
|
62
|
-
alexa-mcp switch "Lounge light 2" off # Turn off single device by name (direct control; -d for voice fallback)
|
|
63
|
-
alexa-mcp appliances # List smart home devices (endpointId + friendlyName when available)
|
|
64
|
-
alexa-mcp control <entityId> turnOn|turnOff|setBrightness [--brightness 50]
|
|
65
|
-
alexa-mcp routines # List routines
|
|
66
|
-
alexa-mcp run <automationId> # Run a routine
|
|
67
|
-
alexa-mcp now-playing -d Office # Now-playing state (EU/UK)
|
|
68
|
-
alexa-mcp media play|pause|resume|stop|next|previous -d Office # Transport control (EU/UK)
|
|
41
|
+
alexa-mcp auth --token "Atnr|..."
|
|
42
|
+
alexa-mcp auth --token-file /path/to/token.txt
|
|
43
|
+
alexa-mcp auth --domain amazon.com # US account (default: amazon.co.uk)
|
|
69
44
|
```
|
|
70
45
|
|
|
71
|
-
|
|
46
|
+
Configuration is stored in `~/.alexa-mcp/config.json`.
|
|
72
47
|
|
|
73
|
-
|
|
48
|
+
## Usage
|
|
74
49
|
|
|
75
|
-
|
|
50
|
+
### CLI Commands
|
|
76
51
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
**Authentication:**
|
|
53
|
+
```bash
|
|
54
|
+
alexa-mcp auth # Interactive auth
|
|
55
|
+
alexa-mcp auth status [--verify] # Check auth status
|
|
56
|
+
alexa-mcp auth logout # Remove credentials
|
|
57
|
+
```
|
|
83
58
|
|
|
84
|
-
|
|
59
|
+
**Devices & Voice:**
|
|
60
|
+
```bash
|
|
61
|
+
alexa-mcp devices # List Echo devices
|
|
62
|
+
alexa-mcp speak "Hello" -d Office # Text-to-speech on device
|
|
63
|
+
alexa-mcp announce "Dinner ready" # Announce to all devices
|
|
64
|
+
alexa-mcp command -d Office "play jazz" # Voice command
|
|
65
|
+
```
|
|
85
66
|
|
|
86
|
-
|
|
67
|
+
**Smart Home:**
|
|
68
|
+
```bash
|
|
69
|
+
alexa-mcp groups # List room groups
|
|
70
|
+
alexa-mcp appliances # List smart home devices
|
|
71
|
+
alexa-mcp switch-group Kitchen off # Turn off lights in room group
|
|
72
|
+
alexa-mcp switch-room "kitchen lights" off # Turn off devices by pattern
|
|
73
|
+
alexa-mcp switch "Lounge light 2" off # Turn off single device
|
|
74
|
+
alexa-mcp control <entityId> turnOn # Direct device control
|
|
75
|
+
```
|
|
87
76
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
**Routines & Media:**
|
|
78
|
+
```bash
|
|
79
|
+
alexa-mcp routines # List routines
|
|
80
|
+
alexa-mcp run <automationId> # Run a routine
|
|
81
|
+
alexa-mcp now-playing -d Office # Show now-playing
|
|
82
|
+
alexa-mcp media play|pause|next -d Office # Media control
|
|
83
|
+
```
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
**Tips:**
|
|
86
|
+
- Use `switch-group` for "all lights in [room]" (e.g., `Kitchen`)
|
|
87
|
+
- Use `switch-room` for pattern matching (e.g., `"kitchen lights"`)
|
|
88
|
+
- Use `switch` for single devices by exact name
|
|
89
|
+
- Direct control methods avoid voice profile issues
|
|
90
|
+
- See [docs/API.md](docs/API.md) for full API reference
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
`alexa-mcp auth status --verify`
|
|
98
|
-
Shows “Account (deviceOwnerCustomerId): …” for the current session. Control will work when this matches the owner of the Echo and the smart home device.
|
|
92
|
+
### MCP Server Setup
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
### Claude Desktop
|
|
101
95
|
|
|
102
|
-
|
|
96
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
103
97
|
|
|
104
98
|
```json
|
|
105
99
|
{
|
|
106
100
|
"mcpServers": {
|
|
107
101
|
"alexa": {
|
|
108
|
-
"command": "
|
|
109
|
-
"args": ["
|
|
102
|
+
"command": "npx",
|
|
103
|
+
"args": ["alexa-mcp"]
|
|
110
104
|
}
|
|
111
105
|
}
|
|
112
106
|
}
|
|
113
107
|
```
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
### Cursor / VS Code
|
|
110
|
+
|
|
111
|
+
Edit `~/.cursor/mcp.json` or `.vscode/mcp.json`:
|
|
116
112
|
|
|
117
113
|
```json
|
|
118
114
|
{
|
|
119
115
|
"mcpServers": {
|
|
120
116
|
"alexa": {
|
|
121
|
-
"command": "
|
|
122
|
-
"args": ["
|
|
117
|
+
"command": "npx",
|
|
118
|
+
"args": ["alexa-mcp"]
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
122
|
```
|
|
127
123
|
|
|
128
|
-
|
|
124
|
+
### Using Environment Variables
|
|
125
|
+
|
|
126
|
+
Pass token directly (no config file needed):
|
|
129
127
|
|
|
130
128
|
```json
|
|
131
129
|
{
|
|
132
130
|
"mcpServers": {
|
|
133
131
|
"alexa": {
|
|
134
|
-
"command": "
|
|
135
|
-
"args": ["
|
|
132
|
+
"command": "npx",
|
|
133
|
+
"args": ["alexa-mcp"],
|
|
136
134
|
"env": {
|
|
137
135
|
"ALEXA_REFRESH_TOKEN": "Atnr|...",
|
|
138
136
|
"ALEXA_DOMAIN": "amazon.co.uk"
|
|
@@ -142,52 +140,99 @@ Each Echo and smart home device has a **deviceOwnerCustomerId** (Amazon’s inte
|
|
|
142
140
|
}
|
|
143
141
|
```
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
### Local Installation
|
|
144
|
+
|
|
145
|
+
If installed locally, use the full path:
|
|
146
146
|
|
|
147
147
|
```json
|
|
148
148
|
{
|
|
149
149
|
"mcpServers": {
|
|
150
150
|
"alexa": {
|
|
151
|
-
"command": "
|
|
152
|
-
"args": ["alexa-mcp"]
|
|
151
|
+
"command": "node",
|
|
152
|
+
"args": ["/path/to/node_modules/alexa-mcp/dist/index.js"]
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
### MCP Tools
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
158
|
+
### Available MCP Tools
|
|
159
|
+
|
|
160
|
+
**Devices & Voice:**
|
|
161
|
+
- `alexa_list_devices` - List Echo devices
|
|
162
|
+
- `alexa_speak` - Text-to-speech on a device
|
|
163
|
+
- `alexa_announce` - Announce to all devices
|
|
164
|
+
- `alexa_command` - Send voice command
|
|
165
|
+
|
|
166
|
+
**Smart Home:**
|
|
167
|
+
- `alexa_list_appliances` - List smart home devices
|
|
168
|
+
- `alexa_list_device_groups` - List room groups
|
|
169
|
+
- `alexa_control_by_group` - Control all lights in a room group
|
|
170
|
+
- `alexa_control_by_pattern` - Control devices by name pattern
|
|
171
|
+
- `alexa_switch_by_name` - Control single device by name
|
|
172
|
+
- `alexa_control_appliance` - Direct control by entity/endpoint ID
|
|
173
|
+
- `alexa_get_brightness_by_name` - Get device brightness
|
|
174
|
+
- `alexa_set_brightness_by_name` - Set device brightness
|
|
175
|
+
|
|
176
|
+
**Routines & Media:**
|
|
177
|
+
- `alexa_list_routines` - List Alexa routines
|
|
178
|
+
- `alexa_run_routine` - Execute a routine
|
|
179
|
+
- `alexa_list_audio_groups` - List multi-room audio groups
|
|
180
|
+
- `alexa_now_playing` - Get now-playing state
|
|
181
|
+
- `alexa_media_control` - Control playback (play/pause/next/etc.)
|
|
182
|
+
- `alexa_get_volume` / `alexa_set_volume` - Volume control
|
|
183
|
+
|
|
184
|
+
**Authentication:**
|
|
185
|
+
- `alexa_auth_status` - Check authentication status
|
|
186
|
+
|
|
187
|
+
## Troubleshooting
|
|
188
|
+
|
|
189
|
+
### "Can't control – may need to switch user accounts"
|
|
190
|
+
|
|
191
|
+
This error occurs when the Amazon account you authenticated with doesn't own the device.
|
|
192
|
+
|
|
193
|
+
**Solution:**
|
|
194
|
+
1. Run `alexa-mcp auth logout`
|
|
195
|
+
2. Run `alexa-mcp auth` and sign in with the account that owns the device
|
|
196
|
+
3. Verify with `alexa-mcp auth status --verify`
|
|
197
|
+
|
|
198
|
+
**Check device ownership:**
|
|
199
|
+
```bash
|
|
200
|
+
alexa-mcp devices --owners # Show Echo device owners
|
|
201
|
+
alexa-mcp appliances # Show smart home device owners
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The `deviceOwnerCustomerId` must match between your authenticated account and the device.
|
|
179
205
|
|
|
180
206
|
## Development
|
|
181
207
|
|
|
182
208
|
```bash
|
|
183
|
-
npm install
|
|
184
|
-
npm run build
|
|
185
|
-
npm test
|
|
186
|
-
npm run test:integration
|
|
209
|
+
npm install # Install dependencies
|
|
210
|
+
npm run build # Compile TypeScript
|
|
211
|
+
npm test # Run unit tests
|
|
212
|
+
npm run test:integration # Run integration tests (requires auth)
|
|
213
|
+
npm run lint # Check code style
|
|
214
|
+
npm run lint:fix # Fix code style issues
|
|
187
215
|
```
|
|
188
216
|
|
|
189
|
-
##
|
|
217
|
+
## Documentation
|
|
218
|
+
|
|
219
|
+
- **[API Reference](docs/API.md)** - Complete unofficial Alexa API documentation
|
|
220
|
+
- **[Device Capabilities](docs/DEVICE-CAPABILITIES.md)** - Device capability reference
|
|
221
|
+
- **[User Stories](docs/USER-STORIES.md)** - Usage examples and patterns
|
|
222
|
+
|
|
223
|
+
## Requirements
|
|
224
|
+
|
|
225
|
+
- Node.js 18+
|
|
226
|
+
- Amazon Alexa account (amazon.com, amazon.co.uk, or amazon.de)
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT - See LICENSE file for details
|
|
231
|
+
|
|
232
|
+
## Contributing
|
|
233
|
+
|
|
234
|
+
Contributions welcome! Please follow [conventional commits](https://www.conventionalcommits.org/) format.
|
|
190
235
|
|
|
191
|
-
|
|
236
|
+
## Acknowledgments
|
|
192
237
|
|
|
193
|
-
|
|
238
|
+
Built on the unofficial Alexa API. Uses [alexa-cookie2](https://github.com/Apollon77/alexa-cookie) for authentication.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alexa-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "MCP server and CLI for Alexa devices and smart home control",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
38
38
|
"alexa-cookie2": "^5.0.3",
|
|
39
39
|
"commander": "^12.0.0",
|
|
40
|
+
"patch-package": "^8.0.1",
|
|
40
41
|
"undici": "^6.19.8",
|
|
41
42
|
"zod": "^3.23.0"
|
|
42
43
|
},
|
|
@@ -45,7 +46,6 @@
|
|
|
45
46
|
"@types/eslint__js": "^8.42.3",
|
|
46
47
|
"@types/node": "^22.0.0",
|
|
47
48
|
"eslint": "^9.39.4",
|
|
48
|
-
"patch-package": "^8.0.1",
|
|
49
49
|
"tsx": "^4.19.0",
|
|
50
50
|
"typescript": "^5.6.0",
|
|
51
51
|
"typescript-eslint": "^8.57.0",
|