A lightweight HTTP server that runs inside Termux on Android, exposing shell execution and device capabilities as a streaming API. Built for AI agents, LLM tool-calling, and automation scripts.
AI Agent --> POST /run {"cmd": "ls -la"} --> Termux-MCP --> Termux Shell
|
<-- chunked streaming output -+
Set TERMUX_MCP_AUTH_TOKEN to a value 16+ characters long to require authentication on all endpoints. When binding to a non-loopback address, authentication is mandatory.
Endpoints
Shell & Filesystem
Endpoint
Method
Parameters
Description
/run
POST
cmd (string, required)
Execute a shell command with streaming output. Maintains persistent cd state across requests.
/ls
POST
path (string, default .), detailed (bool)
List directory contents
/read
POST
path (string, required)
Read a file (first 500 lines)
/write
POST
path, content
Write content to a file via base64 encoding
/mkdir
POST
path
Create directory (mkdir -p)
/delete
POST
path, recursive (bool), confirmed (bool)
Delete file or directory. Requires confirmation.
/search
POST
path, pattern (or query/name)
Find files by name pattern
/cancel
POST
Cancel currently running command
System Monitor & Management
Endpoint
Method
Parameters
Description
/system-info
POST
Live CPU%, RAM, disk, temperature, uptime as JSON
/process-list
POST
limit (int, default 20)
List running processes sorted by CPU usage
/process-kill
POST
pid (int), signal (int, default 15)
Terminate a process by PID
/health
POST
Full diagnostic: core packages, Termux:API, storage, network, permissions
Cron Scheduler
Endpoint
Method
Parameters
Description
/cron-add
POST
schedule, command, label
Add a cron job. Schedule format: 0 3 * * * for daily at 3am.
/cron-list
POST
List all cron jobs
/cron-remove
POST
label (optional)
Remove cron jobs matching a label, or all if no label given
Backup, Restore & Cloud Sync
Endpoint
Method
Parameters
Description
/backup
POST
target (home/packages/configs), output, include
Create a tar.gz backup of home, packages, or configs
The /run endpoint and most tool endpoints use HTTP chunked transfer encoding. Output is sent line-by-line as the command produces it. Clients should read the response as a stream and process each chunk as it arrives.
For long-running commands, a watchdog thread enforces the timeout. Package install commands automatically receive -y flags and DEBIAN_FRONTEND=noninteractive to prevent prompts.
Security
All commands are checked against a risk assessment system. Dangerous patterns (like rm -rf / or writes to /dev/) are blocked.
Paths targeting /dev/, /proc/, or /sys/ are rejected with canonical path resolution.
Numeric parameters are validated before shell interpolation to prevent injection.
When TERMUX_MCP_AUTH_TOKEN is set, all POST endpoints require a Bearer token.