Android Forensics ADB MCP Server
Allows forensic acquisition from Android devices via ADB, including device backup, extraction of forensic artifacts, execution of whitelisted shell commands, and retrieval of device information and installed packages.
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., "@Android Forensics ADB MCP Server pull all forensic artifacts from the connected device"
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.
Android Forensics ADB MCP Server
A comprehensive Model Context Protocol (MCP) server for Android device forensic data acquisition using Android Debug Bridge (ADB). This tool is designed for forensic investigators with proper consent and authorization.
⚠️ Legal Notice
This tool is intended for authorized forensic investigations only. Users must have:
Legal authorization to access the device
Written consent from the device owner
Compliance with local laws and regulations
Proper chain of custody documentation
Unauthorized access to devices is illegal and unethical.
Related MCP server: Enhanced ADB MCP Server
Features
Core Capabilities
Device Management: Connect and manage Android devices via ADB
Secure Command Execution: Whitelisted shell commands for safety
Full Device Backup: Create complete device backups (.ab format)
Backup Extraction: Convert Android Backup (.ab) to TAR format (Python port of adb-backup-extract)
Data Acquisition: Pull specific files and directories
Forensic Artifact Collection: Automated collection of common forensic artifacts
Metadata & Chain of Custody: Automatic forensic metadata generation
MCP Tools Available
check_adb_status: Verify ADB installation and availability
adb_devices: List all connected Android devices
adb_connect_device: Connect to specific device
adb_shell_command: Execute whitelisted shell commands
get_device_info: Get comprehensive device information
list_installed_packages: List all installed applications
adb_backup_device: Create full device backup
adb_pull_data: Pull files/folders from device
extract_backup_to_tar: Extract .ab backups to TAR format
collect_forensic_artifacts: Automated artifact collection
Prerequisites
Required Software
Python 3.13+: Required for the MCP server
Android Platform Tools: Install ADB
Download: https://developer.android.com/tools/releases/platform-tools
Add to system PATH
UV Package Manager: Already configured in your environment
Android Device Requirements
USB Debugging enabled (Settings → Developer Options → USB Debugging)
Device unlocked during data acquisition
USB cable connection or network ADB connection
Installation
Install Dependencies:
uv syncVerify ADB Installation:
adb versionTest the Server:
uv run mcp dev main.pyUsage
Running the Server
Development Mode (with MCP Inspector)
uv run mcp dev main.pyProduction Mode (Claude Desktop Integration)
uv run mcp install main.py --name "Android Forensics"Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"android-forensics": {
"command": "uv",
"args": [
"--directory",
"u:\\adb-connect",
"run",
"main.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}Example Workflows
1. Basic Device Connection
1. Check ADB status: check_adb_status()
2. List devices: adb_devices()
3. Connect to device: adb_connect_device(device_id="DEVICE_SERIAL")
4. Get device info: get_device_info(device_id="DEVICE_SERIAL")2. Full Device Backup
1. Create backup:
adb_backup_device(
output_file="evidence_backup.ab",
device_id="DEVICE_SERIAL",
include_apk=True,
include_shared=True,
all_apps=True
)
2. Extract backup:
extract_backup_to_tar(
backup_file="evidence_backup.ab",
output_tar="evidence_backup.tar",
password="optional_password"
)3. Collect Forensic Artifacts
collect_forensic_artifacts(
output_dir="./forensic_evidence",
device_id="DEVICE_SERIAL"
)4. Execute Shell Commands
adb_shell_command(
command="pm list packages",
device_id="DEVICE_SERIAL"
)Security Features
Command Whitelisting
Only the following shell commands are allowed:
File operations:
ls,cat,pwd,find,du,dfSystem info:
getprop,dumpsys,uname,date,uptimePackage management:
pm,amProcess management:
ps,topNetwork:
netstat,ip,ifconfigLogs:
logcatSettings:
settings,contentScreen:
screencap,wm
Validation
Commands are validated before execution
Shell operators (
;,&&,||,|) are checkedTimeout limits prevent hanging processes
Error handling for all operations
Backup Extraction Details
The extract_backup_to_tar tool is a Python implementation of the adb-backup-extract project.
Supported Features
✅ Unencrypted backups
✅ Encrypted backups (with password)
✅ Compressed backups (zlib)
✅ AES-256 decryption
✅ PBKDF2 key derivation
Backup File Format
Android backups (.ab) have the following structure:
ANDROID BACKUP\n
version\n
compressed (0 or 1)\n
encryption (none or AES-256)\n
[encryption metadata if encrypted]
[compressed/encrypted data]Forensic Best Practices
Chain of Custody
All operations generate metadata including:
Timestamp (ISO 8601 format)
Device serial number
Operation performed
Investigator information
File hashes (where applicable)
Evidence Collection
Document Everything: Use
get_device_info()firstCreate Full Backup: Use
adb_backup_device()for complete acquisitionHash Evidence: Calculate SHA-256 hashes of all collected files
Maintain Logs: Keep all command outputs and errors
Write-Protect Evidence: Store backups as read-only immediately
Recommended Workflow
1. Connect device and verify connection
2. Document device information
3. Take screenshots of device state
4. Create full backup
5. Extract backup to TAR
6. Collect specific artifacts
7. Generate forensic report
8. Calculate and document all hashes
9. Store evidence securelyTroubleshooting
ADB Not Found
# Windows: Add to PATH or use full path
$env:PATH += ";C:\path\to\platform-tools"
# Verify
adb versionDevice Not Detected
Enable USB Debugging on device
Accept RSA fingerprint on device
Try different USB cable/port
Check
adb devicesoutput
Backup Fails
Ensure device is unlocked
Confirm backup on device screen
Check available storage
Some apps may block backup
Permission Denied
Many forensic artifacts require root access
Use
adb rootif device is rootedConsider using TWRP recovery for full access
Architecture
Project Structure
adb-connect/
├── main.py # MCP server implementation
├── pyproject.toml # Dependencies and configuration
├── README.md # This file
└── .python-version # Python version specificationKey Components
MCP Server: FastMCP-based server with tool registration
ADB Wrapper: Safe command execution with subprocess
Backup Extractor: Cryptography-based .ab to .tar converter
Forensic Collectors: Automated artifact acquisition
Metadata Generator: Chain of custody documentation
Dependencies
mcp[cli] >= 1.19.0: Model Context Protocol SDK
cryptography >= 43.0.0: Backup decryption (AES-256, PBKDF2)
pydantic >= 2.0.0: Data validation and serialization
Contributing
This is a forensic tool - contributions should prioritize:
Security and safety
Legal compliance
Evidence integrity
Documentation quality
References
License
MIT License - See LICENSE file for details.
Disclaimer
This tool is provided for legitimate forensic investigations only. The authors and contributors are not responsible for any misuse or illegal activities. Always ensure you have proper authorization before accessing any device.
For Forensic Investigation Departments: This tool is designed to support your authorized investigations with full respect for legal requirements and chain of custody procedures.
Available Tools
10 toolsanalyze_network_connectionsA
Analyze active network connections and configuration. Identifies connected networks, open ports, and suspicious connections.
Args: device_id: Optional device serial number output_file: Optional path to save results as JSON
Inputs: device_id, output_file. Returns: object
analyze_partition_infoA
Analyze device partitions and mount points. Essential for understanding device storage layout.
Args: device_id: Optional device serial number output_file: Optional path to save results as JSON
Inputs: device_id, output_file. Returns: object
capture_dmesgA
Capture kernel ring buffer (dmesg). Contains hardware events, driver messages, and security-related logs.
Args: output_file: Path to save dmesg output device_id: Optional device serial number
Note: May require root access on some devices.
Inputs: output_file (required), device_id. Returns: object
capture_logcatA
Capture Android system logs (logcat). Critical for understanding device activity and app behavior.
Args: output_file: Path to save the logcat output device_id: Optional device serial number lines: Number of log lines to capture (default 10000) filter_spec: Optional logcat filter (e.g., "*:W" for warnings+) include_timestamps: Include timestamps in output
Inputs: output_file (required), lines, device_id, filter_spec, +1 more. Returns: object
check_root_statusA
Comprehensive root/jailbreak detection. Checks multiple indicators of device rooting.
Args: device_id: Optional device serial number
Inputs: device_id. Returns: object
dump_system_settingsA
Dump all system settings (secure, system, global). Reveals device configuration, security settings, and user preferences.
Args: device_id: Optional device serial number output_file: Optional path to save results as JSON
Inputs: device_id, output_file. Returns: object
extract_with_rootA
Extract files using root privileges. Bypasses Android security restrictions for forensic acquisition.
Args: remote_path: Path on device (e.g., /data/data/com.whatsapp) local_path: Local destination path device_id: Optional device serial number
Warning: Requires rooted device. May trigger security alerts.
Inputs: local_path (required), remote_path (required), device_id. Returns: object
get_account_infoA
Get registered accounts on the device. Identifies Google, social media, and other linked accounts.
Args: device_id: Optional device serial number output_file: Optional path to save results as JSON
Inputs: device_id, output_file. Returns: object
get_installed_packagesA
Get list of all installed packages with details. Essential for identifying installed applications.
Args: device_id: Optional device serial number include_system: Include system apps output_file: Optional path to save results as JSON
Inputs: device_id, output_file, include_system. Returns: object
get_running_processesA
Get list of running processes. Identifies active applications and background services.
Args: device_id: Optional device serial number output_file: Optional path to save results as JSON
Inputs: device_id, output_file. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct forensic data source or action: root status, logcat, dmesg, packages, settings, network, processes, file extraction, partitions, and accounts. There is no overlap; even capture_logcat and capture_dmesg are clearly differentiated as system/app logs vs kernel buffer.
All tool names follow a consistent verb_noun pattern using snake_case (check_root_status, capture_logcat, get_installed_packages, etc.). The verbs are varied but predictable, and the structure is uniform across the set.
10 tools is well-scoped for an Android forensics server, covering the major data sources without unnecessary redundancy. The count falls comfortably within the ideal 3-15 range, and each tool earns its place in the toolkit.
The set covers core forensic acquisition and analysis: device status, logs, installed apps, settings, network, processes, file extraction, partitions, and accounts. Minor gaps exist, such as dedicated tools for SMS/call logs or media files, but the generic extract_with_root can access these if the path is known, making it a workable limitation.
Maintenance
Related MCP Connectors
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
Remote enterprise management of Android devices and apps
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Manage Android and VR device fleets: policies, kiosk mode, device commands and enrollment QR codes.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables control of Android devices through ADB, allowing users to list connected devices, capture screenshots using multiple methods (adb, droidcast, minicap, mumu), and retrieve device information.-
- AlicenseCqualityDmaintenanceEnables comprehensive control of Android devices via ADB for Flutter development, UI testing, and visual QA workflows. Provides 60+ tools for device management, UI inspection, app testing, performance profiling, and debugging through natural language.77MIT
- FlicenseBqualityDmaintenanceProvides comprehensive Android device management capabilities through ADB, including device management, app management, file operations, and system monitoring.181-
- AlicenseNot gradedqualityDmaintenanceEnables remote control of Android devices via ADB, including screen operations, input, app management, file transfer, and advanced tools like UI testing and performance analysis.25MIT