mcp-android-ssh-0.1.0 is not a library.
Android SSH MCP Server
Control your Android device from AI assistants via SSH
A high-performance MCP server written in Rust that provides secure SSH access to Android devices through Termux.
Example: AI assistant listing files and exploring directories on Android
Features
- Secure SSH Connection - Key-based or password authentication
- Safe Read Commands - 81 whitelisted read-only commands (ls, cat, ps, etc.)
- Full Write Access - Execute any command including system operations
- Auto-Reconnect - Persistent connections with retry logic (3 attempts, 2s delay)
- High Performance - Memory-safe Rust implementation with zero runtime dependencies
- Timeout Controls - Configurable timeouts (1-300 seconds)
- Structured Logging - Detailed audit trail via tracing
Quick Start
Installation
Setup Android Device (Termux)
# Install and start SSH server
&&
# Find your username and IP
Configure Connection
Create a .env file in your working directory:
ANDROID_SSH_HOST=192.168.1.100
ANDROID_SSH_PORT=8022
ANDROID_SSH_USER=u0_a555
ANDROID_SSH_KEY_PATH=/.ssh/id_ed25519 # or use ANDROID_SSH_PASSWORD
Add to Claude Code
That's it! Start asking your AI assistant to interact with your Android device.
Usage Examples
Read-only operations:
- "List files in /sdcard/Download"
- "Show running processes on my Android"
- "Check disk usage on my phone"
- "Read my Termux .bashrc file"
Write operations:
- "Create a backup directory in /sdcard"
- "Install git on my Android device"
- "Download a file with curl"
- "Run system diagnostics with dumpsys"
Tools
execute_read
Execute safe, read-only commands. 81 whitelisted commands including: ls, cat, ps, grep, find, df, top, and more.
Parameters:
command(string) - The command to executetimeout(number, optional) - Timeout in seconds (default: 30, max: 300)
execute
Execute any command including write operations.
Parameters:
command(string) - The command to executetimeout(number, optional) - Timeout in seconds (default: 30, max: 300)
Security
- SSH key authentication preferred (automatic fallback to password)
- Command whitelist enforced for read-only tool
.envfile gitignored (never commit credentials)- Audit logging to stderr
- Connection retry with exponential backoff
- Use Tailscale/VPN for remote access (don't expose SSH publicly)
Prerequisites
On Android:
- Termux (F-Droid recommended)
- OpenSSH server running on port 8022
On Host:
- Rust toolchain (for
cargo install) - MCP-compatible client (Claude Code, etc.)
SSH Key Setup (Recommended)
Android (Termux):
&& &&
Host machine:
# Generate key (skip if you already have one)
# Copy to Android (enter password once, then done!)
:3