How zinja-coder/jadx-ai-mcp works
Project Type and Purpose
• This is a Java‐based plugin for the JADX Android decompiler (“JADX-AI-MCP”), packaged and published via Maven (pom.xml).
• Its purpose is to integrate the Model Context Protocol (MCP) into the JADX GUI, enabling live AI-driven reverse engineering and static analysis of Android APKs by talking to an external Python MCP server (JADX-MCP-SERVER) and LLMs like Claude.
File Structure Analysis
• Top Level
• pom.xml — Maven build descriptor for the Java plugin
• README.md, LICENSE, CODE_OF_CONDUCT.md, CONTRIBUTING.md — project documentation & governance
• docs/ — screenshots, video demos and asset files for documentation
• src/main/java/jadx/gui/plugins
• JadxAIMCP.java — plugin entry point implementing MCP integration
• META-INF/services/jadx.api.plugins.JadxPlugin — service loader descriptor ensures the plugin is discovered by JADX
• No backend code here; the Python server is in a separate repo (referenced in README).
Key Architectural Insights from README
• The plugin registers MCP commands in the GUI, such as fetch_current_class(), get_method_by_name(), etc.
• The external Python server receives MCP requests, forwards them to an LLM via HTTP or stdio, and returns responses.
• The plugin consumes AI analysis and renders inline suggestions in the GUI.
Main Components
a. Host Application: JADX GUI
b. Plugin Module: JADX-AI-MCP (Java)
• Service loader integration (META-INF)
• MCP client layer embedded in the plugin
c. MCP Transport Layer
• Protocol boundary (JSON-RPC over stdin/stdout or sockets)
d. Python MCP Server: jadx_mcp_server.py (external repo)
• HTTPX / fastmcp dependency
• MCP server loop listening to plugin
e. Language Model Service (External AI)
• Claude (hosted) or Local LLM via Ollama + Zin MCP Client
f. Android APK Under Analysis
• Decompiled code & resources loaded in JADX
Component Relationships and Data Flows
1. User loads APK in JADX GUI.
3. Plugin extracts context (class, method, smali, manifest) via internal API.
4. Plugin serializes request as an MCP command over stdout/stdin or socket.
5. Python MCP server receives command, translates it to an HTTP or stdio call to the LLM.
6. LLM processes the prompt and returns an analysis.
7. Server sends JSON-RPC response back to the plugin.
8. Plugin parses the response and injects annotations or suggestions into the GUI.
Architectural Patterns and Design Principles
• Plugin Architecture: Uses Java SPI (META-INF/services) to discover and load plugin at runtime.
• Adapter Pattern: The plugin adapts between the JADX internal API and the MCP protocol.
• Client-Server Pattern: The plugin is an MCP client; the Python server is the MCP server.
• Loose Coupling: Plugin knows only the MCP protocol; it is decoupled from LLM specifics.
• Extensibility: New MCP commands can be added in JadxAIMCP.java and picked up by the server.
• Clear component labels (JADX GUI, AI Plugin, MCP Server, LLM)
• Out each Java class/package in the plugin: e.g., JadxAIMCP.java → registers MCP handlers
• Build/deploy pipeline: Maven packaging outputs a JAR that lives in the JADX plugins folder
• Detail the Python server’s entrypoint and dependency graph (httpx, fastmcp)