Skip to main content
Glama
mcp-flutter-apk-injector

mcp-flutter-apk-injector

mcp-flutter-apk-injector

mcp-flutter-apk-injector Banner

npm version License: MIT Node.js Model Context Protocol Hermes+ Engine GitHub Repository mcp-flutter-apk-injector MCP server

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 .so library 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

decompile_apk

Core

destructive: true

Decodes APK into Smali, resources, assets, and manifest; auto-installs AGENTS.md into workspace.

analyze_injection_surface

Core

readOnly: true, idempotent: true

Static audit: scans components, native .so libraries, anti-debugging, root checks, SSL pinning, packers, and multi-DEX.

synthesize_flutter_payload

Core

destructive: true

Compiles Flutter project into platform native libraries (libflutter.so, libapp.so) and assets.

inject_flutter_runtime_and_smali

Core

destructive: true

Injects Flutter runtime, native libraries, and generated Smali bootstrap classes (activity_overlay, etc.).

patch_manifest_and_config

Core

destructive: true

Mutates AndroidManifest.xml in-place (activities, Application subclass, hardware acceleration, permissions).

recompile_align_and_sign

Core

destructive: true

Rebuilds with apktool, 4-byte zipaligns, and cryptographically signs with apksigner (v1-v4).

get_agent_context

Agent

readOnly: true, idempotent: true

Inspects Hermes+ persona, embedded rules, registered skills, and live session state.

update_agent_memory

Agent

destructive: true

Records discovered hooks, notes, and patch history into memory and .mcp_memory/session_state.json.

query_memory_graph

Agent

readOnly: true, idempotent: true

Searches and ranks recorded patches, security findings, native libraries, and multi-DEX roots.


🎮 The 4 Flutter Injection Modes

Mode

Target Hook

Architectural Description

activity_overlay (Preferred)

FlutterOverlayActivity

Launches a dedicated Activity extending FlutterActivity reusing a pre-warmed cached engine.

direct_application_hook

Application.onCreate()

Hooks directly into host Application lifecycle (and optional attachBaseContext), preserving host initialization.

headless_engine

BackgroundFlutterEngine

Runs headless FlutterEngine in background for data channels, telemetry, or headless compute.

view_tree_injection (Experimental)

Launcher onCreate()

Attaches programmatic FlutterView directly over the host activity decor view.


⚡ 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-install AGENTS.md.

  • /inject: Execute Flutter runtime payload and Smali bytecode injection.

  • /patch: Configure AndroidManifest.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@latest

MCP 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+ والتثبيت التلقائي في التطبيقات

  1. المرجع المعماري الرئيسي (HERMES.md): يحدد القواعد الصارمة لحساب سجلات Smali (.locals + params = .registers) وتوزيع مكتبات .so وتجاوز آليات الحماية.

  2. العقد الشامل للوكلاء (AGENTS.md): عقد موحد متوافق مع كافة بيئات التطوير (Antigravity, Cursor, Claude, Gemini, Windsurf).

  3. التثبيت التلقائي لعقد مساحة العمل: عند استدعاء أداة decompile_apk أو inject_flutter_runtime_and_smali، يقوم الخادم تلقائياً بإنشاء وتثبيت ملف AGENTS.md داخل المجلد الجذري للتطبيق المستهدف لضمان استمرارية السياق الهندسي لأي وكيل ذكاء اصطناعي.


🛠️ الأدوات الـ 9 الاحترافية (Glama 5.0/5.0 Tier A+)

اسم الأداة

النوع

الخصائص

الوظيفة الهندسية

decompile_apk

أساسية

تعديل (destructive)

تفكيك الـ APK إلى Smali وموارد ومكتبات مع التثبيت التلقائي لـ AGENTS.md.

analyze_injection_surface

أساسية

قراءة فقط (readOnly)

فحص الكلاسات، مكتبات .so لكل معمارية، مكافحة الـ Debug، الروت، وتثبيت الشهادات.

synthesize_flutter_payload

أساسية

تعديل (destructive)

تجميع مشروع Flutter إلى مكتبات أصلية وأصول مخصصة لمعماريات الهدف.

inject_flutter_runtime_and_smali

أساسية

تعديل (destructive)

زرع محرك Flutter وشفرات Smali التمهيدية وموازنة سجلات الـ Stack.

patch_manifest_and_config

أساسية

تعديل (destructive)

تعديل AndroidManifest.xml (الأنشطة، كلاس التطبيق، التسريع البرمجي، التصاريح).

recompile_align_and_sign

أساسية

تعديل (destructive)

إعادة البناء بـ apktool، المحاذاة بـ zipalign، والتوقيع الرقمي بـ apksigner.

get_agent_context

وكيل

قراءة فقط (readOnly)

قراءة هوية Hermes+، القواعد، المهارات، وحالة الذاكرة الحية.

update_agent_memory

وكيل

تعديل (destructive)

حفظ الملاحظات وسجلات الترقيع في الذاكرة الحية وملف .mcp_memory/session_state.json.

query_memory_graph

وكيل

قراءة فقط (readOnly)

البحث المصنف في سجلات الترقيع والنتائج الأمنية والمكتبات الأصلية.


💻 متطلبات النظام والتطوير

  • 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 / الترخيص

MIT License © 2026 Marwan (MarwanDevSpace)

Available Tools

9 tools
analyze_injection_surfaceAnalyze APK integration surfaceA
Read-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 workspaceA
Destructive

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 memoryA
Read-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 workspaceA
Destructive

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 configurationA
Destructive

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 graphA
Read-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 outputA
Destructive

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 payloadA
Destructive

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 telemetryA
Destructive

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

    A4.6/5.0

    Scored across 9 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness5/5

    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

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides 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
      -
    • A
      license
      A
      quality
      D
      maintenance
      A 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.
      8
      74
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for Android APK triage, providing tools to parse APK headers, list DEX classes, and decode AndroidManifest.xml using apktool or androguard backends.
      5
      1
      MIT