Zero-dependency single-file MCP server for Termux/Android, Raspberry Pi and Linux
Zero-dependency, single-file MCP server for AI agents, natively running on Termux (Android), Raspberry Pi, and Linux.
cd /path/to/nano-mcp-termux
python3 nano_mcp_termux.py
docker build -t nano-mcp-termux .
docker run -i --rm nano-mcp-termux
python3 nano_mcp_termux.py --health
This server does not run standalone — it's a sidecar that your AI client connects to via the MCP protocol.
Below are the three most common ways to mount it.
uvx), best for desktop AI clientsuvx nano-mcp-termux
Then add this JSON to your AI client's mcpServers config (see client‑specific notes below):
{
"mcpServers": {
"nano-mcp-termux": {
"command": "uvx",
"args": ["nano-mcp-termux"]
}
}
}
pip installed, or you prefer a direct Python launchpip install nano-mcp-termux
Config snippet for your AI client:
{
"mcpServers": {
"nano-mcp-termux": {
"command": "nano-mcp-termux"
}
}
}
# Clone or download the repo, then:
cd /path/to/nano-mcp-termux
python3 nano_mcp_termux.py
Config snippet for your AI client:
{
"mcpServers": {
"nano-mcp-termux": {
"command": "python3",
"args": ["/full/path/to/nano_mcp_termux.py"]
}
}
}
| AI client | Config file location (examples) | Note |
|---|---|---|
| Claude Desktop | macOS: ~/Library/Application Support/Claude/claude_desktop_config.jsonWindows: %APPDATA%\Claude\claude_desktop_config.json | ∆ mcpServers key at top level |
| Cursor | ~/.cursor/mcp.json | ∆ mcpServers key at top level |
| Cline | $HOME/.cliner/mcp.json (or inside project folder as cline_mcp_settings.json) | ∆ mcpServers key at top level |
| Cherry Studio | GUI → MCP section (typically auto‑creates ~/.cherrystudio/mcp/*.json) | JSON schema as above |
| Operit | ~/.operit/mcp_config.json (or per‑workspace config in the workspace folder) | ∆ mcpServers key at top level |
Tip: after editing the config file, restart your AI client so the new server is detected. If the client supports hot‑reload, you may not need a restart.
| Symptom | Likely cause | Fix |
|---|---|---|
| Client shows "server not found" | command path is wrong or not in PATH | Use absolute path (/usr/local/bin/nano-mcp-termux for pip installs, $HOME/.local/bin/nano-mcp-termux for pip --user) |
Error: spawn uvx ENOENT | uvx not in PATH (not installed) | Use a custom shell like "shell": "uw uvx" or the direct Python launch (Option 2) |
| "Connection lost" / process dies immediately | No stdin from client | This server is stdio‑bound; don't run it directly like nano-mcp-termux — always launch it through your client's MCP config |
protocolVersion (2024-11-05 / 2025-06-18 / 2025-11-25), falls back to highest supporteddevice_status never fails; unavailable inputs are marked, not crashedSIGTERM → SIGKILL), never just the shell/sdcard ↔ /storage/emulated/0 ↔ $HOME/storage/shared, detects noexec mounts, case-insensitive filesystems, and shell-quoting hazards| Tool | Description |
|---|---|
device_status | Aggregate device info: battery / storage / arch / memory (degraded fields marked unavailable) |
server_health | Runtime health: pid/ppid/env, uptime, request counters, live children, reaping policy, RSS, Phantom Process Killer risk |
resolve_path | Resolve an Android/Termux path: canonical form, mount point, noexec/read-only flags, case sensitivity, equivalent spellings, quoting warnings |
path_adapter | Environment profile: runtime class, $HOME/$PREFIX/$TMPDIR, Android storage roots with mount summaries, noexec mount list |
| Method | Behavior |
|---|---|
initialize | Echoes supported client version (2024-11-05 / 2025-06-18 / 2025-11-25), else responds with highest supported per MCP spec; declares {"tools": {}} |
notifications/initialized | Silent (no response) |
ping | Returns {} |
tools/list | Returns tool catalog |
tools/call | Returns {"content": [{"type": "text", ...}]} |
| Unknown method / tool | -32601 / -32602 JSON-RPC errors |
| Malformed JSON | -32700 parse error |
Version 1.0.0 ran commands with subprocess.run(..., timeout=...). On timeout,
Python terminates only the direct child — the sh -c wrapper. Anything the
shell had already spawned is reparented to init and survives forever. On
Android that is the exact leak class that trips the Phantom Process Killer
and can get the whole app group killed.
1.1.0 fixes this at the root: commands are spawned with start_new_session=True
and torn down with os.killpg(pgid, SIGTERM) → SIGKILL, so the entire process
tree dies together.
The repository ships a reproducible A/B regression test for it:
python3 test_lifecycle_orphan.py
# current nano_mcp_termux.py leaked_grandchildren=0
# legacy nano_mcp_termux_v10_backup.py leaked_grandchildren=1 <- the bug
# PASS: current server leaves 0 orphaned grandchildren after timeout
python3 test_client.py # 32 protocol / tool / lifecycle assertions
python3 test_lifecycle_orphan.py # orphan-leak A/B regression (1.0.0 vs 1.1.0)
| Variable | Default | Purpose |
|---|---|---|
NANO_IDLE_TIMEOUT | 0 (off) | Seconds of inactivity before the server exits on its own |
NANO_NO_WATCHDOG | unset | Set to 1 to disable the parent-process watchdog thread |
This server is designed to pass Glama introspection checks and serve as a lightweight MCP implementation for mobile and edge devices.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
uvx nano-mcp-termuxMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-lmeng486-nano-mcp-termux": {
"command": "uvx",
"args": [
"nano-mcp-termux"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceio.github.Lmeng486/nano-mcp-termux works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.