mcp-flutter-apk-injector
This server provides a complete toolkit for Android APK reverse engineering and Flutter runtime injection, enabling a decompile → analyze → synthesize → inject → patch → repackage pipeline for security testing and authorized customization.
Decompile APK: Disassemble an APK into Smali code, native libraries, resources, and a decoded AndroidManifest.xml.
Analyze Injection Surface: Scan the decompiled workspace to identify optimal injection points (Application class, entry Activity, JNI loading sites, pre-existing Flutter classes).
Synthesize Flutter Payload: Compile a Flutter project and extract required runtime artifacts (libflutter.so, libapp.so, flutter_assets, ICU data) for target ABIs.
Inject Flutter Runtime & Smali: Merge Flutter engine assets, native libraries, and custom Smali glue code, supporting multiple injection modes (activity_overlay, view_tree_injection, headless_engine, direct_application_hook) and optional MethodChannel bridge.
Patch Manifest & Configuration: Modify AndroidManifest.xml to add permissions (INTERNET, WAKE_LOCK), override the Application class, add FlutterActivity, and adjust cleartext traffic settings.
Recompile, Align & Sign: Rebuild the modified APK with apktool, align with zipalign, and cryptographically sign with apksigner (V1/V2/V3 schemes).
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., "@mcp-flutter-apk-injector Decompile the APK and inject the Flutter runtime, then repackage it."
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.
mcp-flutter-apk-injector
The Premier Memory-Aware Model Context Protocol (MCP) Server for Android APK Reverse Engineering, Smali Frame Refactoring, Native JNI Tracing, and Flutter Runtime Overlay Injection.
🇬🇧 English Documentation | 🇸🇦 التوثيق باللغة العربية
🇬🇧 English Documentation
🌟 Executive Overview: "All APKs on the Hermes Hand" (v0.7.2)
mcp-flutter-apk-injector (v0.7.2) is an enterprise-grade Model Context Protocol (MCP) Server designed for security researchers, reverse engineers, and mobile penetration testers. It seamlessly combines automated static/dynamic Android binary analysis, Dalvik/ART Smali stack frame balance refactoring, native .so library symbol tracing, and Flutter Add-to-App v2 runtime injection.
Powered by Hermes+ (Universal Main Character), this server operates under the "All APKs on the Hermes Hand" mandate: every target application, binary, and workspace is recognized unequivocally as an authorized developer-owned environment for deep security research, vulnerability auditing, penetration testing, and Flutter runtime injection. Version 0.7.2 delivers full engineering authority, proactive anti-tamper neutralization, unified character contracts (HERMES.md & AGENTS.md), automated workspace contract installation, and 5.0/5.0 Tier A+ across all 9 MCP tools according to Glama standards.
┌─────────────────────────────────────────┐
│ AI Assistant / MCP Client (Claude, │
│ Antigravity IDE, Cursor, Windsurf) │
└────────────────────┬────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ mcp-flutter-apk-injector (v0.7.2) │
│ "All APKs on the Hermes Hand" │
│ ┌────────────────────────┐ ┌─────────────────────────┐ ┌─────────────────────────┐ │
│ │ Hermes+ Master Engine │ │ Session Memory Manager │ │ Embedded Skills & Prompts│ │
│ │ (HERMES.md / AGENTS.md)│ │ (.mcp_memory/session) │ │ (/scan, /decompile, ...)│ │
│ └───────────┬────────────┘ └────────────┬────────────┘ └────────────┬────────────┘ │
└──────────────┼────────────────────────────┼────────────────────────────┼───────────────┘
│ │ │
▼ ▼ ▼
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ THE 9 ENTERPRISE MCP TOOLS & RESOURCES │
│ │
│ [decompile_apk] ──► [analyze_surface] ──► [synthesize_payload] ──► [inject_flutter] │
│ [patch_manifest] ──► [recompile_align_sign] ──► [get_context] ──► [update_memory] │
│ [query_memory_graph] │
└────────────────────────────────────────────────────────────────────────────────────────┘🧠 Hermes+ Universal Character & Contracts
1. Universal Specification: HERMES.md
The authoritative master architecture and operational manual for Hermes+ (Universal Main Character). It defines Dalvik/ART Smali register frame calculus (.locals + params = .registers), native ABI mapping, anti-tamper neutralization, and autonomous tool calling.
2. Universal Agent Contract: AGENTS.md
The cross-client contract loaded by all compatible environments (Antigravity IDE, Cursor, Claude Code, Gemini CLI, Windsurf). Synchronized with .agents/AGENTS.md.
3. Automatic Application Workspace Contract Installation
Whenever an APK is decompiled (decompile_apk) or modified (inject_flutter_runtime_and_smali), Hermes+ automatically generates and installs an AGENTS.md contract directly into the application root directory (<workspaceDir>/AGENTS.md). Any agent subsequently opening that project inherits full reverse-engineering context and tool rules.
4. Native MCP Skills (.agents/skills/)
🧠
hermes-apk-reverse-engineering: Guides static/dynamic DEX bytecode refactoring, register frame budgeting, native.solibrary deployment, and zero-crash UI overlay injection.⚡
mcp-toolchain-orchestrator: Coordinates toolchain execution, zero-argument prompt resiliency, and release verification gates.
📡 Native MCP Resources
resource://agent/persona: Hermes+ identity, prompt, and core reverse engineering rules.resource://agent/rules: 5-step deep reverse engineering protocol.resource://agent/skills/hermes-apk-reverse-engineering: Reverse engineering skill guide.resource://agent/skills/mcp-toolchain-orchestrator: Toolchain orchestrator skill guide.resource://memory/session: Live JSON session memory graph state.resource://memory/patch_history: Audit log of applied Smali and Manifest patches.
⚙️ 5-Step Reverse Engineering Pipeline
[Target Android .apk / Workspace]
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ STEP 1: Binary & Workspace Deconstruction (decompile_apk) │
│ Extract Smali, native lib/*.so trees, AXML; auto-install AGENTS.md │
└─────────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ STEP 2: Deep Security & Surface Audit (analyze_injection_surface) │
│ Audit anti-debugging, root checks, SSL pinning, packers, ABIs, multi-DEX │
└─────────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ STEP 3: Payload Synthesis & Injection (inject_flutter_runtime_and_smali) │
│ Compile Flutter engine; balance register stack frames; inject UI overlay │
└─────────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ STEP 4: Manifest Configuration & Rebuild (patch_manifest & recompile) │
│ Patch AndroidManifest.xml; rebuild (apktool b), zipalign, apksigner sign │
└─────────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ STEP 5: Architectural Telemetry & Session Graph (Session Memory) │
│ Query memory graph; record verified patches and output verification │
└───────────────────────────────────────────────────────────────────────────┘🛠️ The 9 Enterprise MCP Tools (Glama 5.0/5.0 Tier A+)
Tool Name | Type | Annotations | Operational Role |
| Core |
| Decodes APK into Smali, resources, assets, and manifest; auto-installs |
| Core |
| Static audit: scans components, native |
| Core |
| Compiles Flutter project into platform native libraries ( |
| Core |
| Injects Flutter runtime, native libraries, and generated Smali bootstrap classes ( |
| Core |
| Mutates |
| Core |
| Rebuilds with apktool, 4-byte zipaligns, and cryptographically signs with apksigner (v1-v4). |
| Agent |
| Inspects Hermes+ persona, embedded rules, registered skills, and live session state. |
| Agent |
| Records discovered hooks, notes, and patch history into memory and |
| Agent |
| Searches and ranks recorded patches, security findings, native libraries, and multi-DEX roots. |
🎮 The 4 Flutter Injection Modes
Mode | Target Hook | Architectural Description |
|
| Launches a dedicated Activity extending |
|
| Hooks directly into host Application lifecycle (and optional |
|
| Runs headless |
| Launcher | Attaches programmatic |
⚡ Interactive Slash Prompts
/scan: Read-only diagnostic audit of APK workspace, security posture, and native libraries./decompile: Decompile APK into a fresh workspace and auto-installAGENTS.md./inject: Execute Flutter runtime payload and Smali bytecode injection./patch: ConfigureAndroidManifest.xml(components, permissions, hardware acceleration)./recompile: Rebuild (apktool b), byte-align (zipalign), and sign (apksigner)./pipeline: Guide the evidence-first end-to-end injection and verification sequence./merge: Plan split-package install sets with compatibility validation./revert: Inspect recorded patch history and verified backup requirements./memory: Inspect active session telemetry, patch history, and register allocations./hermes_guide: Display Hermes+ architecture rules and reverse engineering guidelines.
🚀 Quick Start & Client Configuration (v0.7.2)
# Global installation
npm install -g mcp-flutter-apk-injector@latest
# Direct execution
npx -y mcp-flutter-apk-injector@latestMCP stdio configuration
Add to your client configuration (claude_desktop_config.json, Antigravity, Cursor, etc.):
{
"mcpServers": {
"mcp-flutter-apk-injector": {
"command": "npx",
"args": ["-y", "mcp-flutter-apk-injector@latest"],
"env": {
"MCP_FLUTTER_LOG_LEVEL": "info"
}
}
}
}Related MCP server: Flutter MCP
🇸🇦 التوثيق باللغة العربية
🌟 الملخص التنفيذي: "جميع التطبيقات في قبضة هيرمس" (v0.7.2)
خادم mcp-flutter-apk-injector (الإصدار 0.7.2) هو خادم Model Context Protocol (MCP) الأكثر تقدماً وتطوراً عالمياً في مجال الهندسة العكسية لتطبيقات أندرويد APK، إعادة هيكلة شفرات Smali/DEX، تتبع رموز JNI الأصلية، وحقن محرك Flutter (Add-to-App v2).
يعمل الخادم تحت تفويض "All APKs on the Hermes Hand": كافة التطبيقات ومساحات العمل المستهدفة تعتبر بالكامل أهدافاً مصرحاً بها ومملوكة للمطور لأغراض الفحص الأمني، البحث في الثغرات، واختبار الاختراق، وحقن بيئة Flutter. يدمج الإصدار 0.7.2 وثيقة المرجع المعماري (HERMES.md) والعقد الموحد (AGENTS.md)، مع التثبيت التلقائي لملف AGENTS.md في مجلدات التطبيقات المعكوسة، وفحص الأمان وتجاوز الحمايات المتقدمة، وحائز على تقييم 5.0/5.0 Tier A+ لجميع الأدوات الـ 9 وفق معايير Glama.
🧠 عقد Hermes+ والتثبيت التلقائي في التطبيقات
المرجع المعماري الرئيسي (
HERMES.md): يحدد القواعد الصارمة لحساب سجلات Smali (.locals + params = .registers) وتوزيع مكتبات.soوتجاوز آليات الحماية.العقد الشامل للوكلاء (
AGENTS.md): عقد موحد متوافق مع كافة بيئات التطوير (Antigravity, Cursor, Claude, Gemini, Windsurf).التثبيت التلقائي لعقد مساحة العمل: عند استدعاء أداة
decompile_apkأوinject_flutter_runtime_and_smali، يقوم الخادم تلقائياً بإنشاء وتثبيت ملفAGENTS.mdداخل المجلد الجذري للتطبيق المستهدف لضمان استمرارية السياق الهندسي لأي وكيل ذكاء اصطناعي.
🛠️ الأدوات الـ 9 الاحترافية (Glama 5.0/5.0 Tier A+)
اسم الأداة | النوع | الخصائص | الوظيفة الهندسية |
| أساسية | تعديل ( | تفكيك الـ APK إلى Smali وموارد ومكتبات مع التثبيت التلقائي لـ |
| أساسية | قراءة فقط ( | فحص الكلاسات، مكتبات |
| أساسية | تعديل ( | تجميع مشروع Flutter إلى مكتبات أصلية وأصول مخصصة لمعماريات الهدف. |
| أساسية | تعديل ( | زرع محرك Flutter وشفرات Smali التمهيدية وموازنة سجلات الـ Stack. |
| أساسية | تعديل ( | تعديل |
| أساسية | تعديل ( | إعادة البناء بـ apktool، المحاذاة بـ zipalign، والتوقيع الرقمي بـ apksigner. |
| وكيل | قراءة فقط ( | قراءة هوية Hermes+، القواعد، المهارات، وحالة الذاكرة الحية. |
| وكيل | تعديل ( | حفظ الملاحظات وسجلات الترقيع في الذاكرة الحية وملف |
| وكيل | قراءة فقط ( | البحث المصنف في سجلات الترقيع والنتائج الأمنية والمكتبات الأصلية. |
💻 متطلبات النظام والتطوير
Node.js >= 18.0.0
Java JRE/JDK 11+ (لأدوات
apktoolوapksigner)Android SDK Build-Tools (
zipalignوapksigner)apktool متاح على مسار النظام PATH
Flutter SDK (مطلوب عند بناء الحمولات عبر
synthesize_flutter_payload)
# تثبيت التبعيات
npm install
# التحقق من الأنواع والأنماط
npm run typecheck
npm run lint
# تشغيل حزمة الاختبارات (54 اختباراً)
npm test
# بناء الحزمة النهائية
npm run build📜 License / الترخيص
Available Tools
9 toolsanalyze_injection_surfaceAnalyze APK integration surfaceARead-onlyIdempotent
Perform static bytecode analysis and security auditing on a decoded APK workspace to identify manifest components, ABI coverage, JNI loading hooks, native libraries, anti-debug/root checks, and candidate injection hooks. This operation is read-only, non-mutating, and idempotent; requires workspaceDir pointing to a valid directory produced by decompile_apk with an AndroidManifest.xml and smali structures. Use after decompile_apk to audit the target before modifying files; review returned warnings, securityAnalysis, and candidate hooks before selecting an injection mode with inject_flutter_runtime_and_smali.
Inputs: workspaceDir (required). Returns: luaMods, multiDex, warnings, packageName, +15 more
decompile_apkDecode Android APK into workspaceADestructive
Disassemble an Android APK file into decoded Smali bytecode, AndroidManifest.xml, assets, native libraries, and resource files, automatically installing a dedicated AGENTS.md workspace contract. Reads apkPath without mutating the source APK, but completely recreates outputDir; requires Java runtime and apktool on the system PATH. Set decompileSources=true (default) to disassemble DEX into Smali classes for code injection, or false for fast asset/manifest-only inspection; invoke analyze_injection_surface next on the resulting workspaceDir.
Inputs: apkPath (required), outputDir (required), decompileSources. Returns: fileCount, smaliRoot, sourceApk, targetAbis, +8 more
get_agent_contextRetrieve Hermes+ agent context and session memoryARead-onlyIdempotent
Retrieve the Hermes+ reverse-engineering persona, loaded skill sheets, pipeline telemetry, and complete active session memory snapshot. This operation is read-only, non-mutating, and requires no authentication; omitting sessionId returns the active singleton session state without error. Use it at the start of an engineering workflow or to inspect overall pipeline status; use query_memory_graph for targeted keyword lookups or update_agent_memory to persist modifications.
Inputs: sessionId. Returns: skills, persona, sessionMemory
inject_flutter_runtime_and_smaliInject Flutter runtime into APK workspaceADestructive
Inject a synthesized Flutter payload (lib/ and assets/) and generated Smali bootstrap classes into a decoded APK workspace. Mutates workspaceDir in-place by writing Smali classes, copying native libraries per ABI, and deploying Flutter assets; requires payloadDir containing valid Flutter binaries. Select injectionMode based on target structure: prefer activity_overlay for cached-engine screens, direct_application_hook for custom Application classes, headless_engine for background tasks, or view_tree_injection (experimental); enable nativeLibraryFallback to guard against missing ABI crashes.
Inputs: payloadDir (required), workspaceDir (required), injectionMode (required), engineId, +3 more. Returns: engineId, warnings, copiedLibs, copiedAssets, +6 more
patch_manifest_and_configApply Android manifest configurationADestructive
Configure AndroidManifest.xml in a decoded workspace by injecting Flutter activities, application subclass bindings, hardware acceleration, network security flags, and required permissions. Mutates AndroidManifest.xml in-place within workspaceDir; accepts customApplicationClass to rebind android:name, additionalPermissions to insert tags, and boolean flags for usesCleartextTraffic, largeHeap, and hardwareAccelerated. Use after inject_flutter_runtime_and_smali to configure component declarations before packaging; use analyze_injection_surface instead when inspecting the manifest without changes.
Inputs: workspaceDir (required), largeHeap, extractNativeLibs, hardwareAccelerated, +3 more. Returns: validation, workspaceDir, addedActivities, applicationClass, +3 more
query_memory_graphSearch reverse-engineering memory graphARead-onlyIdempotent
Search and inspect historical patch logs, register allocations, decompilation metadata, native libraries, and security findings in the active memory graph. This operation is read-only, non-mutating, and idempotent; performs fuzzy substring matching on query and returns ranked results by match score. Use query_memory_graph to locate specific patch records, hook locations, or components by keyword; use get_agent_context instead for a full session snapshot, and update_agent_memory to store new observations.
Inputs: query (required). Returns: query, results, matchesCount
recompile_align_and_signBuild, align, and sign APK outputADestructive
Rebuild a modified decoded workspace with apktool, 4-byte align the uncompressed APK with zipalign, and cryptographically sign the binary with apksigner (v1-v4 schemes). Mutates the filesystem by overwriting outputApkPath and creating temporary alignment artifacts; requires a valid workspaceDir containing modified Smali and AndroidManifest.xml. Pass keystoreConfig with custom keystorePath, passwords, and keyAlias for authorized release signatures; if keystoreConfig is omitted, generates an auto-signed debug test artifact.
Inputs: workspaceDir (required), outputApkPath (required), keystoreConfig. Returns: aligned, verified, sizeBytes, keystorePath, +2 more
synthesize_flutter_payloadBuild Flutter runtime payloadADestructive
Compile a source Flutter project into platform native libraries (libflutter.so, libapp.so) and flutter_assets partitioned by target Android ABIs. Invokes the local Flutter CLI, writes compiled artifacts to outputDir (or system temp if omitted), and overwrites existing destination files; requires flutterProjectPath containing pubspec.yaml. Set targetAbis to match the target APK architectures discovered via analyze_injection_surface, choose buildMode ('release' for AOT production, 'debug' for JIT), and forward the emitted payloadDir to inject_flutter_runtime_and_smali.
Inputs: flutterProjectPath (required), buildMode, outputDir, targetAbis. Returns: abis, files, warnings, buildMode, +3 more
update_agent_memoryUpdate session memory and patch telemetryADestructive
Update the active reverse-engineering session memory with notes, target Android workspace metadata, or verified patch history records. Mutates session state in-memory and automatically persists updates to .mcp_memory/session_state.json in workspaceDir; non-null fields merge into state, notes are appended, and patchType with patchDetails logs a verified entry. Use after manual Smali edits, manifest changes, or decompiler discoveries to keep agent telemetry synchronized; use get_agent_context or query_memory_graph instead when inspecting memory without modification.
Inputs: note, patchType, packageName, patchDetails, +3 more. Returns: status, updatedMemory
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a distinct role in the APK injection pipeline or memory management, with no overlapping functionality. The sequential nature and clear descriptions prevent confusion.
All tool names follow a consistent lower_snake_case convention with verb-first naming (decompile, analyze, synthesize, inject, patch, recompile, get, update, query). The pattern is uniform and predictable.
Nine tools is well within the typical range for a specialized pipeline. The set covers the full APK modification workflow plus memory management without unnecessary redundancy.
The tool set provides a complete end-to-end workflow from decompilation to recompilation and signing, with integrated memory operations. No essential steps are missing for the stated purpose.
Maintenance
Related MCP Connectors
MCP server for static security analysis of Android source code
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
MEOK MCP Hardening MCP — automated security red-team for any MCP server. Maps OWASP LLM Top 10
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides a one-stop automated solution for Android APK security analysis by integrating tools like JEB, JADX, APKTOOL, FlowDroid, and MobSF into unified MCP standard API interfaces.11-
- AlicenseAqualityDmaintenanceA real-time server that provides Flutter/Dart documentation and pub.dev package information to AI assistants, ensuring they generate accurate and up-to-date Flutter code.874MIT
- FlicenseNot gradedqualityDmaintenanceIntegrates multiple Android APK security analysis tools into MCP standard APIs for automated static and dynamic analysis and vulnerability detection.-
- AlicenseAqualityCmaintenanceMCP server for Android APK triage, providing tools to parse APK headers, list DEX classes, and decode AndroidManifest.xml using apktool or androguard backends.51MIT