@tooldroid/adbc
v2.1.1
Published
Automatically connect Android devices over ADB TCP/IP.
Readme
ADBC
Wirelessly connect to Android devices over ADB TCP/IP - automatically detect your network gateway and switch USB-connected devices to Wi-Fi ADB.
Requirements
- Node.js >= 22
adb(Android platform-tools) in your PATH- USB debugging enabled on the target device
Installation
NPM
npm install -g @tooldroid/adbcFrom source
git clone https://github.com/ToolDroidYT/adbc.git
cd adbc
npm install
npm run build
npm linkUsage
adbcThe tool handles two scenarios:
No devices connected: Attempts to connect to <gateway>:5555 directly, in case a device was previously switched to TCP/IP mode.
One or more USB devices connected:
- Detects your default gateway IP
- If multiple devices are found, prompts you to select one
- Switches the selected device to TCP/IP mode on port 5555
- Connects to the device wirelessly via
adb connect <gateway>:5555
Platform Support
| Platform | Gateway detection |
| ---------------- | ------------------------------------------ |
| Linux | ip route → /proc/net/route → netstat |
| Android (Termux) | ip route → /proc/net/route → netstat |
| macOS | netstat -nr -f inet |
| Windows | ipconfig → netstat -rn |
Linux and Android (Termux) use a fallback chain: primary method via ip route show default, then /proc/net/route parsing, then netstat -rn.
Detected gateways are validated as IPv4 addresses, because adb connect requires an IPv4 host. IPv6 default routes (for example a Windows fe80:: gateway), 0.0.0.0 and link-local/APIPA (169.254.x.x) addresses are ignored.
Architecture
| Module | Purpose |
| ------------ | --------------------------------------------------------- |
| index.ts | CLI entry point and main workflow |
| adb.ts | ADB device listing, parsing, TCP/IP switching, connecting |
| network.ts | Platform-specific default gateway detection |
| command.ts | Child process runner with 30s timeout |
| ui.ts | Colored terminal output and interactive device selection |
| types.ts | TypeScript interfaces (AdbDevice, CommandResult) |
Development
npm run dev # Run without building
npm run build # Compile TypeScript + minify with esbuild
npm run start # Run compiled output
npm run test # Run tests (Vitest)
npm run test:watch # Run tests in watch mode
npm run lint # Check for lint errors (ESLint)
npm run lint:fix # Auto-fix lint errors
npm run format # Format code with Prettier
npm run typecheck # Type-check without emittingCI Pipeline
The CI runs on every push and pull request to main:
typecheck- TypeScript type checkinglint- ESLint analysisformat:check- Prettier formatting verificationbuild- Compilation and minificationtest- Unit tests- Upload
dist/as a build artifact
Contributing
- Fork the repository
- Create a feature branch
- Ensure
npm run typecheck,npm run lint,npm run format:check,npm run build, andnpm run testall pass - Submit a pull request
