Termux MCP Server
Provides tools for controlling and automating an Android device, including UI automation (screenshot, tapping, swiping, text input), device information, location, camera, communication (SMS, contacts), system controls, and more.
Click on "Deploy 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 Server check 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 MCP Server
通过 MCP 协议让 Claude Desktop 远程控制 Android 手机。运行在 Termux 上,提供 45+ 工具,支持 UI 自动化操作。
功能
分类 | 工具 | 说明 |
📱 设备信息 |
| 电池、型号、存储 |
📍 定位 |
| GPS/网络定位 |
📶 网络 |
| WiFi、蜂窝网络 |
📦 应用 |
| 查看/启动应用 |
🖥️ UI自动化 |
| 核心:控制任意App |
⌨️ 输入 |
| 打字、按键、长按 |
🏠 导航 |
| Home/返回/最近 |
📷 相机/图片 |
| 拍照、浏览图片 |
💬 通信 |
| 短信、通讯录 |
📋 剪贴板 |
| 读写剪贴板 |
🔔 通知 |
| 发送通知/Toast |
🔊 系统控制 |
| 音量、手电筒、震动 |
🗣️ TTS |
| 文字转语音 |
🎵 媒体 |
| 播放/暂停/停止音频 |
📁 文件 |
| 文件读写 |
⚡ 命令 |
| 执行Shell命令 |
🔆 屏幕 |
| 屏幕亮度/分辨率 |
📡 传感器 |
| 读取传感器数据 |
🔗 分享 |
| 分享/下载文件 |
🔐 生物识别 |
| 指纹认证 |
Related MCP server: Android MCP Server
UI 自动化:控制任意 App
核心能力:通过截图 → 分析 → 点击的循环,可以操控手机上任意应用。
工作流程
take_screenshot → Claude 看到屏幕内容
↓
dump_ui → 获取所有UI元素及坐标
↓
tap_screen → 点击目标位置
input_text → 输入文字
↓
take_screenshot → 确认操作结果,继续下一步示例:用微信给某人发消息
Claude 会自动执行以下步骤:
open_app("com.tencent.mm")— 打开微信take_screenshot()— 查看当前屏幕dump_ui()— 获取UI元素坐标find_and_tap("通讯录")— 点击通讯录find_and_tap("搜索")— 点击搜索框input_chinese_text("张三")— 输入联系人名字find_and_tap("张三")— 点击搜索结果find_and_tap("发消息")— 点击发消息tap_screen(x, y)— 点击输入框input_chinese_text("你好,明天几点见面?")— 输入消息find_and_tap("发送")— 发送
你只需要对 Claude 说:"打开微信给张三发消息说明天几点见面",Claude 会自动完成以上全部步骤。
安装
1. 手机端 (Termux)
# 安装依赖
pkg install python termux-api
# 安装 Termux:API app (从 F-Droid)
# https://f-droid.org/packages/com.termux.api/
# 授予存储权限
termux-setup-storage
# 进入项目目录
cd ~/pypro/termux-mcp-server
# 创建虚拟环境并安装
python -m venv .venv
source .venv/bin/activate
pip install "mcp[cli]"
# 测试运行
python termux_mcp_server.py2. 远程连接 (SSH)
手机端启动 SSH 服务供电脑连接:
pkg install openssh
sshd # 默认端口 8022
whoami # 记住用户名
passwd # 设置密码
ifconfig # 记住IP地址3. 电脑端 Claude Desktop 配置
编辑 claude_desktop_config.json:
{
"mcpServers": {
"termux": {
"command": "ssh",
"args": [
"-p", "8022",
"u0_a123@192.168.1.100",
"/data/data/com.termux/files/home/pypro/termux-mcp-server/.venv/bin/python",
"/data/data/com.termux/files/home/pypro/termux-mcp-server/termux_mcp_server.py"
]
}
}
}将
u0_a123替换为whoami输出,192.168.1.100替换为手机IP。
免密登录(推荐):
# 电脑端
ssh-keygen -t ed25519
ssh-copy-id -p 8022 u0_a123@192.168.1.100使用示例
连接成功后,可以在 Claude Desktop 中直接说:
基础操作:
"查看手机电量"
"手机现在连着什么WiFi"
"拍一张照片"
"打开手电筒"
"手机在哪里"(GPS定位)
App 控制(UI 自动化):
"打开微信给张三发消息说明天见"
"帮我打开抖音"
"截个屏让我看看手机画面"
"点击屏幕上的xxx按钮"
"在当前输入框输入xxx"
通信:
"给 13800138000 发短信说我到了"
"查看最近的短信"
"查看通讯录"
系统控制:
"把手机音量调到5"
"用手机说一句你好"
"手机震动一下"
测试
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | python termux_mcp_server.pyAvailable Tools
57 toolsadb_connectA
Connect ADB to this device wirelessly. Required on Android 12+.
Step 1: If pair_code and pair_port are given, pair first. Step 2: If connect_port is given (or after pairing), connect.
Find these in: Settings → Developer Options → Wireless Debugging
Args: pair_code: Pairing code from wireless debugging (for first-time pairing) pair_port: Pairing port from wireless debugging (e.g. '37123') connect_port: Connection port shown on wireless debugging main page (e.g. '5555' or '45678')
Inputs: pair_code, pair_port, connect_port. Returns: result
adb_setup_statusA
Check if ADB is set up and connected. On Android 12+, ADB is required for screencap, input, uiautomator, am, etc. to work from Termux.
If not connected, follow the instructions in the output to set up.
Inputs: no named parameters. Returns: result
download_fileA
Download a file using Android's download manager.
Args: url: URL to download description: Download description shown in notification
Inputs: url (required), description. Returns: result
dump_uiA
Dump the current UI hierarchy (XML). Shows all visible UI elements with their text, content-desc, bounds (coordinates), class name, and clickable state.
Use this to find the right element/coordinates before tapping.
Args: output_path: Where to save the XML dump
Inputs: output_path. Returns: result
execute_commandC
Execute a shell command on the phone.
Args: command: Shell command to execute working_directory: Working directory (default: current) timeout: Timeout in seconds (default: 30)
Inputs: command (required), working_directory, timeout. Returns: result
find_and_tapA
Find a UI element by its text and tap on it.
This combines dump_ui + tap_screen: dumps the UI hierarchy, finds an element matching the given text, and taps its center.
Args: text: Text to search for in UI elements (partial match, case-insensitive)
Inputs: text (required). Returns: result
get_battery_statusA
Get phone battery status including level, charging state, temperature, etc.
Inputs: no named parameters. Returns: result
get_camera_infoB
Get information about available cameras on the device.
Inputs: no named parameters. Returns: result
get_clipboardA
Get the current clipboard content.
Inputs: no named parameters. Returns: result
get_current_appA
Get the currently focused app (package name and activity).
Inputs: no named parameters. Returns: result
get_device_infoA
Get comprehensive device information (model, Android version, etc.).
Inputs: no named parameters. Returns: result
get_fingerprintA
Prompt for fingerprint authentication on the device.
Inputs: no named parameters. Returns: result
get_locationA
Get the phone's current GPS location.
Args: provider: Location provider - 'gps', 'network', or 'passive' (default: gps) request: 'once' for single reading, 'last' for last known location, 'updates' for continuous
Inputs: provider, request. Returns: result
get_screen_brightnessA
Get current screen brightness level.
Inputs: no named parameters. Returns: result
get_screen_sizeA
Get the phone screen resolution (width x height in pixels).
Inputs: no named parameters. Returns: result
get_sensor_listA
List all available sensors on the device.
Inputs: no named parameters. Returns: result
get_storage_infoA
Get phone storage usage information (disk space).
Inputs: no named parameters. Returns: result
get_telephony_cell_infoB
Get detailed cellular network information.
Inputs: no named parameters. Returns: result
get_telephony_infoB
Get telephony device info (carrier, phone type, SIM state, etc.).
Inputs: no named parameters. Returns: result
get_volumeA
Get current volume levels for all audio streams.
Inputs: no named parameters. Returns: result
get_wifi_infoA
Get current WiFi connection information (SSID, IP, signal strength, etc.).
Inputs: no named parameters. Returns: result
go_backB
Press the Back button.
Inputs: no named parameters. Returns: result
go_homeA
Press the Home button to go to the home screen.
Inputs: no named parameters. Returns: result
input_chinese_textA
Input Chinese/Unicode text by copying to clipboard and pasting.
This is the reliable way to input non-ASCII text (Chinese, Japanese, emoji, etc.).
Args: text: The text to input (any language)
Inputs: text (required). Returns: result
input_keyeventA
Send a key event to the phone.
Args: keycode: Android keycode name or number. Common ones: - '3' or 'KEYCODE_HOME' = Home button - '4' or 'KEYCODE_BACK' = Back button - '26' or 'KEYCODE_POWER' = Power button - '24' = Volume Up, '25' = Volume Down - '66' or 'KEYCODE_ENTER' = Enter/Confirm - '67' or 'KEYCODE_DEL' = Backspace/Delete - '61' or 'KEYCODE_TAB' = Tab - '82' or 'KEYCODE_MENU' = Menu - '187' or 'KEYCODE_APP_SWITCH' = Recent apps - '279' or 'KEYCODE_PASTE' = Paste - '84' or 'KEYCODE_SEARCH' = Search
Inputs: keycode (required). Returns: result
input_textA
Type text into the currently focused input field.
Note: This works best with ASCII text. For Chinese/Unicode text, use set_clipboard + input_keyevent(keycode='279') (paste) instead.
Args: text: Text to type (spaces are supported)
Inputs: text (required). Returns: result
list_android_packagesB
List installed Android apps/packages.
Args: filter_keyword: Optional keyword to filter package names (e.g. 'camera', 'wechat')
Inputs: filter_keyword. Returns: result
list_contactsB
List all contacts from the phone.
Inputs: no named parameters. Returns: result
list_directoryA
List contents of a directory with file sizes.
Args: directory_path: Path to directory (default: current directory) show_hidden: Show hidden files (default: False)
Inputs: directory_path, show_hidden. Returns: result
list_installed_packagesB
List all installed Termux packages.
Inputs: no named parameters. Returns: result
list_photosB
List photo files in a directory.
Args: directory: Directory to list photos from (default: phone camera folder) limit: Maximum number of files to list
Inputs: directory, limit. Returns: result
list_running_appsA
List currently running processes/apps on the phone with CPU and memory usage.
Inputs: no named parameters. Returns: result
list_smsB
List SMS messages.
Args: limit: Number of messages to retrieve (default: 10) type: Message type - 'inbox', 'sent', 'draft', 'all' (default: inbox)
Inputs: limit, type. Returns: result
long_pressA
Long press at specific screen coordinates.
Args: x: X coordinate y: Y coordinate duration_ms: Press duration in milliseconds (default: 1000)
Inputs: x (required), y (required), duration_ms. Returns: result
media_playerB
Control the media player.
Args: action: One of 'play', 'pause', 'stop', 'info'. Use 'play' with file_path to play a file. file_path: Path to media file (required for 'play' action)
Inputs: action (required), file_path. Returns: result
open_appB
Launch an Android app or activity using am (Activity Manager).
Args: package_or_action: Package name (e.g. 'com.whatsapp') or intent action. Common examples: - com.whatsapp - com.tencent.mm (WeChat) - com.android.chrome - com.android.settings - com.android.camera2
Inputs: package_or_action (required). Returns: result
open_recent_appsA
Open the recent apps / app switcher.
Inputs: no named parameters. Returns: result
open_urlB
Open a URL in the default browser on the phone.
Args: url: The URL to open
Inputs: url (required). Returns: result
read_fileB
Read the contents of a text file.
Args: file_path: Path to the file to read
Inputs: file_path (required). Returns: result
read_photoA
Read a photo file and return it as base64 encoded data for viewing.
Args: file_path: Path to the image file
Inputs: file_path (required). Returns: result
read_sensorA
Read data from a specific sensor.
Args: sensor_name: Name of the sensor (use get_sensor_list to see available sensors) count: Number of readings to take (default: 1)
Inputs: sensor_name (required), count. Returns: result
scan_wifiB
Scan for nearby WiFi networks.
Inputs: no named parameters. Returns: result
send_notificationA
Send a notification to the phone.
Args: title: Notification title content: Notification body text id: Notification ID for updates/removal vibrate: Whether to vibrate (default: True)
Inputs: title (required), content (required), id, vibrate. Returns: result
send_smsC
Send an SMS message.
Args: number: Phone number to send to message: Message text
Inputs: number (required), message (required). Returns: result
set_clipboardB
Set the clipboard content.
Args: text: Text to copy to clipboard
Inputs: text (required). Returns: result
set_screen_brightnessB
Set screen brightness level.
Args: level: Brightness level 0-255
Inputs: level (required). Returns: result
set_volumeA
Set a volume level on the phone.
Args: stream: Volume stream - 'music', 'ring', 'alarm', 'notification', 'system', 'call' volume: Volume level (0-15 typical range, depends on device)
Inputs: stream (required), volume (required). Returns: result
show_toastB
Show a toast message on the phone screen.
Args: text: Text to show short: True for short display, False for long (default: True)
Inputs: text (required), short. Returns: result
swipe_screenA
Swipe on the screen from one point to another.
Args: x1: Start X coordinate y1: Start Y coordinate x2: End X coordinate y2: End Y coordinate duration_ms: Swipe duration in milliseconds (default: 300)
Inputs: x1 (required), y1 (required), x2 (required), y2 (required), +1 more. Returns: result
take_photoA
Take a photo using the phone camera.
Args: camera_id: Camera ID - '0' for back camera, '1' for front camera output_path: Where to save the photo
Inputs: camera_id, output_path. Returns: result
take_screenshotB
Take a screenshot of the current phone screen. Returns the screenshot as base64 image data.
Args: output_path: Where to save the screenshot file
Inputs: output_path. Returns: result
tap_screenA
Tap the screen at specific coordinates.
Use take_screenshot + dump_ui first to find the right coordinates.
Args: x: X coordinate (pixels from left) y: Y coordinate (pixels from top)
Inputs: x (required), y (required). Returns: result
text_to_speechB
Speak text aloud using text-to-speech.
Args: text: Text to speak language: Language code (e.g. 'en', 'zh', 'ja') (default: zh) rate: Speech rate, 1.0 is normal (default: 1.0)
Inputs: text (required), language, rate. Returns: result
toggle_torchA
Turn the flashlight (torch) on or off.
Args: enabled: True to turn on, False to turn off
Inputs: enabled. Returns: result
vibrateA
Vibrate the phone.
Args: duration_ms: Vibration duration in milliseconds (default: 1000) force: Vibrate even in silent mode (default: False)
Inputs: duration_ms, force. Returns: result
write_fileC
Write content to a file.
Args: file_path: Path to the file content: Content to write
Inputs: file_path (required), content (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 57 tools
Each tool has a clearly distinct purpose, even when covering similar domains (e.g., input_text vs. input_chinese_text, list_android_packages vs. list_installed_packages). Detailed descriptions eliminate ambiguity, making it easy for an agent to select the correct tool.
All tools follow a consistent verb_noun pattern in snake_case (e.g., get_battery_status, take_screenshot, send_sms). The naming is predictable and logically structured, adhering to a single convention throughout.
With 57 tools, the count is high but justified by the extensive domain coverage (device info, UI automation, file operations, communication, sensors, etc.). While a few tools could potentially be merged, the overall scope earns its size.
The tool set comprehensively covers the core needs of an Android phone automation server: device information retrieval, UI interaction, input methods, app management, file operations, media, communication, and system actions. There are no obvious gaps for typical use cases.
Maintenance
Related MCP Connectors
Let Claude, ChatGPT and other agents use your Android phone: see the screen, tap, type, open apps.
1Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Let AI agents control Android and iOS devices on Mobilerun Cloud: screen, input, apps, workflows.
Cloud Android phones for AI agents: create a phone, read the screen, tap, type, install APKs, park.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables text-based control of Android devices through Claude Code using accessibility tree automation. Supports UI interaction, app launching, text input, gestures, and navigation without requiring screenshots.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to fully control Android devices through over 30 tools for app management, UI automation, and vision-based analysis via ADB. It supports multi-device management, action recording, and smart execution strategies ranging from UI hierarchy parsing to coordinate-based interaction.371MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude or any MCP agent to see and operate a real Android phone over adb, with fast screen reads, tap/type/swipe actions, app launching, deep links, and brand-aware setup guidance, all without admin rights or an Android SDK.MIT
- AlicenseCqualityBmaintenanceEnables AI agents to control Android phones, emulators, redroid containers, iOS devices, and cloud-hosted devices through a perceive-act-verify loop of screen reading, taps, gestures, typing, and app launching. Exposes 138 tools for driving screens, elements, and files over adb, Portal APIs, and ios-portal without running ARM-only code on the device.941MIT