Architecture
MCP Protocol
Section titled “MCP Protocol”Android Pilot MCP implements the Model Context Protocol — a standard for connecting AI editors to external tools.
How It Works
Section titled “How It Works”- Your AI editor (Claude Code, Cursor, etc.) starts the MCP server as a subprocess
- Communication happens over stdio (stdin/stdout)
- The editor sends JSON-RPC requests describing which tool to call
- The server executes the tool (runs adb, Gradle, etc.) and returns results
- The editor uses the results to answer your question or complete the task
Transport
Section titled “Transport”Android Pilot uses stdio transport — the simplest and most compatible option. The server reads from stdin and writes to stdout.
Project Structure
Section titled “Project Structure”android-pilot-mcp/├── src/│ ├── index.ts # Entry point, MCP server setup│ ├── tools/ # Tool implementations│ │ ├── build.ts # Gradle build tools│ │ ├── device.ts # Device management tools│ │ ├── debug.ts # Debugging tools│ │ ├── scaffold.ts # Code scaffolding tools│ │ ├── analyze.ts # APK analysis tools│ │ ├── intent.ts # Intent and deep link tools│ │ └── sdk.ts # SDK management tools│ ├── utils/ # Shared utilities│ │ ├── android-sdk.ts # SDK path detection│ │ ├── exec.ts # Command execution│ │ └── validation.ts # Input validation│ └── templates/ # Scaffolding templates├── tests/ # Vitest test suite├── docs/ # This documentation site└── build/ # Compiled outputSecurity Model
Section titled “Security Model”- All tool inputs are validated using Zod schemas
- File paths are validated to prevent path traversal
- Shell commands are executed with proper escaping
- The server runs with the same permissions as your user account
- No network access is required — all communication is local via stdio