mcpField

termux-api

github.com/4ierOther70 installs
Repository

About termux-api

termux-api is a skill for controlling Android devices through Termux API commands over SSH. It is intended for workflows that need to inspect device state or operate built-in phone functions remotely.

Key features

  1. 01Device status and sensor readings
  2. 02Camera, microphone, and media commands
  3. 03Notifications and device feedback
  4. 04SMS, contacts, and call operations
  5. 05Clipboard, location, and system controls

Use cases

  1. 01Check battery and Wi-Fi details remotely
  2. 02Take and retrieve a camera photo
  3. 03Send an SMS or show a notification
  4. 04Read device location or clipboard

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/4ier/agent-skills --skill termux-api

After installing, type/termux-apiin Claude Code to confirm it loaded.

Details

From the project README

Termux API Skill

Control Android devices via Termux API commands over SSH.

Prerequisites

  • Termux installed on Android device
  • Termux:API app installed and permissions granted
  • SSH access configured (port 8022 by default)
  • termux-api package installed: pkg install termux-api

Connection

# Default SSH connection
ssh -p 8022 <device-ip> '<termux-api-command>'

Important Notes

  1. Termux must be in foreground for camera/microphone commands
  2. Permissions must be granted in Android Settings → Termux:API → Permissions
  3. Start API service if commands timeout: termux-api-start

API Commands Reference

Device Info
CommandDescription
termux-battery-statusBattery level, charging status, temperature
termux-audio-infoAudio device info
termux-wifi-connectioninfoCurrent WiFi connection details
termux-wifi-scaninfoScan nearby WiFi networks
termux-telephony-deviceinfoPhone/SIM info
termux-telephony-cellinfoCell tower info
termux-sensor -lList available sensors
termux-sensor -s <sensor> -n 1Read sensor once
Camera & Media
CommandDescription
termux-camera-infoList cameras (id 0=back, 1=front)
termux-camera-photo -c <id> <file.jpg>Take photo (needs foreground)
termux-microphone-record -f <file>Record audio
termux-media-player play <file>Play audio file
termux-tts-speak "text"Text to speech
termux-tts-enginesList TTS engines
Notifications & Feedback
CommandDescription
termux-notification -t "title" -c "content"Show notification
termux-notification-remove --id <id>Remove notification
termux-toast "message"Show toast popup
termux-vibrate -d <ms>Vibrate for duration
termux-torch on/offToggle flashlight
termux-dialogShow dialog (various types)
Communication (needs permissions)
CommandDescription
termux-sms-list -l 10List recent SMS
termux-sms-send -n <number> "message"Send SMS
termux-contact-listList contacts
termux-call-log -l 10Recent call history
termux-telephony-call <number>Make phone call
Clipboard
CommandDescription
termux-clipboard-getGet clipboard content
termux-clipboard-set "text"Set clipboard
Location
CommandDescription
termux-locationGet GPS location (needs permission)
termux-location -p gpsUse GPS provider
termux-location -p networkUse network provider
System Control
CommandDescription
termux-volumeGet/set volume levels
termux-brightness <0-255>Set screen brightness
termux-wallpaper -f <file>Set wallpaper
termux-wake-lockPrevent sleep
termux-wake-unlockAllow sleep
Storage & Sharing
CommandDescription
termux-share -a send <file>Share file via Android intent
termux-open <file>Open file with default app
termux-open-url <url>Open URL in browser
termux-download <url>Download file
termux-storage-get <dest>Pick file from storage

Common Patterns

Take a selfie and retrieve it
# Ensure Termux is in foreground first
adb shell am start -n com.termux/.HomeActivity
# Take photo
ssh -p 8022 <ip> 'termux-camera-photo -c 1 ~/selfie.jpg'
# Retrieve via SCP
scp -P 8022 <ip>:~/selfie.jpg /local/path/
Send notification with action
ssh -p 8022 <ip> 'termux-notification -t "Alert" -c "Task complete" --id myalert --vibrate 200,100,200'
Get device location
ssh -p 8022 <ip> 'termux-location -p network'
# Returns JSON with latitude, longitude, accuracy
Monitor battery
ssh -p 8022 <ip> 'termux-battery-status' | jq '.percentage, .status'

Troubleshooting

Command times out
  1. Start API service: termux-api-start
  2. Check if Termux:API app is installed
  3. For camera/mic: ensure Termux app is in foreground
Permission denied
  1. Open Android Settings → Apps → Termux:API → Permissions
  2. Grant required permissions (camera, location, SMS, etc.)
SSH connection refused
  1. In Termux: pkg install openssh && sshd
  2. SSH runs on port 8022 by default
  3. Set password with passwd or add SSH key to ~/.ssh/authorized_keys

Comments

Markdown supported