@us-all/android-mcp 1.0.0
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/LICENSE +21 -0
- package/README.md +277 -0
- package/dist/adb.d.ts +8 -0
- package/dist/adb.d.ts.map +1 -0
- package/dist/adb.js +35 -0
- package/dist/adb.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/apps.d.ts +51 -0
- package/dist/tools/apps.d.ts.map +1 -0
- package/dist/tools/apps.js +174 -0
- package/dist/tools/apps.js.map +1 -0
- package/dist/tools/device.d.ts +44 -0
- package/dist/tools/device.d.ts.map +1 -0
- package/dist/tools/device.js +105 -0
- package/dist/tools/device.js.map +1 -0
- package/dist/tools/emulator.d.ts +46 -0
- package/dist/tools/emulator.d.ts.map +1 -0
- package/dist/tools/emulator.js +129 -0
- package/dist/tools/emulator.js.map +1 -0
- package/dist/tools/files.d.ts +36 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +85 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/logcat.d.ts +44 -0
- package/dist/tools/logcat.d.ts.map +1 -0
- package/dist/tools/logcat.js +123 -0
- package/dist/tools/logcat.js.map +1 -0
- package/dist/tools/shell.d.ts +11 -0
- package/dist/tools/shell.d.ts.map +1 -0
- package/dist/tools/shell.js +34 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/tools/system.d.ts +31 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +80 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/ui.d.ts +80 -0
- package/dist/tools/ui.d.ts.map +1 -0
- package/dist/tools/ui.js +195 -0
- package/dist/tools/ui.js.map +1 -0
- package/dist/tools/utils.d.ts +43 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +108 -0
- package/dist/tools/utils.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 thkim-us
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Android MCP Server
|
|
2
|
+
|
|
3
|
+
Android MCP server — ADB-based device management, UI automation, logcat debugging, emulator control, and more via the [Model Context Protocol](https://modelcontextprotocol.io/).
|
|
4
|
+
|
|
5
|
+
[한국어](./README_KO.md)
|
|
6
|
+
|
|
7
|
+
## Why This Server?
|
|
8
|
+
|
|
9
|
+
| Feature | Other Android MCPs | This Server |
|
|
10
|
+
|---------|-------------------|-------------|
|
|
11
|
+
| UI Automation (tap, swipe, screenshot) | ✓ | ✓ |
|
|
12
|
+
| UI Hierarchy (accessibility tree) | ✓ | ✓ (compact mode for token efficiency) |
|
|
13
|
+
| Logcat filtering & crash log extraction | — | ✓ |
|
|
14
|
+
| Emulator lifecycle (AVD start/stop/snapshot) | — | ✓ |
|
|
15
|
+
| File management (push/pull) | — | ✓ |
|
|
16
|
+
| System info (battery, network, settings) | — | ✓ |
|
|
17
|
+
| 2-tier security (write + shell gating) | — | ✓ |
|
|
18
|
+
| Pure ADB (no Appium/uiautomator2 dependency) | — | ✓ |
|
|
19
|
+
| TypeScript + official MCP SDK | — | ✓ |
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. npx (recommended)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @us-all/android-mcp-server
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Docker
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
docker run --rm \
|
|
33
|
+
--device /dev/bus/usb \
|
|
34
|
+
-e ANDROID_MCP_ALLOW_WRITE=true \
|
|
35
|
+
ghcr.io/us-all/android-mcp-server:latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 3. Build from source
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone <repo>
|
|
42
|
+
cd android-mcp-server
|
|
43
|
+
pnpm install
|
|
44
|
+
pnpm run build
|
|
45
|
+
pnpm start
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
### Environment Variables
|
|
51
|
+
|
|
52
|
+
| Variable | Required | Default | Description |
|
|
53
|
+
|----------|----------|---------|-------------|
|
|
54
|
+
| `ANDROID_HOME` | No | auto-detect | Android SDK path |
|
|
55
|
+
| `ADB_PATH` | No | `adb` (PATH) | Path to ADB binary |
|
|
56
|
+
| `ANDROID_SERIAL` | No | auto (single device) | Target device serial number |
|
|
57
|
+
| `ANDROID_MCP_ALLOW_WRITE` | No | `false` | Enable write operations (install, tap, push, etc.) |
|
|
58
|
+
| `ANDROID_MCP_ALLOW_SHELL` | No | `false` | Enable arbitrary shell command execution |
|
|
59
|
+
|
|
60
|
+
### Read-Only Mode (default)
|
|
61
|
+
|
|
62
|
+
By default, only read operations are permitted. Write operations (`tap`, `install-app`, `push-file`, etc.) return an error unless `ANDROID_MCP_ALLOW_WRITE=true` is set. Shell command execution requires a separate `ANDROID_MCP_ALLOW_SHELL=true` flag for additional security.
|
|
63
|
+
|
|
64
|
+
### Claude Desktop
|
|
65
|
+
|
|
66
|
+
Add to your Claude Desktop configuration:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"android": {
|
|
72
|
+
"command": "npx",
|
|
73
|
+
"args": ["@us-all/android-mcp-server"],
|
|
74
|
+
"env": {
|
|
75
|
+
"ANDROID_MCP_ALLOW_WRITE": "true"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Claude Code
|
|
83
|
+
|
|
84
|
+
Add to your project's `.mcp.json`:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"android": {
|
|
90
|
+
"type": "stdio",
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["@us-all/android-mcp-server"],
|
|
93
|
+
"env": {
|
|
94
|
+
"ANDROID_MCP_ALLOW_WRITE": "true",
|
|
95
|
+
"ANDROID_MCP_ALLOW_SHELL": "true"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or from a local build:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"android": {
|
|
108
|
+
"type": "stdio",
|
|
109
|
+
"command": "node",
|
|
110
|
+
"args": ["dist/index.js"],
|
|
111
|
+
"cwd": "/path/to/android-mcp-server",
|
|
112
|
+
"env": {
|
|
113
|
+
"ANDROID_MCP_ALLOW_WRITE": "true",
|
|
114
|
+
"ANDROID_MCP_ALLOW_SHELL": "true"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Tools (35)
|
|
122
|
+
|
|
123
|
+
### Device (5)
|
|
124
|
+
|
|
125
|
+
| Tool | Description | R/W |
|
|
126
|
+
|------|-------------|-----|
|
|
127
|
+
| `list-devices` | List connected devices and emulators with status | R |
|
|
128
|
+
| `get-device-info` | Device model, brand, Android version, SDK, display info | R |
|
|
129
|
+
| `get-device-properties` | System properties via getprop (filterable by prefix) | R |
|
|
130
|
+
| `connect-device` | Connect to device over TCP/IP (wireless ADB) | W |
|
|
131
|
+
| `disconnect-device` | Disconnect TCP/IP device | W |
|
|
132
|
+
|
|
133
|
+
### Apps (6)
|
|
134
|
+
|
|
135
|
+
| Tool | Description | R/W |
|
|
136
|
+
|------|-------------|-----|
|
|
137
|
+
| `list-packages` | List installed packages (filter by name, type: all/system/3rd-party) | R |
|
|
138
|
+
| `get-package-info` | Package version, SDK targets, install time, permissions | R |
|
|
139
|
+
| `install-app` | Install APK file on device | W |
|
|
140
|
+
| `uninstall-app` | Uninstall app (optionally keep data) | W |
|
|
141
|
+
| `launch-app` | Launch app by package name (or specific activity) | W |
|
|
142
|
+
| `stop-app` | Force stop an app | W |
|
|
143
|
+
|
|
144
|
+
### UI Automation (7)
|
|
145
|
+
|
|
146
|
+
| Tool | Description | R/W |
|
|
147
|
+
|------|-------------|-----|
|
|
148
|
+
| `take-screenshot` | Capture screen as PNG image (returned as base64) | R |
|
|
149
|
+
| `dump-ui-hierarchy` | Dump accessibility tree — compact mode returns interactive elements only with center coordinates for token efficiency | R |
|
|
150
|
+
| `tap` | Tap at (x, y) coordinates | W |
|
|
151
|
+
| `long-press` | Long press at (x, y) with configurable duration | W |
|
|
152
|
+
| `swipe` | Swipe gesture from (x1,y1) to (x2,y2) | W |
|
|
153
|
+
| `input-text` | Type text (special characters escaped) | W |
|
|
154
|
+
| `press-key` | Key event: BACK, HOME, ENTER, VOLUME_UP, etc. | W |
|
|
155
|
+
|
|
156
|
+
### Logcat (4)
|
|
157
|
+
|
|
158
|
+
| Tool | Description | R/W |
|
|
159
|
+
|------|-------------|-----|
|
|
160
|
+
| `get-logcat` | Get recent logs with tag and priority filter (V/D/I/W/E/F) | R |
|
|
161
|
+
| `clear-logcat` | Clear logcat buffer | W |
|
|
162
|
+
| `search-logcat` | Search logs by text pattern (case-insensitive supported) | R |
|
|
163
|
+
| `get-crash-logs` | Extract crash/fatal logs, optionally filtered by package | R |
|
|
164
|
+
|
|
165
|
+
### Emulator (5)
|
|
166
|
+
|
|
167
|
+
| Tool | Description | R/W |
|
|
168
|
+
|------|-------------|-----|
|
|
169
|
+
| `list-avds` | List available Android Virtual Devices | R |
|
|
170
|
+
| `start-emulator` | Start AVD (supports headless mode, data wipe) | W |
|
|
171
|
+
| `stop-emulator` | Stop a running emulator | W |
|
|
172
|
+
| `list-snapshots` | List emulator snapshots | R |
|
|
173
|
+
| `load-snapshot` | Load an emulator snapshot | W |
|
|
174
|
+
|
|
175
|
+
### Files (4)
|
|
176
|
+
|
|
177
|
+
| Tool | Description | R/W |
|
|
178
|
+
|------|-------------|-----|
|
|
179
|
+
| `list-files` | List files on device (supports recursive) | R |
|
|
180
|
+
| `pull-file` | Download file from device to local filesystem | R |
|
|
181
|
+
| `push-file` | Upload local file to device | W |
|
|
182
|
+
| `delete-file` | Delete file or directory on device | W |
|
|
183
|
+
|
|
184
|
+
### System (3)
|
|
185
|
+
|
|
186
|
+
| Tool | Description | R/W |
|
|
187
|
+
|------|-------------|-----|
|
|
188
|
+
| `get-battery-info` | Battery level, charging state, temperature, health | R |
|
|
189
|
+
| `get-network-info` | WiFi status, IP address, connectivity details | R |
|
|
190
|
+
| `change-setting` | Modify system/secure/global settings | W |
|
|
191
|
+
|
|
192
|
+
### Shell (1)
|
|
193
|
+
|
|
194
|
+
| Tool | Description | R/W |
|
|
195
|
+
|------|-------------|-----|
|
|
196
|
+
| `execute-shell` | Execute arbitrary ADB shell command (requires `ANDROID_MCP_ALLOW_SHELL`) | W |
|
|
197
|
+
|
|
198
|
+
## Architecture
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
┌──────────────────────────────────────────────────────┐
|
|
202
|
+
│ Claude / AI Client │
|
|
203
|
+
└─────────────────────┬────────────────────────────────┘
|
|
204
|
+
│ MCP Protocol (stdio)
|
|
205
|
+
▼
|
|
206
|
+
┌──────────────────────────────────────────────────────┐
|
|
207
|
+
│ android-mcp-server (index.ts) │
|
|
208
|
+
│ │
|
|
209
|
+
│ ┌─────────┐ ┌──────────────────────────────────┐ │
|
|
210
|
+
│ │config.ts│ │ tools/ │ │
|
|
211
|
+
│ │ ADB path│ │ device.ts ── 5 tools │ │
|
|
212
|
+
│ │ serial │ │ apps.ts ── 6 tools │ │
|
|
213
|
+
│ │ perms │ │ ui.ts ── 7 tools │ │
|
|
214
|
+
│ └─────────┘ │ logcat.ts ── 4 tools │ │
|
|
215
|
+
│ │ emulator.ts── 5 tools │ │
|
|
216
|
+
│ ┌─────────┐ │ files.ts ── 4 tools │ │
|
|
217
|
+
│ │ adb.ts │ │ system.ts ── 3 tools │ │
|
|
218
|
+
│ │ wrapper │ │ shell.ts ── 1 tool │ │
|
|
219
|
+
│ └─────────┘ │ utils.ts ── error handling │ │
|
|
220
|
+
│ └──────────────────────────────────┘ │
|
|
221
|
+
└─────────────────────┬────────────────────────────────┘
|
|
222
|
+
│ child_process (execFile)
|
|
223
|
+
▼
|
|
224
|
+
┌──────────────────────────────────────────────────────┐
|
|
225
|
+
│ ADB (Android Debug Bridge) │
|
|
226
|
+
│ │
|
|
227
|
+
│ USB / TCP-IP / Emulator connection │
|
|
228
|
+
└─────────────────────┬────────────────────────────────┘
|
|
229
|
+
│
|
|
230
|
+
▼
|
|
231
|
+
Android Device
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Tech Stack
|
|
235
|
+
|
|
236
|
+
- **Runtime:** Node.js 18+
|
|
237
|
+
- **Language:** TypeScript 5.x (strict mode, ESM)
|
|
238
|
+
- **MCP SDK:** @modelcontextprotocol/sdk 1.27+
|
|
239
|
+
- **Validation:** zod 4.x
|
|
240
|
+
- **XML Parser:** fast-xml-parser (UI hierarchy parsing)
|
|
241
|
+
- **Android:** ADB via child_process (no Appium, no uiautomator2)
|
|
242
|
+
- **Testing:** vitest (fork pool isolation)
|
|
243
|
+
- **Package Manager:** pnpm
|
|
244
|
+
|
|
245
|
+
## Security
|
|
246
|
+
|
|
247
|
+
- **Read-only by default** — All write operations blocked unless `ANDROID_MCP_ALLOW_WRITE=true`
|
|
248
|
+
- **Shell gating** — Arbitrary shell commands require separate `ANDROID_MCP_ALLOW_SHELL=true`
|
|
249
|
+
- **Error sanitization** — API keys, tokens, passwords redacted from all error outputs
|
|
250
|
+
- **Input validation** — All parameters validated via zod schemas before execution
|
|
251
|
+
- **No ambient authority** — No global state mutation; explicit device targeting via serial
|
|
252
|
+
|
|
253
|
+
## Development
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
pnpm install # Install dependencies
|
|
257
|
+
pnpm run dev # Watch mode (tsc --watch)
|
|
258
|
+
pnpm run build # Compile TypeScript → dist/
|
|
259
|
+
pnpm test # Run unit tests
|
|
260
|
+
pnpm start # Run MCP server
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Adding a new tool
|
|
264
|
+
|
|
265
|
+
1. Define zod schema + async handler in `src/tools/<category>.ts`
|
|
266
|
+
2. Import and register with `server.tool()` in `src/index.ts`
|
|
267
|
+
3. Use `wrapToolHandler()` for consistent response formatting
|
|
268
|
+
4. Use `assertWriteAllowed()` for write operations
|
|
269
|
+
5. Run `pnpm run build && pnpm test`
|
|
270
|
+
|
|
271
|
+
## Contributing
|
|
272
|
+
|
|
273
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development guidelines.
|
|
274
|
+
|
|
275
|
+
## License
|
|
276
|
+
|
|
277
|
+
MIT
|
package/dist/adb.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AdbOptions {
|
|
2
|
+
serial?: string;
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function adb(args: string[], options?: AdbOptions): Promise<string>;
|
|
6
|
+
export declare function adbShell(command: string, options?: AdbOptions): Promise<string>;
|
|
7
|
+
export declare function adbRawBuffer(args: string[], options?: AdbOptions): Promise<Buffer>;
|
|
8
|
+
//# sourceMappingURL=adb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adb.d.ts","sourceRoot":"","sources":["../src/adb.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAsB,GAAG,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
package/dist/adb.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { config } from "./config.js";
|
|
4
|
+
const execFileAsync = promisify(execFile);
|
|
5
|
+
const DEFAULT_TIMEOUT = 30_000;
|
|
6
|
+
function buildArgs(args, options) {
|
|
7
|
+
const serial = options?.serial ?? config.serial;
|
|
8
|
+
if (serial) {
|
|
9
|
+
return ["-s", serial, ...args];
|
|
10
|
+
}
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
export async function adb(args, options) {
|
|
14
|
+
const fullArgs = buildArgs(args, options);
|
|
15
|
+
const timeout = options?.timeout ?? DEFAULT_TIMEOUT;
|
|
16
|
+
const { stdout } = await execFileAsync(config.adbPath, fullArgs, {
|
|
17
|
+
timeout,
|
|
18
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
19
|
+
});
|
|
20
|
+
return stdout.trim();
|
|
21
|
+
}
|
|
22
|
+
export async function adbShell(command, options) {
|
|
23
|
+
return adb(["shell", command], options);
|
|
24
|
+
}
|
|
25
|
+
export async function adbRawBuffer(args, options) {
|
|
26
|
+
const fullArgs = buildArgs(args, options);
|
|
27
|
+
const timeout = options?.timeout ?? DEFAULT_TIMEOUT;
|
|
28
|
+
const { stdout } = await execFileAsync(config.adbPath, fullArgs, {
|
|
29
|
+
timeout,
|
|
30
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
31
|
+
encoding: "buffer",
|
|
32
|
+
});
|
|
33
|
+
return stdout;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=adb.js.map
|
package/dist/adb.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adb.js","sourceRoot":"","sources":["../src/adb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MA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AC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM;;;;;;CAMlB,CAAC;AAEF,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CASpD"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import dotenv from "dotenv";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
dotenv.config();
|
|
5
|
+
const execFileAsync = promisify(execFile);
|
|
6
|
+
export const config = {
|
|
7
|
+
androidHome: process.env.ANDROID_HOME ?? "",
|
|
8
|
+
adbPath: process.env.ADB_PATH ?? "adb",
|
|
9
|
+
serial: process.env.ANDROID_SERIAL ?? "",
|
|
10
|
+
allowWrite: process.env.ANDROID_MCP_ALLOW_WRITE === "true",
|
|
11
|
+
allowShell: process.env.ANDROID_MCP_ALLOW_SHELL === "true",
|
|
12
|
+
};
|
|
13
|
+
export async function validateConfig() {
|
|
14
|
+
try {
|
|
15
|
+
await execFileAsync(config.adbPath, ["version"]);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new Error(`ADB not found at "${config.adbPath}". ` +
|
|
19
|
+
"Install Android SDK and ensure adb is in PATH, or set ADB_PATH environment variable.");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE;IAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK;IACtC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;IACxC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,MAAM;IAC1D,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,MAAM;CAC3D,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,qBAAqB,MAAM,CAAC,OAAO,KAAK;YACtC,sFAAsF,CACzF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { validateConfig } from "./config.js";
|
|
5
|
+
import { wrapToolHandler, wrapImageToolHandler } from "./tools/utils.js";
|
|
6
|
+
// Device tools
|
|
7
|
+
import { listDevicesSchema, listDevices, getDeviceInfoSchema, getDeviceInfo, getDevicePropertiesSchema, getDeviceProperties, connectDeviceSchema, connectDevice, disconnectDeviceSchema, disconnectDevice, } from "./tools/device.js";
|
|
8
|
+
// App tools
|
|
9
|
+
import { listPackagesSchema, listPackages, getPackageInfoSchema, getPackageInfo, installAppSchema, installApp, uninstallAppSchema, uninstallApp, launchAppSchema, launchApp, stopAppSchema, stopApp, } from "./tools/apps.js";
|
|
10
|
+
// UI tools
|
|
11
|
+
import { takeScreenshotSchema, takeScreenshot, dumpUiHierarchySchema, dumpUiHierarchy, tapSchema, tap, longPressSchema, longPress, swipeSchema, swipe, inputTextSchema, inputText, pressKeySchema, pressKey, } from "./tools/ui.js";
|
|
12
|
+
// Logcat tools
|
|
13
|
+
import { getLogcatSchema, getLogcat, clearLogcatSchema, clearLogcat, searchLogcatSchema, searchLogcat, getCrashLogsSchema, getCrashLogs, } from "./tools/logcat.js";
|
|
14
|
+
// Emulator tools
|
|
15
|
+
import { listAvdsSchema, listAvds, startEmulatorSchema, startEmulator, stopEmulatorSchema, stopEmulator, listSnapshotsSchema, listSnapshots, loadSnapshotSchema, loadSnapshot, } from "./tools/emulator.js";
|
|
16
|
+
// File tools
|
|
17
|
+
import { listFilesSchema, listFiles, pullFileSchema, pullFile, pushFileSchema, pushFile, deleteFileSchema, deleteFile, } from "./tools/files.js";
|
|
18
|
+
// Shell tools
|
|
19
|
+
import { executeShellSchema, executeShell } from "./tools/shell.js";
|
|
20
|
+
// System tools
|
|
21
|
+
import { getBatteryInfoSchema, getBatteryInfo, getNetworkInfoSchema, getNetworkInfo, changeSettingSchema, changeSetting, } from "./tools/system.js";
|
|
22
|
+
// --- Server setup ---
|
|
23
|
+
await validateConfig();
|
|
24
|
+
const server = new McpServer({
|
|
25
|
+
name: "android-mcp-server",
|
|
26
|
+
version: "1.0.0",
|
|
27
|
+
});
|
|
28
|
+
// ========== Device tools ==========
|
|
29
|
+
server.tool("list-devices", "List all connected Android devices and emulators with their status and details", listDevicesSchema.shape, wrapToolHandler(listDevices));
|
|
30
|
+
server.tool("get-device-info", "Get detailed device information including model, brand, Android version, SDK version, display density and size", getDeviceInfoSchema.shape, wrapToolHandler(getDeviceInfo));
|
|
31
|
+
server.tool("get-device-properties", "Get Android system properties (getprop). Optionally filter by prefix like 'ro.build' or 'ro.product'", getDevicePropertiesSchema.shape, wrapToolHandler(getDeviceProperties));
|
|
32
|
+
server.tool("connect-device", "Connect to a device over TCP/IP (wireless ADB). Requires ANDROID_MCP_ALLOW_WRITE=true", connectDeviceSchema.shape, wrapToolHandler(connectDevice));
|
|
33
|
+
server.tool("disconnect-device", "Disconnect a TCP/IP device or all TCP/IP devices. Requires ANDROID_MCP_ALLOW_WRITE=true", disconnectDeviceSchema.shape, wrapToolHandler(disconnectDevice));
|
|
34
|
+
// ========== App tools ==========
|
|
35
|
+
server.tool("list-packages", "List installed packages on the device. Filter by name or type (all, system, third-party)", listPackagesSchema.shape, wrapToolHandler(listPackages));
|
|
36
|
+
server.tool("get-package-info", "Get detailed package info: version, SDK targets, install time, permissions", getPackageInfoSchema.shape, wrapToolHandler(getPackageInfo));
|
|
37
|
+
server.tool("install-app", "Install an APK file on the device. Requires ANDROID_MCP_ALLOW_WRITE=true", installAppSchema.shape, wrapToolHandler(installApp));
|
|
38
|
+
server.tool("uninstall-app", "Uninstall an app from the device. Requires ANDROID_MCP_ALLOW_WRITE=true", uninstallAppSchema.shape, wrapToolHandler(uninstallApp));
|
|
39
|
+
server.tool("launch-app", "Launch an app by package name. Optionally specify activity. Requires ANDROID_MCP_ALLOW_WRITE=true", launchAppSchema.shape, wrapToolHandler(launchApp));
|
|
40
|
+
server.tool("stop-app", "Force stop an app by package name. Requires ANDROID_MCP_ALLOW_WRITE=true", stopAppSchema.shape, wrapToolHandler(stopApp));
|
|
41
|
+
// ========== UI tools ==========
|
|
42
|
+
server.tool("take-screenshot", "Capture a screenshot of the device screen. Returns a PNG image", takeScreenshotSchema.shape, wrapImageToolHandler(takeScreenshot));
|
|
43
|
+
server.tool("dump-ui-hierarchy", "Dump the UI accessibility tree. Compact mode (default) returns only interactive elements with coordinates for token efficiency", dumpUiHierarchySchema.shape, wrapToolHandler(dumpUiHierarchy));
|
|
44
|
+
server.tool("tap", "Tap at specific screen coordinates. Requires ANDROID_MCP_ALLOW_WRITE=true", tapSchema.shape, wrapToolHandler(tap));
|
|
45
|
+
server.tool("long-press", "Long press at specific screen coordinates. Requires ANDROID_MCP_ALLOW_WRITE=true", longPressSchema.shape, wrapToolHandler(longPress));
|
|
46
|
+
server.tool("swipe", "Swipe from one point to another. Requires ANDROID_MCP_ALLOW_WRITE=true", swipeSchema.shape, wrapToolHandler(swipe));
|
|
47
|
+
server.tool("input-text", "Type text on the device. Focus an input field first using tap. Requires ANDROID_MCP_ALLOW_WRITE=true", inputTextSchema.shape, wrapToolHandler(inputText));
|
|
48
|
+
server.tool("press-key", "Press a key event (BACK, HOME, ENTER, VOLUME_UP, etc). Requires ANDROID_MCP_ALLOW_WRITE=true", pressKeySchema.shape, wrapToolHandler(pressKey));
|
|
49
|
+
// ========== Logcat tools ==========
|
|
50
|
+
server.tool("get-logcat", "Get recent logcat output. Filter by tag, priority level, and number of lines", getLogcatSchema.shape, wrapToolHandler(getLogcat));
|
|
51
|
+
server.tool("clear-logcat", "Clear the logcat buffer. Requires ANDROID_MCP_ALLOW_WRITE=true", clearLogcatSchema.shape, wrapToolHandler(clearLogcat));
|
|
52
|
+
server.tool("search-logcat", "Search logcat for a text pattern. Supports case-sensitive and case-insensitive search", searchLogcatSchema.shape, wrapToolHandler(searchLogcat));
|
|
53
|
+
server.tool("get-crash-logs", "Get crash logs from the device. Optionally filter by package name", getCrashLogsSchema.shape, wrapToolHandler(getCrashLogs));
|
|
54
|
+
// ========== Emulator tools ==========
|
|
55
|
+
server.tool("list-avds", "List available Android Virtual Devices (AVDs) that can be started", listAvdsSchema.shape, wrapToolHandler(listAvds));
|
|
56
|
+
server.tool("start-emulator", "Start an Android emulator by AVD name. Supports headless mode and data wipe. Requires ANDROID_MCP_ALLOW_WRITE=true", startEmulatorSchema.shape, wrapToolHandler(startEmulator));
|
|
57
|
+
server.tool("stop-emulator", "Stop a running Android emulator. Requires ANDROID_MCP_ALLOW_WRITE=true", stopEmulatorSchema.shape, wrapToolHandler(stopEmulator));
|
|
58
|
+
server.tool("list-snapshots", "List available emulator snapshots", listSnapshotsSchema.shape, wrapToolHandler(listSnapshots));
|
|
59
|
+
server.tool("load-snapshot", "Load an emulator snapshot. Requires ANDROID_MCP_ALLOW_WRITE=true", loadSnapshotSchema.shape, wrapToolHandler(loadSnapshot));
|
|
60
|
+
// ========== File tools ==========
|
|
61
|
+
server.tool("list-files", "List files on the device at a given path. Supports recursive listing", listFilesSchema.shape, wrapToolHandler(listFiles));
|
|
62
|
+
server.tool("pull-file", "Pull (download) a file from the device to local filesystem", pullFileSchema.shape, wrapToolHandler(pullFile));
|
|
63
|
+
server.tool("push-file", "Push (upload) a local file to the device. Requires ANDROID_MCP_ALLOW_WRITE=true", pushFileSchema.shape, wrapToolHandler(pushFile));
|
|
64
|
+
server.tool("delete-file", "Delete a file or directory on the device. Requires ANDROID_MCP_ALLOW_WRITE=true", deleteFileSchema.shape, wrapToolHandler(deleteFile));
|
|
65
|
+
// ========== Shell tools ==========
|
|
66
|
+
server.tool("execute-shell", "Execute an arbitrary ADB shell command. Requires ANDROID_MCP_ALLOW_SHELL=true (separate from write permission for security)", executeShellSchema.shape, wrapToolHandler(executeShell));
|
|
67
|
+
// ========== System tools ==========
|
|
68
|
+
server.tool("get-battery-info", "Get battery status including level, charging state, temperature, and health", getBatteryInfoSchema.shape, wrapToolHandler(getBatteryInfo));
|
|
69
|
+
server.tool("get-network-info", "Get network information including WiFi status, IP address, and connectivity details", getNetworkInfoSchema.shape, wrapToolHandler(getNetworkInfo));
|
|
70
|
+
server.tool("change-setting", "Change an Android system setting (system/secure/global namespace). Requires ANDROID_MCP_ALLOW_WRITE=true", changeSettingSchema.shape, wrapToolHandler(changeSetting));
|
|
71
|
+
// --- Start server ---
|
|
72
|
+
async function main() {
|
|
73
|
+
const transport = new StdioServerTransport();
|
|
74
|
+
await server.connect(transport);
|
|
75
|
+
console.error("Android MCP server running on stdio");
|
|
76
|
+
}
|
|
77
|
+
main().catch((error) => {
|
|
78
|
+
console.error("Fatal error:", error);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,YAAY;AACZ,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,SAAS,EACT,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,WAAW;AACX,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,SAAS,EACT,GAAG,EACH,eAAe,EACf,SAAS,EACT,WAAW,EACX,KAAK,EACL,eAAe,EACf,SAAS,EACT,cAAc,EACd,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,eAAe;AACf,OAAO,EACL,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,iBAAiB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,CAAC,aAAa,CAAC,CAC/B,CAAC;AAEF,uBAAuB;AAEvB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const listPackagesSchema: z.ZodObject<{
|
|
3
|
+
filter: z.ZodOptional<z.ZodString>;
|
|
4
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5
|
+
all: "all";
|
|
6
|
+
system: "system";
|
|
7
|
+
"third-party": "third-party";
|
|
8
|
+
}>>>;
|
|
9
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const getPackageInfoSchema: z.ZodObject<{
|
|
12
|
+
packageName: z.ZodString;
|
|
13
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const installAppSchema: z.ZodObject<{
|
|
16
|
+
apkPath: z.ZodString;
|
|
17
|
+
replace: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
18
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const uninstallAppSchema: z.ZodObject<{
|
|
21
|
+
packageName: z.ZodString;
|
|
22
|
+
keepData: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
23
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const launchAppSchema: z.ZodObject<{
|
|
26
|
+
packageName: z.ZodString;
|
|
27
|
+
activity: z.ZodOptional<z.ZodString>;
|
|
28
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const stopAppSchema: z.ZodObject<{
|
|
31
|
+
packageName: z.ZodString;
|
|
32
|
+
serial: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare function listPackages(params: z.infer<typeof listPackagesSchema>): Promise<{
|
|
35
|
+
count: number;
|
|
36
|
+
packages: string[];
|
|
37
|
+
}>;
|
|
38
|
+
export declare function getPackageInfo(params: z.infer<typeof getPackageInfoSchema>): Promise<Record<string, string | string[]>>;
|
|
39
|
+
export declare function installApp(params: z.infer<typeof installAppSchema>): Promise<{
|
|
40
|
+
result: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function uninstallApp(params: z.infer<typeof uninstallAppSchema>): Promise<{
|
|
43
|
+
result: string;
|
|
44
|
+
}>;
|
|
45
|
+
export declare function launchApp(params: z.infer<typeof launchAppSchema>): Promise<{
|
|
46
|
+
result: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function stopApp(params: z.infer<typeof stopAppSchema>): Promise<{
|
|
49
|
+
result: string;
|
|
50
|
+
}>;
|
|
51
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/tools/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,kBAAkB;;;;;;;;iBAc7B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAQ/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;iBAW3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;iBAa7B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;iBAc1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;iBAQxB,CAAC;AAIH,wBAAsB,YAAY,CAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;GAwB3C;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,8CA8C7C;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC;;GASzC;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;GAS3C;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC;;GAgBxC;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;;GAMtC"}
|