@codedroid/mcp 0.1.0 → 0.1.2
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/{LICENSE.aura-mcp-connect → LICENSE} +1 -1
- package/README.md +40 -145
- package/docs/reference.md +188 -0
- package/gemini-extension.json +1 -1
- package/package.json +6 -4
- package/src/adb-tool.js +2 -4
- package/src/daemon.js +1 -3
- package/src/index.js +0 -2
- package/src/proxy-core.js +3 -4
- package/src/skill.js +0 -3
- package/src/stdio-shim.js +0 -3
- package/src/version.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codedroid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Your Android phone, through CodeDroid: read the screen, tap and type, hand CodeDroid a whole task, run adb, and verify app changes on the device.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodeDroid"
|
package/README.md
CHANGED
|
@@ -1,185 +1,80 @@
|
|
|
1
1
|
# CodeDroid MCP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
service, so what the agent gets back is what is really on screen, not a guess from a screenshot
|
|
7
|
-
or a `uiautomator` dump.
|
|
3
|
+
Let Claude Code, Codex, Gemini CLI, or any MCP client use your Android phone.
|
|
4
|
+
Read the screen, interact with apps, take screenshots, and test what you build
|
|
5
|
+
through [CodeDroid](https://get.codedroid.com). Your phone and computer can be on different networks.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
the phone) and `test-on-device` (build, install, drive, check logcat, report).
|
|
7
|
+
## Get started
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
You'll need **Node.js 20+** and **CodeDroid on your Android phone**, signed in with
|
|
10
|
+
its accessibility service enabled. Both devices need internet access.
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
- CodeDroid installed from https://get.codedroid.com, signed in, with its accessibility service on.
|
|
16
|
-
The phone only needs to be online: no cable, no USB debugging, no shared network.
|
|
17
|
-
- For the `adb` tool only: adb (Android platform-tools) on this computer, and the phone on it
|
|
18
|
-
(USB debugging, or Wireless debugging: `adb pair <ip:port>`, then `adb connect <ip:port>`).
|
|
12
|
+
### 1. Install for your coding client
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
**Claude Code** — run inside Claude Code:
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```
|
|
16
|
+
```text
|
|
25
17
|
/plugin marketplace add codedroid-team/codedroid-mcp
|
|
26
18
|
/plugin install codedroid@codedroid
|
|
27
19
|
```
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
claude mcp add codedroid -- npx -y @codedroid/mcp
|
|
33
|
-
npx @codedroid/mcp skill install # the two skills, into ~/.claude/skills
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Codex, as a plugin (current CLI):
|
|
21
|
+
**Codex** — run in your terminal:
|
|
37
22
|
|
|
38
23
|
```bash
|
|
39
24
|
codex plugin marketplace add codedroid-team/codedroid-mcp
|
|
40
25
|
codex plugin add codedroid@codedroid
|
|
41
26
|
```
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
codex mcp add codedroid -- npx -y @codedroid/mcp
|
|
47
|
-
npx @codedroid/mcp skill install --codex # into ~/.codex/skills
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Codex stops a tool call after 60 s by default; `run_task` waits, test runs and installs can take
|
|
51
|
-
longer. In `~/.codex/config.toml`:
|
|
52
|
-
|
|
53
|
-
```toml
|
|
54
|
-
[mcp_servers.codedroid]
|
|
55
|
-
command = "npx"
|
|
56
|
-
args = ["-y", "@codedroid/mcp"]
|
|
57
|
-
tool_timeout_sec = 300
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Gemini CLI, as an extension (includes the MCP server and both skills):
|
|
28
|
+
**Gemini CLI** — run in your terminal:
|
|
61
29
|
|
|
62
30
|
```bash
|
|
63
31
|
gemini extensions install https://github.com/codedroid-team/codedroid-mcp
|
|
64
32
|
```
|
|
65
33
|
|
|
66
|
-
|
|
34
|
+
Each installation includes the MCP server and skills for phone control and Android app testing.
|
|
35
|
+
Restart your coding client after installing.
|
|
67
36
|
|
|
68
|
-
|
|
69
|
-
gemini mcp add --scope user --timeout 300000 codedroid npx -y @codedroid/mcp
|
|
70
|
-
```
|
|
37
|
+
Using another client? See [manual MCP setup](docs/reference.md#mcp-configuration).
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
Restart your client after installation, then pair this computer as described below.
|
|
39
|
+
### 2. Pair your phone
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
1. Open **CodeDroid → Settings → Computers → Pair a computer** on your phone.
|
|
42
|
+
2. Run the command shown there in your computer's terminal. For example:
|
|
77
43
|
|
|
78
|
-
|
|
44
|
+
```bash
|
|
45
|
+
npx -y @codedroid/mcp pair ABCD-EFGH
|
|
46
|
+
```
|
|
79
47
|
|
|
80
|
-
|
|
81
|
-
command to run here, valid for 10 minutes:
|
|
48
|
+
3. Tap **Allow** on your phone when prompted.
|
|
82
49
|
|
|
83
|
-
|
|
84
|
-
npx -y @codedroid/mcp pair ABCD-EFGH # then tap Allow on the phone
|
|
85
|
-
```
|
|
50
|
+
Use the command exactly as shown. Pairing codes expire after 10 minutes and work once.
|
|
86
51
|
|
|
87
|
-
|
|
88
|
-
computer's key in `~/.codedroid/host.json` (readable by you only) and connects once, so the phone
|
|
89
|
-
asks whether to allow the computer while you are still there. `npx @codedroid/mcp connect`
|
|
90
|
-
connects again by hand.
|
|
91
|
-
|
|
92
|
-
Settings > Computers lists the paired computers; Remove revokes one's key, so it has to pair
|
|
93
|
-
again. While an agent acts on the phone, CodeDroid shows "<computer> is using this phone" with a
|
|
94
|
-
Stop button, which cuts the computer off for a minute. "Allow computers to connect" turns it all off.
|
|
95
|
-
|
|
96
|
-
## Tools
|
|
97
|
-
|
|
98
|
-
| Tool | What it does |
|
|
99
|
-
|---|---|
|
|
100
|
-
| `get_screen` | The screen as numbered elements, with the app in front; optionally a screenshot |
|
|
101
|
-
| `take_screenshot` | A JPEG of the screen |
|
|
102
|
-
| `tap`, `long_press` | An element by node, text, resource id or content description (found again on the live screen), or a point |
|
|
103
|
-
| `type_text` | Into the focused field, optionally clearing it first and pressing Enter after |
|
|
104
|
-
| `swipe` | Between two points; also how to scroll |
|
|
105
|
-
| `press_key` | back, home, enter, recents |
|
|
106
|
-
| `open_app`, `list_apps` | Launch an app by package; find its package |
|
|
107
|
-
| `wait_for` | Until text shows, text goes, or an app is in front |
|
|
108
|
-
| `clipboard` | Read or set it |
|
|
109
|
-
| `device_info` | Model, Android version and user, screen, locked, whether CodeDroid is ready |
|
|
110
|
-
| `run_task`, `get_task`, `cancel_task` | CodeDroid's own agent does a goal on the phone and replies (needs CodeDroid signed in) |
|
|
111
|
-
| `adb` | This computer's adb, for the phone when it is on USB or Wireless debugging (`CODEDROID_MCP_ADB=0` leaves it out) |
|
|
112
|
-
| `codedroid_status` | Whether the phone is connected, and if not, exactly why |
|
|
113
|
-
|
|
114
|
-
Every action answers with `after`: whether the screen changed, the app in front, the keyboard,
|
|
115
|
-
and the first things to tap now. Every failure is JSON with `error`, `message` and `hint`.
|
|
116
|
-
|
|
117
|
-
## Command line
|
|
52
|
+
### 3. Ask your agent
|
|
118
53
|
|
|
119
|
-
|
|
120
|
-
npx @codedroid/mcp pair ABCD-EFGH # pair with the phone showing the code
|
|
121
|
-
npx @codedroid/mcp connect # connect now; tap Allow the first time
|
|
122
|
-
npx @codedroid/mcp status # what the daemon sees
|
|
123
|
-
npx @codedroid/mcp call get_screen # one tool call, for scripts and CI
|
|
124
|
-
npx @codedroid/mcp call tap '{"text": "Display"}'
|
|
125
|
-
npx @codedroid/mcp stop # stop the daemon
|
|
126
|
-
```
|
|
54
|
+
> Read the screen on my phone and describe what is open.
|
|
127
55
|
|
|
128
|
-
|
|
129
|
-
|---|---|
|
|
130
|
-
| `CODEDROID_SERIAL` | The device the `adb` tool uses when several are on adb (`ANDROID_SERIAL` works too) |
|
|
131
|
-
| `CODEDROID_MCP_PORT` | The daemon's port (default 4826) |
|
|
132
|
-
| `CODEDROID_MCP_ADB=0` | Leave out the `adb` tool |
|
|
133
|
-
| `CODEDROID_MCP_CLIENT` | How the phone names your agent ("Claude Code on borna-mbp") |
|
|
134
|
-
| `ADB` | The adb binary, if not on PATH |
|
|
135
|
-
| `CODEDROID_DEBUG=1` | Stack traces on failure |
|
|
56
|
+
Then try:
|
|
136
57
|
|
|
137
|
-
|
|
58
|
+
- “Open Android Settings and check the Android version.”
|
|
59
|
+
- “Open my app, navigate to sign-in, and take a screenshot.”
|
|
60
|
+
- “Install this APK, launch it, and check for crashes.”*
|
|
138
61
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
├── adb tool: this computer's adb
|
|
142
|
-
└── wss://<CodeDroid server>/v1/mcp/connect
|
|
143
|
-
└── relay ── CodeDroid on the phone (its own WebSocket)
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
- Each client's `codedroid-mcp` starts the shared daemon if it is not running and proxies to it,
|
|
147
|
-
so every client on the computer shares one connection to the phone, and tool calls run one at
|
|
148
|
-
a time. The daemon logs to `~/.codedroid/daemon.log`.
|
|
149
|
-
- The phone keeps a WebSocket open to the CodeDroid server and opens it again by itself after a
|
|
150
|
-
reboot or a network change. The daemon opens one too, with this computer's key from pairing,
|
|
151
|
-
and the server relays between them. Nothing listens on the phone or on this computer's network.
|
|
152
|
-
- The server tells the phone which computer is connecting; the phone answers (Allow, the first
|
|
153
|
-
time), then each WebSocket message is one JSON-RPC message.
|
|
154
|
-
- A call whose link drops mid-way is not retried: a tap whose answer was lost still happened.
|
|
155
|
-
The agent is told so, and reads the screen before trying again.
|
|
156
|
-
|
|
157
|
-
## When it does not connect
|
|
62
|
+
*Installing APKs and using `adb` also requires Android platform-tools and a USB or wireless
|
|
63
|
+
debugging connection. See [adb setup](docs/reference.md#adb-setup).
|
|
158
64
|
|
|
159
|
-
|
|
65
|
+
## Need help?
|
|
160
66
|
|
|
161
|
-
|
|
162
|
-
- "The phone is not connected to CodeDroid": open CodeDroid on the phone, and check it is online,
|
|
163
|
-
signed in, and "Allow computers to connect" is on in Settings > Computers.
|
|
164
|
-
- "Not allowed on the phone" or "Stopped on the phone": the phone said no; wait a minute.
|
|
165
|
-
- `am force-stop com.codedroid.app`, or `am instrument` against it, switches its accessibility
|
|
166
|
-
off; turn it on again in Settings > Accessibility. (`pm clear` also signs it out.)
|
|
167
|
-
- `uiautomator dump`, and tests that use UiAutomator, suspend CodeDroid's accessibility while they
|
|
168
|
-
run; its tools work again once they finish.
|
|
169
|
-
|
|
170
|
-
## Developing
|
|
67
|
+
Check your connection:
|
|
171
68
|
|
|
172
69
|
```bash
|
|
173
|
-
|
|
174
|
-
npm test # no phone, server or adb needed
|
|
175
|
-
claude mcp add codedroid -- node "$PWD/src/index.js"
|
|
70
|
+
npx -y @codedroid/mcp status
|
|
176
71
|
```
|
|
177
72
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
73
|
+
Manage or revoke computer access in **CodeDroid → Settings → Computers**.
|
|
74
|
+
|
|
75
|
+
See the [reference guide](docs/reference.md) for tools, manual setup, configuration,
|
|
76
|
+
[troubleshooting](docs/reference.md#troubleshooting), and development.
|
|
77
|
+
|
|
78
|
+
## License
|
|
182
79
|
|
|
183
|
-
|
|
184
|
-
[aura-mcp-connect](https://github.com/Dinesh210805/aura-android-use/tree/main/aura-mcp-connect)
|
|
185
|
-
(MIT, Copyright (c) 2026 Dinesh Kumar C; `LICENSE.aura-mcp-connect`).
|
|
80
|
+
[MIT](LICENSE) © 2026 CodeDroid
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# CodeDroid MCP reference
|
|
2
|
+
|
|
3
|
+
[Back to setup](../README.md)
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
The agent can interact with the phone one step at a time or use `run_task` to delegate a goal
|
|
8
|
+
to CodeDroid's agent. `run_task` returns a task ID. Use `get_task` to wait for completion and
|
|
9
|
+
read progress, or `cancel_task` to stop the task.
|
|
10
|
+
|
|
11
|
+
| Tool | Description |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `get_screen` | Read the current app and screen as numbered accessibility elements; optionally include a screenshot. |
|
|
14
|
+
| `take_screenshot` | Capture a JPEG screenshot. |
|
|
15
|
+
| `tap`, `long_press` | Interact with an element by node, text, resource ID, content description, or screen coordinates. |
|
|
16
|
+
| `type_text` | Enter text in the focused field; optionally clear it first or press Enter afterward. |
|
|
17
|
+
| `swipe` | Swipe or scroll between screen coordinates. |
|
|
18
|
+
| `press_key` | Press Back, Home, Enter, or Recents. |
|
|
19
|
+
| `open_app`, `list_apps` | Launch an app by package name or list installed apps. |
|
|
20
|
+
| `wait_for` | Wait for text to appear or disappear, or for an app to open. |
|
|
21
|
+
| `clipboard` | Read or update the clipboard. |
|
|
22
|
+
| `device_info` | Inspect the device model, Android version, user, screen, lock state, and CodeDroid readiness. |
|
|
23
|
+
| `run_task`, `get_task`, `cancel_task` | Start, monitor, or cancel a task run by CodeDroid's agent. |
|
|
24
|
+
| `adb` | Run local adb commands against the connected phone. |
|
|
25
|
+
| `codedroid_status` | Check the phone connection and get instructions for resolving connection problems. |
|
|
26
|
+
|
|
27
|
+
Screen interaction tools return an `after` observation with the current app, keyboard state,
|
|
28
|
+
screen changes, and visible elements. Phone tool errors include an error code, message, and
|
|
29
|
+
hint for recovery.
|
|
30
|
+
|
|
31
|
+
## Manage access
|
|
32
|
+
|
|
33
|
+
Paired computers appear in **Settings → Computers** on the phone.
|
|
34
|
+
|
|
35
|
+
- **Remove** revokes a computer's access. Pair again to reconnect it.
|
|
36
|
+
- **Stop** disconnects the active computer and blocks it for one minute.
|
|
37
|
+
- **Allow computers to connect** turns computer access on or off.
|
|
38
|
+
|
|
39
|
+
CodeDroid displays the computer's name and a Stop button while it acts on the phone.
|
|
40
|
+
|
|
41
|
+
## adb setup
|
|
42
|
+
|
|
43
|
+
The optional `adb` tool requires [Android platform-tools](https://developer.android.com/tools/releases/platform-tools)
|
|
44
|
+
on your computer and a USB or wireless debugging connection to your phone.
|
|
45
|
+
|
|
46
|
+
For USB, enable **USB debugging** in the phone's Developer options, connect the cable, and
|
|
47
|
+
accept the debugging prompt on the phone. Run `adb devices` to check the connection.
|
|
48
|
+
For wireless debugging, see [troubleshooting](#troubleshooting).
|
|
49
|
+
|
|
50
|
+
## MCP configuration
|
|
51
|
+
|
|
52
|
+
Use these options when you want the MCP server without a plugin or extension. Configure one
|
|
53
|
+
installation method per client to avoid registering the tools twice.
|
|
54
|
+
|
|
55
|
+
### Standalone Claude Code server
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add codedroid -- npx -y @codedroid/mcp
|
|
59
|
+
npx -y @codedroid/mcp skill install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The optional second command installs the two skills in `~/.claude/skills`.
|
|
63
|
+
|
|
64
|
+
### Standalone Codex server
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
codex mcp add codedroid -- npx -y @codedroid/mcp
|
|
68
|
+
npx -y @codedroid/mcp skill install --codex
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The optional second command installs the skills in `~/.codex/skills`. For calls longer than Codex's
|
|
72
|
+
60-second default timeout, such as APK installation, set `tool_timeout_sec` in
|
|
73
|
+
`~/.codex/config.toml`:
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
[mcp_servers.codedroid]
|
|
77
|
+
command = "npx"
|
|
78
|
+
args = ["-y", "@codedroid/mcp"]
|
|
79
|
+
tool_timeout_sec = 300
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Standalone Gemini CLI server
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
gemini mcp add --scope user --timeout 300000 codedroid npx -y @codedroid/mcp
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Other MCP clients
|
|
89
|
+
|
|
90
|
+
Add this server configuration to your client's MCP settings:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"codedroid": {
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "@codedroid/mcp"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Clients that support Streamable HTTP can also connect to `http://127.0.0.1:4826/mcp`.
|
|
104
|
+
After pairing, run `npx -y @codedroid/mcp connect` to start the shared daemon before connecting
|
|
105
|
+
an HTTP client.
|
|
106
|
+
|
|
107
|
+
### Environment variables
|
|
108
|
+
|
|
109
|
+
| Variable | Description |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| `CODEDROID_SERIAL` | Select an adb device when several are connected. `ANDROID_SERIAL` is also supported. |
|
|
112
|
+
| `CODEDROID_MCP_PORT` | Set the local daemon port. Default: `4826`. |
|
|
113
|
+
| `CODEDROID_MCP_ADB=0` | Disable the `adb` tool. |
|
|
114
|
+
| `CODEDROID_MCP_CLIENT` | Set the client name shown on the phone. |
|
|
115
|
+
| `ADB` | Set the path to the adb executable. |
|
|
116
|
+
| `CODEDROID_DEBUG=1` | Include stack traces in diagnostic output. |
|
|
117
|
+
|
|
118
|
+
## CLI reference
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx -y @codedroid/mcp pair ABCD-EFGH
|
|
122
|
+
npx -y @codedroid/mcp connect
|
|
123
|
+
npx -y @codedroid/mcp status
|
|
124
|
+
npx -y @codedroid/mcp call get_screen
|
|
125
|
+
npx -y @codedroid/mcp call tap '{"text": "Display"}'
|
|
126
|
+
npx -y @codedroid/mcp stop
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`connect` reconnects a paired computer. `stop` shuts down the local daemon.
|
|
130
|
+
|
|
131
|
+
## Troubleshooting
|
|
132
|
+
|
|
133
|
+
Run `npx -y @codedroid/mcp status` or call `codedroid_status` from your agent to diagnose a
|
|
134
|
+
connection problem.
|
|
135
|
+
|
|
136
|
+
| Problem | Action |
|
|
137
|
+
| --- | --- |
|
|
138
|
+
| Computer is not paired, or pairing was removed | Create a new code in **Settings → Computers → Pair a computer** and run the displayed command. |
|
|
139
|
+
| Phone is not connected | Open CodeDroid, check its internet connection and sign-in, and enable **Allow computers to connect**. |
|
|
140
|
+
| Connection is awaiting approval | Tap **Allow** on the phone. |
|
|
141
|
+
| Connection was denied | Wait one minute, run `npx -y @codedroid/mcp connect`, then tap **Allow**. |
|
|
142
|
+
| Connection was stopped on the phone | Wait one minute before reconnecting. |
|
|
143
|
+
| adb cannot find the phone | Connect it over USB, or run `adb pair <ip:port>` followed by `adb connect <ip:port>` for wireless debugging. |
|
|
144
|
+
|
|
145
|
+
Force-stopping or running instrumentation against `com.codedroid.app` disables its accessibility
|
|
146
|
+
service. Re-enable it in Android Accessibility settings afterward. Clearing the app's data also
|
|
147
|
+
signs it out. UiAutomator tests and `uiautomator dump` temporarily suspend CodeDroid's
|
|
148
|
+
accessibility access while they run.
|
|
149
|
+
|
|
150
|
+
## Architecture
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
MCP client → stdio bridge → local daemon → CodeDroid relay → Android app
|
|
154
|
+
└── local adb
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
All clients on a computer share a local daemon and its connection to the paired phone. The
|
|
158
|
+
phone and daemon each open an outbound WebSocket to the CodeDroid server. The phone reconnects
|
|
159
|
+
after a restart or network change. MCP screen interactions are serialized on the phone.
|
|
160
|
+
|
|
161
|
+
Calls interrupted by a connection loss are not automatically replayed: an action may have
|
|
162
|
+
completed before its response was lost. Read the screen before deciding whether to retry.
|
|
163
|
+
|
|
164
|
+
Pairing credentials are stored in `~/.codedroid/host.json`, readable only by your user account.
|
|
165
|
+
Daemon logs are written to `~/.codedroid/daemon.log`.
|
|
166
|
+
|
|
167
|
+
## Development
|
|
168
|
+
|
|
169
|
+
From the package directory:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm install
|
|
173
|
+
npm test
|
|
174
|
+
claude mcp add codedroid -- node "$PWD/src/index.js"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The npm tests run without a phone, relay server, or adb. In the monorepo, the Android app's MCP
|
|
178
|
+
JVM tests also verify the bridge against the app's server implementation and export the tool
|
|
179
|
+
fixture used by the skill tests. Install the package's npm dependencies before running those
|
|
180
|
+
contract tests from `CodeDroid-app/`:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
./gradlew :app:testDebugUnitTest --tests 'com.codedroid.app.mcp.*'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
These tests export `test/fixtures/phone-tools.json` and run `test/phone-contract.mjs` against
|
|
187
|
+
the app's MCP server through a test relay.
|
|
188
|
+
|
package/gemini-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codedroid/mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "MCP server for controlling Android devices through CodeDroid from Claude Code, Codex, Gemini CLI, and other MCP clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"gemini-extension.json",
|
|
17
17
|
".mcp.json",
|
|
18
18
|
"README.md",
|
|
19
|
-
"
|
|
19
|
+
"docs",
|
|
20
|
+
"LICENSE"
|
|
20
21
|
],
|
|
21
22
|
"engines": {
|
|
22
23
|
"node": ">=20"
|
|
@@ -42,5 +43,6 @@
|
|
|
42
43
|
"repository": {
|
|
43
44
|
"type": "git",
|
|
44
45
|
"url": "git+https://github.com/codedroid-team/codedroid-mcp.git"
|
|
45
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"license": "MIT"
|
|
46
48
|
}
|
package/src/adb-tool.js
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* adb — a single generic MCP tool that runs an adb command against a phone
|
|
3
3
|
* attached to THIS computer (USB, or Wireless Debugging).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* (CODEDROID_MCP_ADB=0 turns it off); marked destructive so clients ask before running
|
|
8
|
-
* it; a per-call timeout.
|
|
5
|
+
* Enabled by default (CODEDROID_MCP_ADB=0 turns it off), with a per-call timeout.
|
|
6
|
+
* Marked destructive so clients ask before running it.
|
|
9
7
|
*
|
|
10
8
|
* It never touches the connection to CodeDroid: it shells out to this machine's
|
|
11
9
|
* own `adb`, exactly like a developer typing `adb install app.apk` themselves.
|
package/src/daemon.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
* CodeDroid on the phone (through the CodeDroid server's relay) and serves MCP over
|
|
4
4
|
* Streamable HTTP on localhost.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* LICENSE.aura-mcp-connect): the link is a WebSocket relay instead of WebRTC, and the adb tool is
|
|
8
|
-
* on by default.
|
|
6
|
+
* The phone connection uses a WebSocket relay. The adb tool is enabled by default.
|
|
9
7
|
*
|
|
10
8
|
* Every MCP client (Claude Code, Claude Desktop, Cursor, VS Code windows…)
|
|
11
9
|
* connects to http://127.0.0.1:<port>/mcp and gets its own MCP session; tool
|
package/src/index.js
CHANGED
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
* leaves out the adb tool. CODEDROID_SERIAL picks the adb tool's device when several are attached.
|
|
22
22
|
*
|
|
23
23
|
* All log output goes to stderr — stdout is reserved for MCP JSON-RPC frames.
|
|
24
|
-
*
|
|
25
|
-
* Forked from aura-mcp-connect (MIT, Copyright (c) 2026 Dinesh Kumar C; see LICENSE.aura-mcp-connect).
|
|
26
24
|
*/
|
|
27
25
|
import { VERSION } from "./version.js";
|
|
28
26
|
|
package/src/proxy-core.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* proxy-core — builds an MCP Server that transparently forwards requests to a
|
|
3
3
|
* backend MCP Client (the single phone connection).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* instructions, and tools/list keeps trying the phone.
|
|
5
|
+
* A session still opens when the phone cannot be reached, serving the local tools
|
|
6
|
+
* (adb, codedroid_status) and saying why in its instructions. tools/list keeps
|
|
7
|
+
* trying the phone.
|
|
9
8
|
*
|
|
10
9
|
* Used twice:
|
|
11
10
|
* - daemon: one proxy Server per HTTP client session → phone client
|
package/src/skill.js
CHANGED
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
* or any directory (--dir).
|
|
8
8
|
* - Change together: the skills name tools, so a renamed tool means editing them
|
|
9
9
|
* (test/skill.test.mjs checks every name they use exists).
|
|
10
|
-
*
|
|
11
|
-
* Forked from aura-mcp-connect's skill.js (MIT, Copyright (c) 2026 Dinesh Kumar C; see
|
|
12
|
-
* LICENSE.aura-mcp-connect).
|
|
13
10
|
*/
|
|
14
11
|
import fs from "fs";
|
|
15
12
|
import os from "os";
|
package/src/stdio-shim.js
CHANGED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
*
|
|
6
6
|
* IDE ── stdio ── this shim ── HTTP ── daemon ── relay ── CodeDroid on the phone
|
|
7
7
|
*
|
|
8
|
-
* Forked from aura-mcp-connect (MIT, Copyright (c) 2026 Dinesh Kumar C; see
|
|
9
|
-
* LICENSE.aura-mcp-connect).
|
|
10
|
-
*
|
|
11
8
|
* Any number of shims (one per IDE/window) share the one phone connection.
|
|
12
9
|
*/
|
|
13
10
|
import { spawn } from "child_process";
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The bridge's version, sent to the phone in its hello and shown by `--version`. */
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.2";
|