Skip to main content
Glama
MarwanDevSpace

mcp-flutter-apk-injector

Inject Flutter runtime into APK workspace

inject_flutter_runtime_and_smali
Destructive

Inject a Flutter runtime and Smali bootstrap into a decompiled APK workspace to enable Flutter execution in the host app through configurable injection modes.

Instructions

Inject a synthesized Flutter payload and generated Smali bootstrap into a decoded APK workspace after decompile_apk and synthesize_flutter_payload have completed. This mutates workspaceDir by adding libraries, assets, and Smali files; run analyze_injection_surface first when the host lifecycle or ABI compatibility is uncertain. Choose activity_overlay for the supported cached-engine screen path, use direct_application_hook only for a resolvable host Application, and treat view_tree_injection as experimental because it requires a lifecycle-compatible host.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
engineIdNoOptional cached FlutterEngine identifier stored in FlutterEngineCache (defaults to 'injected_flutter_engine')
payloadDirYesPath to synthesized Flutter payload directory produced by synthesize_flutter_payload containing lib/ native libraries (libflutter.so, libapp.so) and assets/
workspaceDirYesPath to decompiled APK workspace root directory produced by decompile_apk (modified in-place)
injectionModeYesInjection strategy enum: 'direct_application_hook' (hooks host Application class), 'activity_overlay' (adds overlay Activity), 'view_tree_injection' (attaches FlutterView to main Activity), 'headless_engine' (background engine without UI)
methodChannelBridgeNoOptional MethodChannel bridge config for two-way communication between target Android Smali host and injected Flutter Dart layer
attachBaseContextHookNoInject engine init into attachBaseContext(Context) as well as onCreate() for early initialization
nativeLibraryFallbackNoWrap System.loadLibrary call in defensive try-catch blocks to prevent UnsatisfiedLinkError crashes on missing ABIs

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
engineIdYesFlutterEngineCache identifier used by generated code.
warningsYesCompatibility and follow-up warnings.
copiedLibsYesNumber of copied native library files.
copiedAssetsYesNumber of copied Flutter asset files.
workspaceDirYesMutated decoded APK workspace.
injectionModeYesApplied Flutter integration mode.
methodChannelNoConfigured method-channel bridge, when requested.
modifiedFilesYesWorkspace files created or changed by the operation.
generatedClassesYesGenerated Smali class descriptors.
launchActivityNameYesResolved activity associated with the selected integration mode.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true, and the description adds specific details about what gets mutated: 'mutates workspaceDir by adding libraries, assets, and Smali files.' It also warns about uncertainty and experimental modes ('treat view_tree_injection as experimental because it requires a lifecycle-compatible host'). No contradiction with annotations, though it doesn't mention reversibility or permissions, which would have pushed it higher.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each earning its place: first states the main action and prerequisites, second states the safety/mutation detail, third provides mode selection guidance. Front-loaded with the core purpose, no filler, and structured to be read quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, nested objects, output schema, destructive behavior), the description provides all necessary context: prerequisites, mutation warning, mode selection rules, and experimental caveats. The output schema handles return values, so no need to repeat that. It fully complements the annotations and schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description doesn't add much beyond what the schema already explains; it does incorporate some mode-specific rationale (e.g., 'activity_overlay' for supported cached-engine path), but that's more usage guidance than parameter semantics. The schema already documents each parameter comprehensively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Inject' and clearly identifies the resource ('synthesized Flutter payload and generated Smali bootstrap') and target ('decoded APK workspace'). It distinguishes itself from sibling tools like decompile_apk and synthesize_flutter_payload by stating it runs after those steps and mutates the workspace.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit sequencing is provided: 'after decompile_apk and synthesize_flutter_payload have completed' and 'run analyze_injection_surface first when the host lifecycle or ABI compatibility is uncertain.' It also gives mode-selection guidance, such as 'Choose activity_overlay for the supported cached-engine screen path' and 'use direct_application_hook only for a resolvable host Application,' clearly telling when to prefer one mode over another.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MarwanDevSpace/mcp-flutter-apk-injector'

If you have feedback or need assistance with the MCP directory API, please join our Discord server