MCP server: One MCP server.

nano-mcp-termux

@lmeng486MCP server ยท External

Zero-dependency single-file MCP server for Termux/Android, Raspberry Pi and Linux.

Computer controlv1.1.0MITPython
Freeno charge per call

Runs on your machine from its package; the steps are below.

What it does

  1. Reads
  2. Writes
  3. High impact

At most: only reads or looks up information.

What it costs

Free

Odel charges nothing per call. The publisher may charge for its own service.

Runs locally

This server runs on your machine over stdio, but its source registry didn't list a distribution package. Check the source repository for setup instructions.

README3 min read

Zero-dependency, single-file MCP server for AI agents, natively running on Termux (Android), Raspberry Pi, and Linux.

GitHub Repository License: MIT MCP Version Docker Ready Version Tests CI Zero Dependencies

๐Ÿš€ Quick Start

Local (Termux / Linux)

bash
cd /path/to/nano-mcp-termux
python3 nano_mcp_termux.py

Docker

bash
docker build -t nano-mcp-termux .
docker run -i --rm nano-mcp-termux

Health check (one-shot, no MCP handshake)

bash
python3 nano_mcp_termux.py --health

๐Ÿ› ๏ธ Features

  • โœ… Zero-dependency: No external packages required
  • โœ… Single-file: All logic in one Python script
  • โœ… Cross-platform: Works in Termux (Android), on Raspberry Pi, Linux, and inside Docker
  • โœ… Container-ready: Dockerfile at repo root for Glama introspection
  • โœ… Standard stdio framing: Newline-delimited JSON-RPC (official MCP transport)
  • โœ… Version negotiation: Echoes client protocolVersion (2024-11-05 / 2025-06-18 / 2025-11-25), falls back to highest supported
  • โœ… Graceful degradation: device_status never fails; unavailable inputs are marked, not crashed
  • โœ… [lifecycle] No orphaned processes: every command runs in its own process group; timeouts kill the whole tree (SIGTERM โ†’ SIGKILL), never just the shell
  • โœ… [lifecycle] Self-terminating: parent-process watchdog + stdin-EOF detection + optional idle timeout, so a dead client never leaves a zombie server behind
  • โœ… [lifecycle] Phantom Process Killer aware: reports Android 12+ child-count risk with concrete mitigations
  • โœ… [paths] Android/Termux path adapter: resolves /sdcard โ†” /storage/emulated/0 โ†” $HOME/storage/shared, detects noexec mounts, case-insensitive filesystems, and shell-quoting hazards

๐Ÿงฉ Tools Overview

ToolDescription
device_statusAggregate device info: battery / storage / arch / memory (degraded fields marked unavailable)
server_healthRuntime health: pid/ppid/env, uptime, request counters, live children, reaping policy, RSS, Phantom Process Killer risk
resolve_pathResolve an Android/Termux path: canonical form, mount point, noexec/read-only flags, case sensitivity, equivalent spellings, quoting warnings
path_adapterEnvironment profile: runtime class, $HOME/$PREFIX/$TMPDIR, Android storage roots with mount summaries, noexec mount list

๐Ÿ”— Protocol Surface

MethodBehavior
initializeEchoes supported client version (2024-11-05 / 2025-06-18 / 2025-11-25), else responds with highest supported per MCP spec; declares {"tools": {}}
notifications/initializedSilent (no response)
pingReturns {}
tools/listReturns tool catalog
tools/callReturns {"content": [{"type": "text", ...}]}
Unknown method / tool-32601 / -32602 JSON-RPC errors
Malformed JSON-32700 parse error

๐Ÿ”„ Why 1.1.0: the orphan-process bug

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:

bash
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

โœ… Tests

bash
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)

โš™๏ธ Environment variables

VariableDefaultPurpose
NANO_IDLE_TIMEOUT0 (off)Seconds of inactivity before the server exits on its own
NANO_NO_WATCHDOGunsetSet 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.

Similar modules

Browse Computer control