Apktool logo

Apktool

Community
SecFathy

A server for Android APK analysis and reverse engineering using Apktool.

PublisherSecFathy
RepositoryAPktool-MCP
LanguagePython
Forks
13
Stars
40
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    Apktool exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    40 stars and 13 forks from the linked repository.

Apktool MCP Server

License: MIT Python 3.10+ MCP Compatible Gemini CLI

A powerful Model Context Protocol (MCP) server that exposes Apktool functionality for Android APK analysis and reverse engineering. Integrates seamlessly with Gemini CLI to provide AI-powered APK security analysis, privacy auditing, and reverse engineering guidance through natural language commands.

🚀 Features

🔍 Comprehensive APK Analysis

  • Decompile APKs to extract resources, manifest, and smali code
  • Analyze permissions and app components for security assessment
  • Extract string resources and detect hardcoded secrets
  • Search smali code for specific patterns and security vulnerabilities
  • Recompile modified APKs after making changes

🤖 AI-Powered Workflows

  • Natural language commands for complex APK analysis tasks
  • Automated security audits with AI-generated insights
  • Privacy compliance checking and GDPR/CCPA analysis
  • Step-by-step reverse engineering guidance
  • Intelligent vulnerability detection and risk assessment

🛠 8 Core Tools

ToolDescription
decode_apkDecompile APK files to extract all components
build_apkRecompile APK from modified source directory
install_frameworkInstall system frameworks for system app analysis
analyze_manifestParse AndroidManifest.xml for permissions and components
extract_stringsExtract string resources with locale support
list_permissionsEnumerate all requested permissions
find_smali_referencesSearch for patterns in decompiled smali code
get_apk_infoGet basic APK metadata and information

📋 Specialized Analysis Prompts

  • Security Analysis: Comprehensive vulnerability assessment
  • Privacy Audit: Data collection and compliance analysis
  • Reverse Engineering Guide: Step-by-step analysis workflows

📦 Installation

Prerequisites

1. Java JDK 8+ (Required by Apktool)

bash
# Ubuntu/Debian
sudo apt update && sudo apt install default-jdk

# macOS (Homebrew)
brew install openjdk

# Verify installation
java -version

2. Apktool (Core dependency)

bash
# Option 1: Package manager (recommended)
# Ubuntu/Debian
sudo apt install apktool

# macOS
brew install apktool

# Option 2: Manual installation
# Download from https://ibotpeaches.github.io/Apktool/install/

# Verify installation
apktool --version

3. Python 3.10+

bash
python3 --version  # Should be 3.10 or higher

Setup Instructions

1. Clone the repository

bash
git clone https://github.com/SecFathy/APktool-MCP.git
cd APktool-MCP

2. Create virtual environment

bash
python3 -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate     # Windows

3. Install dependencies

bash
pip install -r requirements.txt

4. Test the installation

bash
python3 apktool_server.py
# Should start the MCP server successfully

⚙️ Configuration

Gemini CLI Integration

1. Install Gemini CLI

bash
# Follow instructions at https://github.com/google-gemini/gemini-cli

2. Configure MCP Server

Edit your Gemini CLI configuration file:

  • Linux/macOS: ~/.config/gemini-cli/config.json
  • Windows: %APPDATA%\gemini-cli\config.json
json
{
  "mcpServers": {
    "apktool": {
      "command": "python3",
      "args": ["/absolute/path/to/apktool_server.py"],
      "env": {
        "APKTOOL_WORK_DIR": "/path/to/workspace"
      }
    }
  }
}

Claude Desktop Integration (Alternative)

Edit Claude Desktop configuration:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
json
{
  "mcpServers": {
    "apktool": {
      "command": "python3",
      "args": ["/absolute/path/to/apktool_server.py"],
      "env": {
        "APKTOOL_WORK_DIR": "/path/to/workspace"
      }
    }
  }
}

🎯 Usage Examples

Natural Language Commands

bash
# Start Gemini CLI
gemini

# Security Analysis
> "Analyze the APK at ./suspicious_app.apk for security vulnerabilities"

# Permission Analysis  
> "What permissions does ./myapp.apk request and are any of them dangerous?"

# Code Analysis
> "Find any hardcoded API keys or secrets in ./social_app.apk"

# Privacy Audit
> "Generate a privacy compliance report for ./messenger_app.apk"

# Reverse Engineering
> "Help me understand how the authentication works in ./banking_app.apk"

Direct Tool Usage

bash
# Decompile an APK
> Use decode_apk to decompile ./sample.apk

# Analyze permissions
> Use list_permissions on the decompiled directory ./sample

# Search for patterns
> Use find_smali_references to search for "crypto" in ./sample

# Extract strings
> Use extract_strings from ./sample for locale "en"

# Rebuild APK
> Use build_apk to recompile ./sample into ./sample_modified.apk

Guided Workflows

bash
# Run automated security analysis
> Run the security analysis prompt on ./target_app.apk

# Perform privacy audit
> Execute privacy audit workflow for ./social_media_app.apk

# Get reverse engineering guidance
> Use the reverse engineering guide for analyzing login functionality in ./app.apk

📁 Project Structure

apktool-mcp-server/
├── apktool_server.py          # Main MCP server implementation
├── requirements.txt           # Python dependencies
├── config.json               # Example Gemini CLI configuration
├── README.md                 # This file
├── GEMINI.md                 # AI assistant context file
├── LICENSE                   # MIT license
├── examples/                 # Usage examples and samples
│   ├── sample_analysis.py    # Example analysis scripts
│   └── workflows/            # Common workflow examples
├── tests/                    # Unit tests
│   ├── test_server.py        # Server functionality tests
│   └── test_tools.py         # Individual tool tests
└── docs/                     # Additional documentation
    ├── SECURITY.md           # Security guidelines
    ├── CONTRIBUTING.md       # Contribution guidelines
    └── TROUBLESHOOTING.md    # Common issues and solutions

🔒 Security Considerations

⚠️ Important Security Notes

  • Legal Compliance: Only analyze APKs you own or have explicit permission to analyze
  • Malware Risk: Unknown APKs may contain malicious code - use in isolated environments
  • Data Privacy: Decompiled APKs may contain sensitive user information
  • Workspace Isolation: Configure dedicated workspace with restricted permissions
  • Process Limits: Server includes timeouts to prevent resource exhaustion

Best Practices

bash
# Use dedicated workspace
export APKTOOL_WORK_DIR="/secure/isolated/workspace"

# Set appropriate permissions
chmod 750 /secure/isolated/workspace

# Monitor resource usage
htop  # Watch memory and CPU during analysis

# Clean up after analysis
rm -rf /secure/isolated/workspace/*

🧪 Testing

Run Unit Tests

bash
# Install test dependencies
pip install pytest pytest-asyncio

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=apktool_server tests/

Manual Testing

bash
# Test server startup
python3 apktool_server.py

# Test with sample APK
# Download a sample APK and test basic functionality

Integration Testing

bash
# Test Gemini CLI integration
gemini
> /tools  # Should list apktool tools
> Use decode_apk to analyze sample.apk

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Development Setup

bash
# Clone and setup development environment
git clone https://github.com/SecFathy/APktool-MCP.git
cd APktool-MCP
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt

# Run tests
pytest

# Format code
black apktool_server.py

Use Apktool MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Apktool is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Apktool as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Apktool MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "apktool-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Apktool MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Apktool MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Apktool to help me with this task?
Apktool
Sure. I read it.
Here is what I found using Apktool.

Frequently asked questions

What is the Apktool MCP server used for?

Apktool is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Apktool MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Apktool with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Apktool MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Apktool connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Apktool MCP to TypingMind?

Apktool runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Apktool MCP provide in TypingMind?

Apktool exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Apktool MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Apktool requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇