Skip to content

Commit b221cd1

Browse files
committed
feat(container): add first-party Android MCP module
1 parent 85c40cb commit b221cd1

25 files changed

Lines changed: 1627 additions & 51 deletions

File tree

.changeset/mcp-android-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Add Android MCP integration alongside the existing Playwright MCP support (issue #436).
66

77
Projects can now opt into a nested Android emulator sidecar driven by the
8-
`@mobilenext/mobile-mcp` server, mirroring how Playwright MCP works. Enable it
8+
first-party Rust `android-connection` MCP server, mirroring how Playwright MCP works. Enable it
99
with the new `--mcp-android` / `--no-mcp-android` create flags, the `mcp-android`
1010
subcommand, the interactive create-flow prompt, or the `enableMcpAndroid` field
1111
on the web/API create-project request. When enabled, the generated

.github/workflows/check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ jobs:
3939
- name: Build (api)
4040
run: bun run --cwd packages/api build
4141

42+
rust-android-connection:
43+
name: Rust Android connection
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 10
46+
steps:
47+
- uses: actions/checkout@v6
48+
- name: Rust version
49+
run: |
50+
rustc --version
51+
cargo --version
52+
- name: Format
53+
working-directory: crates/android-connection
54+
run: cargo fmt --check
55+
- name: Test
56+
working-directory: crates/android-connection
57+
run: cargo test --locked
58+
- name: Clippy
59+
working-directory: crates/android-connection
60+
run: cargo clippy --locked --all-targets -- -D warnings
61+
4262
dist-deps-prune:
4363
name: Dist deps prune
4464
runs-on: ubuntu-latest

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bun run docker-git clone https://github.com/ProverCoderAI/docker-git/issues/122
7171

7272
- `--force` пересоздаёт окружение и удаляет volumes проекта.
7373
- `--mcp-playwright` включает Playwright MCP и Chromium sidecar для браузерной автоматизации.
74-
- `--mcp-android` включает Android MCP (`@mobilenext/mobile-mcp`) и вложенный sidecar с Android-эмулятором (`docker-android`) для мобильной автоматизации.
74+
- `--mcp-android` включает first-party Android MCP (`android-connection`) и вложенный sidecar с Android-эмулятором (`docker-android`) для мобильной автоматизации.
7575

7676
Автоматический запуск агента:
7777

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

crates/android-connection/Cargo.lock

Lines changed: 249 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "docker-git-android-connection"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "First-party Android MCP and lifecycle module for docker-git"
6+
license = "MIT"
7+
repository = "https://github.com/ProverCoderAI/docker-git"
8+
9+
[lib]
10+
name = "docker_git_android_connection"
11+
path = "src/lib.rs"
12+
13+
[[bin]]
14+
name = "docker-git-android-connection"
15+
path = "src/main.rs"
16+
17+
[[bin]]
18+
name = "android-connection"
19+
path = "src/bin/android-connection.rs"
20+
21+
[dependencies]
22+
clap = { version = "4.5.53", features = ["derive"] }
23+
serde = { version = "1.0.228", features = ["derive"] }
24+
serde_json = "1.0.145"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# docker-git Android connection
2+
3+
First-party Android MCP module for docker-git.
4+
5+
The crate provides two binaries:
6+
7+
- `android-connection`: MCP stdio server used by Codex, Claude, Gemini, and Grok.
8+
- `docker-git-android-connection`: lifecycle CLI for deterministic Android runtime naming and Docker command construction.
9+
10+
The core module keeps deterministic naming, endpoint validation, and tool specifications pure. Shell effects are isolated in the binaries and MCP tool handlers.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use clap::Parser;
2+
use docker_git_android_connection::mcp::{run_stdio, McpState};
3+
use docker_git_android_connection::{
4+
android_spec, DEFAULT_ADB_ENDPOINT, DEFAULT_ANDROID_IMAGE, DEFAULT_PROJECT_ID,
5+
};
6+
use std::io::{self, BufReader};
7+
use std::path::PathBuf;
8+
use std::process::ExitCode;
9+
10+
#[derive(Parser, Debug)]
11+
#[command(version, about = "Android MCP stdio server for docker-git")]
12+
struct Cli {
13+
#[arg(long, default_value = DEFAULT_PROJECT_ID)]
14+
project: String,
15+
#[arg(long, default_value = "docker-git-shared")]
16+
network: String,
17+
#[arg(long, default_value = DEFAULT_ADB_ENDPOINT)]
18+
endpoint: String,
19+
#[arg(long, default_value = DEFAULT_ANDROID_IMAGE)]
20+
image: String,
21+
#[arg(long, default_value = ".")]
22+
workspace: PathBuf,
23+
#[arg(long)]
24+
allow_install: bool,
25+
#[arg(long)]
26+
no_adb_probe: bool,
27+
}
28+
29+
fn main() -> ExitCode {
30+
match run() {
31+
Ok(()) => ExitCode::SUCCESS,
32+
Err(error) => {
33+
eprintln!("{error}");
34+
ExitCode::from(1)
35+
}
36+
}
37+
}
38+
39+
fn run() -> Result<(), Box<dyn std::error::Error>> {
40+
let cli = Cli::parse();
41+
let spec = android_spec(&cli.project, &cli.network, &cli.endpoint, &cli.image)?;
42+
let state = McpState {
43+
spec,
44+
workspace: cli.workspace,
45+
adb_probe: !cli.no_adb_probe,
46+
allow_install: cli.allow_install,
47+
};
48+
let stdin = io::stdin();
49+
let stdout = io::stdout();
50+
let mut reader = BufReader::new(stdin.lock());
51+
let mut writer = stdout.lock();
52+
run_stdio(&mut reader, &mut writer, state)?;
53+
Ok(())
54+
}

0 commit comments

Comments
 (0)