termux-api-tools
基于Termux-API的部分指令,用于MCP客户端操控Android设备的服务端
claude mcp add --transport stdio hyhasma-termux-api-tools-mcp-server python.exe D:\test\termux-api-mcp\termux-api-tools-mcp-server.py \ --env TERMUX_SSH_HOST="192.168.x.xx" \ --env TERMUX_SSH_PORT="xxxx" \ --env TERMUX_SSH_USER="username" \ --env TERMUX_SSH_PASSWORD="password"
How to use
This MCP server enables remote control of a Termux environment on an Android device via the MCP client. It exposes a set of Termux-API based capabilities, including accessing device information and performing sensitive actions such as making calls or sending SMS through the connected Termux session. To use it, import the server configuration into your MCP client (for example Cherry Studio or Claude), ensuring the JSON points to the correct path of termux-api-tools-mcp-server.py and the Termux SSH details. Once connected, you can invoke the available commands remotely from the MCP client by selecting the termux-api-tools-mcp-server entry and sending the appropriate request payload.
The server is designed for local network usage (Termux and the MCP client should be on the same LAN). You can customize the connection by adjusting the TERMUX_SSH_* environment variables to point to your Termux SSH session, enabling remote execution of Termux-API commands from the MCP client. Bear in mind that some operations involve sensitive data, so consider limiting access and operating within compliant environments.
How to install
Prerequisites:
- An Android device running Termux with SSH (sshd) enabled and Termux-API installed.
- A computer or device running an MCP client to connect to the server.
- Python installed on the host running the MCP server script.
Installation steps:
- Ensure Termux SSH is configured and reachable from your MCP client network.
- Transfer the termux-api-tools-mcp-server.py file to a accessible path on your machine (or fetch it from the repository).
- Install required Python packages (adjust according to the actual requirements of the script):
- pip install -r requirements.txt
- Start the MCP server script from the Termux environment or the host where it is located:
- python termux-api-tools-mcp-server.py
- In your MCP client, import the provided JSON configuration (or create a new one) that points to the correct path of termux-api-tools-mcp-server.py and the Termux SSH details.
- Ensure the TERMUX_SSH_HOST, TERMUX_SSH_PORT, TERMUX_SSH_USER, and TERMUX_SSH_PASSWORD values are correctly set to enable SSH access to Termux.
Note: Adjust the paths and environment details according to your environment (Windows vs. Unix paths, Python executable name, etc.).
Additional notes
Tips and common issues:
- Ensure the MCP client and Termux device are reachable on the same network; firewalls may block SSH (port) connections.
- If you encounter authentication issues, verify SSH keys or password authentication is enabled on the Termux SSH server.
- The server handles sensitive operations; restrict access to trusted clients and monitor usage.
- Update the env variables with real Termux SSH connection details before running.
- If the MCP client cannot resolve the Python script path, provide an absolute path and verify file permissions.
- This project may require adjusting permissions on the Termux side to allow Termux-API access from remote calls.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP