Termux AI server: REST API daemon (termux-mcp) + native MCP server (termux-native-mcp) — let AI agents run shell commands on your Android device in real time
pip install termux-mcp==0.11.4 Copy PIP instructions
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 -+ Two commands — which do I run? Command What it is termux-mcp REST API daemon on :8080 (this README's endpoints) termux-native-mcp Native MCP server (Model Context Protocol, spec 2025-06-18) for MCP clients: RikkaHub, desktop AI apps (Cursor, ...) Both install together via pkg install termux-mcp and run as separate processes — starting termux-native-mcp never touches the REST daemon's port, state or behavior.
termux-mcp # REST API on 127.0.0.1:8080 termux-native-mcp # native MCP, Streamable HTTP on 127.0.0.1:8081 termux-native-mcp --stdio # native MCP over stdin/stdout (desktop clients) RikkaHub (same phone):
{ "type": "http", "url": "http://127.0.0.1:8081/mcp", "commonOptions": { "name": "Termux", "enable": true, "headers": [["Authorization", "Bearer "]] } } Desktop MCP client (over ssh): {"command": "ssh", "args": ["android", "termux-native-mcp", "--stdio"]}
Full guide, env vars and tool list: docs/mcp.md. Both servers share the same safety system (risk gates, file snapshots, trash) because they run the same handler code.
pkg update && pkg install python -y pip install termux-mcp termux-mcp This installs a global termux-mcp command — it runs from any directory, and pip install -U termux-mcp upgrades it.
pkg update && pkg install python git -y git clone https://github.com/termuxgpt/termux-mcp cd termux-mcp pip install . termux-mcp pip install . registers the command globally, so the cd is only needed for the install itself. Without it, python -m termux_mcp only works from inside the clone.
curl -fSL https://termux-mcp.pages.dev/add-repo.sh | bash pkg install termux-mcp termux-mcp Quick Test curl http://localhost:8080/ping curl -X POST http://localhost:8080/run -H "Content-Type: application/json" -d '{"cmd": "ls ~"}' Termux Tutorial Apps (AD) Configuration Variable Default Description TERMUX_MCP_PORT 8080 HTTP listen port TERMUX_MCP_HOST 127.0.0.1 Bind address. Use 127.0.0.1 for local-only. TERMUX_MCP_TIMEOUT 0 Command timeout in seconds. 0 = no timeout (default) — long operations like pkg upgrade run until they finish. Set a positive value to re-enable the watchdog kill. TERMUX_MCP_AUTH_TOKEN (none) Bearer token for authentication TERMUX_MCP_MAX_OUTPUT 20000 Max streamed output bytes per command. Output beyond this is drained (process keeps running) but not sent; a truncation marker is appended. Keeps LLM tool results small and token-efficient. 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.
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.
GNU Affero General Public License v3.0 (AGPL-3.0)
Copyleft — anyone who distributes a modified version, or hosts it as a service (SaaS), must release their changes under the same license.
Note: versions up to 0.8.3 were released under the MIT License; those releases keep their MIT terms. AGPL-3.0 applies from 0.8.4 onward.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
The dropdown lists show the available interpreters, ABIs, and platforms.
Enable javascript to be able to filter the list of wheel files.
Copy a direct link to the current filters Copy
Details for the file termux_mcp-0.11.4.tar.gz.




