Termux MCP Server
Provides tools to control an Android device via Termux:API, including battery status, torch, screen brightness, volume, contacts, call logs, SMS, location, Wi-Fi info, telephony info, camera, TTS, notifications, dialogs, clipboard, and arbitrary shell commands.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Termux MCP ServerWhat's my phone's battery level?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Termux API & PRoot-Distro Ubuntu with MCP Server
This project provides a bootstrap script to install Ubuntu under proot-distro on Android via Termux, bind Android system APIs into it, and launch a Python-based Model Context Protocol (MCP) server.
With this MCP server running on your phone, you can grant any external AI client (like Cursor, Claude Desktop, Windsurf, or custom HTTP agents) full capability to control your Android device's hardware, read sensors, fetch communications, and execute shell commands.
Quick Start (Three-Step Setup)
Step 1: Install and Configure Ubuntu on Termux
Run this command inside your native Termux terminal to install, configure, and log in to Ubuntu. (This downloads the script first so that stdin stays attached to your keyboard, allowing it to correctly log you in.)
curl -sLO https://raw.githubusercontent.com/AbuZar-Ansarii/Termux-MCP/main/install_ubuntu.sh && chmod +x install_ubuntu.sh && ./install_ubuntu.shOnce this script completes, it will automatically log you into Ubuntu, leaving you at the prompt:
root@localhost:~#
Step 2: Clone and Setup MCP (Inside Ubuntu)
Once inside the Ubuntu container (root@localhost:~#), copy and paste this command to clone the repository, run the setup script, and activate the virtual environment:
git clone https://github.com/AbuZar-Ansarii/Termux-MCP.git && cd Termux-MCP && chmod +x setup_mcp.sh && ./setup_mcp.sh && source venv/bin/activate(Appending the source venv/bin/activate statement ensures that it runs in your parent shell context. Once completed, you will find yourself inside the activated virtual environment at the prompt: (venv)root@localhost:~/Termux-MCP#.)
Step 3: Run the MCP Server
While inside the active virtual environment, run the server directly:
python termux_mcp.py --transport sseOnce running, the server will detect your phone's IP address and display a copy-pasteable connection URL (e.g., http://192.168.1.15:8000/sse) to plug directly into your AI client!
Future Shortcut Command
For future runs (from native Termux, without manually logging in and activating), you can start the server in one command:
proot-distro login ubuntu -- bash /root/run_mcp.shRelated MCP server: android-shizuku-mcp
Why PRoot-Distro Ubuntu?
Running a Linux distribution like Ubuntu inside Termux using proot-distro offers several key benefits:
Glibc (GNU C Library) Compatibility: Android and native Termux use Bionic libc, which differs in paths and standards. Many compiled packages, database binaries, Node modules, and Python libraries require standard
glibcto run without compilation failures. PRoot-Distro Ubuntu provides a standardglibcenvironment.Package Abundance & Ecosystem: Ubuntu gives you access to the massive
aptpackage archives. If your workflow requires standard Linux server tooling, desktop packages, or compiled services, running them in Ubuntu rootfs is far more robust than patching them for native Android/Bionic.Isolation & Sandbox: Developing inside PRoot Ubuntu keeps your host Termux filesystem clean and modular. If something breaks or you want a fresh start, you can simply reset the distribution container without losing your Termux configurations.
Hardware API Bridging: Our bootstrap script binds the Termux native
$PREFIXfolder into Ubuntu. This means you get the best of both worlds: a full-featured Ubuntu Linux environment that still has direct command-line access to Android APIs (like camera, toast, location, and sensors).
Features (MCP Tools)
The MCP server exposes a complete set of tools to control your phone:
System & Hardware:
get_battery_status: Read device battery level, health, temperature, and charging status.toggle_torch: Turn the flashlight/torch ON or OFF.set_screen_brightness: Change the screen brightness (0-255).get_volume_info&set_volume: Read or set levels for alarm, music, ring, call, system, and notification volume streams.
Communication:
list_contacts: List all contact names and phone numbers stored on the phone.get_call_log: Retrieve recent call history.list_sms&send_sms: List inbox/sent messages and send new text messages.
Sensors & Network:
get_location: Retrieve precise GPS or network-based coordinates.get_wifi_connection_info: Get Wi-Fi connection metadata (SSID, BSSID, IP, link speed).get_telephony_device_info: Query telephony carrier, signal strength, and network type.
Media & Photos:
take_photo: Snap front or rear camera photos and save them to a file path on the device.tts_speak: Synthesize spoken speech using Google TTS.
User Interaction & Clipboard:
show_toast: Display temporary toast notifications on the phone screen.vibrate_phone: Vibrate the device for a set duration.clipboard_get&clipboard_set: Read and write the Android clipboard.show_notification: Display standard Android notifications.prompt_user_dialog: Display an interactive text input dialog on the phone, letting you type a response back to the AI client.share_text: Share text directly into Android's native share sheet.
Arbitrary Execution:
execute_command: Run any arbitrary shell command directly in the native Termux host.
Detailed Step-by-Step Installation
Step 1: Install Termux & Termux:API on Android
Install the Termux app and the Termux:API app.
Required: Install both apps from F-Droid (do not mix F-Droid and Play Store versions, as they will not sign/bind together).
Go to Android Settings -> Apps -> Termux:API -> Permissions:
Grant Camera, Location, SMS, Contacts, and Storage permissions.
Disable Battery Optimization for both Termux and Termux:API to prevent Android from closing the background services.
Step 2: Run the Setup Script
Open Termux and paste the following command:
curl -sLO https://raw.githubusercontent.com/AbuZar-Ansarii/Termux-MCP/main/install_ubuntu.sh && chmod +x install_ubuntu.sh && ./install_ubuntu.shStep 3: Run the MCP Server Setup
Once inside the Ubuntu container:
git clone https://github.com/AbuZar-Ansarii/Termux-MCP.git && cd Termux-MCP && chmod +x setup_mcp.sh && ./setup_mcp.sh && source venv/bin/activateStep 4: Launch the Server
In the activated environment ((venv)root@localhost:~/Termux-MCP#):
python termux_mcp.py --transport sseThe terminal will print the connection URL:
==================================================================
๐ค Termux MCP Server Running in SSE Mode
==================================================================
๐ SSE Connect URL: http://192.168.1.15:8000/sse
๐ Messages URL: http://192.168.1.15:8000/messages/
==================================================================Step 5: Connect to Your AI Client
You can connect any client that supports MCP over Server-Sent Events (SSE).
Connecting Cursor:
Open Cursor Settings -> Features -> MCP.
Click + Add New MCP Server.
Enter:
Name:
termux-mcpType:
SSEURL:
http://YOUR_PHONE_IP:8000/sse(Copy-paste the 'SSE Connect URL' printed by the server)
Click Save.
Connecting Claude Desktop (Alternative Stdio over SSH)
If you prefer running local stdio commands piped over SSH, see Option B in the repository documentation to set up OpenSSH keys and configure your local %APPDATA%\Claude\claude_desktop_config.json.
Troubleshooting
Tool call hangs: If a tool call (like
get_locationortake_photo) hangs, verify the Termux:API app has permissions granted in Android settings and battery saver is off.Connection Refused: Ensure your PC and phone are connected to the same Wi-Fi network and that the server is running.
Termux Background Execution: Android may suspend Termux processes when the screen is locked. Pull down the Android notification drawer and make sure Termux shows "1 session" with "Acquire wake lock" enabled, keeping it running in the background.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to directly control Android devices via Termux, providing 120+ tools for screen manipulation, file management, app control, and system operations with layered loading and security gating.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLM agents to control Android devices securely via Shizuku and Termux:API, providing a universal shell tool for command execution and persistent sessions.4Apache 2.0
- FlicenseNot gradedqualityAmaintenanceGives an agent full shell access on Termux with file read/write/edit capabilities.2
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to control Android phones via MCP and HTTP. Supports screen capture, taps, swipes, text input, and app management.AGPL 3.0
Related MCP Connectors
Control Android TV from any AI. 38 MCP tools: playback, recap, recommend, smart-home, schedules.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Phone, SMS & email for AI agents โ one remote MCP endpoint, OAuth login, zero install.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AbuZar-Ansarii/Termux-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server