mcp-flutter-apk-injector
Enables Android APK reverse engineering and Flutter runtime injection through a six-step pipeline of decompile, analyze, synthesize, inject, patch, and repackage. Provides MCP tools for authorized security research and penetration testing.
README
mcp-flutter-apk-injector
Model Context Protocol (MCP) server for Android APK reverse engineering and Flutter runtime injection — an automated, enterprise-grade white-hat security research & penetration testing toolkit exposing a complete Decompile ➔ Analyze ➔ Synthesize ➔ Inject ➔ Patch ➔ Repackage pipeline as six modular MCP tools and agent prompt triggers.
🔒 Scope & Compliance Statement
This project is designed exclusively for security researchers, mobile auditors, and application owners auditing their own binaries or authorized targets. Repackaging third-party applications without explicit authorization is prohibited. You are responsible for using this tool lawfully.
🚀 Quick Start & Installation
You can run mcp-flutter-apk-injector directly via npx (no manual build required), or install it globally:
📦 Global NPM Install
npm install -g mcp-flutter-apk-injector
⚡ Running via npx
npx -y mcp-flutter-apk-injector@latest
🛠️ MCP Client Setup
Claude Desktop Configuration
Add the following block to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-flutter-apk-injector": {
"command": "npx",
"args": ["-y", "mcp-flutter-apk-injector@latest"]
}
}
}
Antigravity IDE / Generic MCP Client (stdio)
{
"mcpServers": {
"mcp-flutter-apk-injector": {
"command": "npx",
"args": ["-y", "mcp-flutter-apk-injector@latest"],
"env": {
"MCP_FLUTTER_LOG_LEVEL": "info"
}
}
}
}
⚡ Agent Prompts & Slash Commands
mcp-flutter-apk-injector registers native MCP Prompts for AI desktop agents (Antigravity IDE, Claude Desktop, Cursor):
/scan: Diagnostic audit scan of decompiled APK workspace, entry points, Smali structure, and native ABIs./inject: Execute Flutter runtime payload & Smali glue code injection into target APK./patch: PatchAndroidManifest.xml(application class, hardware acceleration, cleartext traffic, permissions)./recompile: Repackage (apktool b), byte-align (zipalign), and cryptographically sign (apksigner) modified target.
🧠 How it Works & Injection Modes
The pipeline supports four flexible injection strategies aligning with Flutter's "Add-to-App" v2 architecture:
activity_overlay: Generates a dedicatedFlutterOverlayActivityextendingFlutterActivitythat reuses the pre-warmed cached engine.view_tree_injection: Programmatically attaches aFlutterViewinto the decor view layout tree of the target Activity'sonCreate().headless_engine: Initializes a backgroundFlutterEnginewithout UI for headless Dart execution, channel routing, and telemetry.direct_application_hook: Directly instruments existingApplication.onCreate()orattachBaseContext()methods in decompiled Smali without alteringandroid:nameinAndroidManifest.xml.
🛠️ The 6 Core MCP Tools
| Tool Name | Detailed Function & Output |
|---|---|
decompile_apk |
Disassemble a target Android APK into Smali bytecode, native library trees (lib/), resources (res/), and a decoded AndroidManifest.xml using apktool. Returns package name, main Activity, Application class, min/target SDKs, native ABIs, and file manifest. |
analyze_injection_surface |
Scan a decompiled APK workspace to identify optimal injection hooks for Flutter runtime initialization: Application class presence (android:name), entry Activity, JNI loading sites, pre-existing Flutter classes, native ABIs, and recommended Smali patch points. |
synthesize_flutter_payload |
Compile a source Flutter project and extract the runtime artifacts required for injection: libflutter.so (Flutter engine), libapp.so (Dart AOT snapshot), the flutter_assets bundle, and ICU data. Produces a payload directory ready to merge into a decompiled APK workspace. |
inject_flutter_runtime_and_smali |
Inject Flutter engine assets, native libraries, and Smali glue code into a decompiled APK tree. Generates an InjectedApplication (FlutterEngine init + libflutter/libapp loading with try-catch fallback), a cached-engine bootstrap, an optional FlutterOverlayActivity (activity_overlay mode), and an optional two-way Smali<->Dart MethodChannel bridge. Returns a detailed patch report. |
patch_manifest_and_config |
Patch the decoded AndroidManifest.xml with Flutter runtime requirements: INTERNET/WAKE_LOCK permissions, custom Application class override, FlutterActivity entry (activity_overlay), engine-id metadata, extractNativeLibs, hardwareAccelerated, and optional usesCleartextTraffic. Returns a validation status for the patched manifest. |
recompile_align_and_sign |
Repack the decompiled APK workspace with apktool, run zipalign for 4-byte alignment, and sign with apksigner using V1/V2/V3 schemes. Uses an auto-generated debug keystore unless a custom keystoreConfig is provided. Returns the verified, aligned, installable APK path. |
💻 System Requirements
- Node.js >= 18.0.0
- Java Runtime / JDK (required by
apktoolandapksigner) - Android SDK Build-Tools (
zipalign,apksigner— auto-discovered fromANDROID_HOMEor system PATH) - apktool installed on system PATH
- Flutter SDK (required only when executing
synthesize_flutter_payload)
🧪 Development & Testing
# Install local dependencies
npm install
# Build TypeScript to dist/
npm run build
# Typecheck without emitting
npm run typecheck
# Code formatting & lint check
npm run lint
# Execute Vitest suite (35 unit tests)
npm test
📜 License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。