adb_connect_wifi
Connect to Android devices over WiFi using ADB for remote management and control. Provide the device's IP address to establish wireless connectivity.
Instructions
Connect to an Android device over WiFi using ADB
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip_address | Yes | IP address of the Android device | |
| port | No | Port number (default: 5555) | 5555 |
Implementation Reference
- src/index.ts:121-141 (handler)Handler for the adb_connect_wifi tool: executes `adb connect` command with provided IP and port, handles errors, and returns success message.case "adb_connect_wifi": { const { ip_address, port = "5555" } = args as { ip_address: string; port?: string; }; const { stdout, stderr } = await execAsync(`adb connect ${ip_address}:${port}`); if (stderr && stderr.includes("failed")) { throw new McpError(ErrorCode.InternalError, `ADB connection failed: ${stderr}`); } return { content: [ { type: "text", text: `Successfully connected to ${ip_address}:${port}\n${stdout}`, }, ], }; }
- src/index.ts:32-50 (schema)Schema definition for adb_connect_wifi tool, including input schema with ip_address (required) and optional port.{ name: "adb_connect_wifi", description: "Connect to an Android device over WiFi using ADB", inputSchema: { type: "object", properties: { ip_address: { type: "string", description: "IP address of the Android device", }, port: { type: "string", description: "Port number (default: 5555)", default: "5555", }, }, required: ["ip_address"], }, },
- src/index.ts:29-114 (registration)Registration of adb_connect_wifi tool in the ListTools response.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "adb_connect_wifi", description: "Connect to an Android device over WiFi using ADB", inputSchema: { type: "object", properties: { ip_address: { type: "string", description: "IP address of the Android device", }, port: { type: "string", description: "Port number (default: 5555)", default: "5555", }, }, required: ["ip_address"], }, }, { name: "adb_screenshot", description: "Take a screenshot of the connected Android device", inputSchema: { type: "object", properties: { output_path: { type: "string", description: "Local path to save the screenshot (default: screenshot.png)", default: "screenshot.png", }, device_id: { type: "string", description: "Device ID/serial (optional, uses first device if not specified)", }, }, required: [], }, }, { name: "adb_list_devices", description: "List all connected ADB devices", inputSchema: { type: "object", properties: {}, required: [], }, }, { name: "adb_disconnect", description: "Disconnect from a WiFi ADB device", inputSchema: { type: "object", properties: { ip_address: { type: "string", description: "IP address of the device to disconnect from", }, port: { type: "string", description: "Port number (default: 5555)", default: "5555", }, }, required: ["ip_address"], }, }, { name: "adb_device_info", description: "Get information about a connected device", inputSchema: { type: "object", properties: { device_id: { type: "string", description: "Device ID/serial (optional, uses first device if not specified)", }, }, required: [], }, }, ], }; });