unidbg
Allows you to emulate an Android native library, and an experimental iOS emulation
claude mcp add --transport stdio zhkl0228-unidbg node path/to/unidbg-mcp-server.js \ --env PORT="9239" \ --env DEBUG="unidbg-mcp-server:*"
How to use
unidbg exposes an MCP (Model Context Protocol) server to enable AI-assisted debugging and tooling for emulated Android native libraries. With MCP enabled, AI tools (such as Cursor) can connect to the server to inspect state, run targeted analyses, and guide reverse engineering or testing workflows within the emulator. The server wires into the emulator to expose capabilities like listing modules, inspecting memory and registers, controlling execution, and invoking native functions, all while collecting backtraces and runtime state for AI-assisted analysis. Typical usage involves starting the MCP server when the debugger is attached and then configuring your AI tool to connect to the provided SSE/HTTP endpoint to begin interactive analysis or scripted tool runs.
Once connected, you can leverage the available MCP Tools to inspect modules, read/write memory, set breakpoints, disassemble code, trace execution, and call native functions. For example, you can query loaded modules, locate a symbol, then use call_function or call_symbol to trigger native code paths and observe behavior under controlled inputs. The toolkit also supports custom MCP tools via McpToolkit, enabling repeatable experiments where you invoke a specific native routine with varying parameters while the AI assistant maintains context across runs.
How to install
Prerequisites:
- Java Development Kit (JDK 11 or newer)
- Maven or Gradle build tooling (depending on project setup)
- Git
Installation steps:
- Clone the repository: git clone https://github.com/zhkl0228/unidbg.git cd unidbg
- Build the project (example using Maven): mvn -U -DskipTests package // or using Gradle if the project uses Gradle: ./gradlew build -x test
- Verify the build artifacts exist (e.g., jar files) in the target/build directory.
- Start the MCP-enabled server component (see mcp_config for command). Example (adjust paths): node path/to/unidbg-mcp-server.js
- Confirm the server is listening on the configured port (default 9239).
- Connect your MCP-enabled AI tool (e.g., Cursor) to http://localhost:9239/sse or the configured endpoint.
Additional notes
Notes and tips:
- The unidbg MCP server integrates with various backends and supports advanced debugging features like breakpoints, memory tracing, and native function invocation. Ensure the emulator is running with the JNI and native hooks enabled for full functionality.
- If you encounter port conflicts, change the PORT environment variable in the mcp_config entry to an unused port.
- When using custom MCP tools, you can register them via McpToolkit so that the AI can re-run target functions with different parameters without restarting the process.
- Some features rely on native backends and hooks (Dobby, xHook, fishhook, dynarmic, etc.). Make sure the corresponding native components are built for your target architecture (ARM32/ARM64) and platform (Android or iOS).
- For debugging, you may want to enable verbose MCP server logs by setting DEBUG=unidbg-mcp-server:* in the environment.
- If the MCP server starts but the AI tool cannot connect, verify network bindings, firewall rules, and that the server is listening on the expected path (e.g., /sse).
Related MCP Servers
mobile
Model Context Protocol Server for Mobile Automation and Scraping (iOS, Android, Emulators, Simulators and Real Devices)
PeopleInSpace
Kotlin Multiplatform sample with SwiftUI, Jetpack Compose, Compose for Wear, Compose for Desktop, and Compose for Web clients along with Ktor backend.
Gearboy
Game Boy / Gameboy Color emulator and debugger for macOS, Windows, Linux, BSD and RetroArch.
FantasyPremierLeague
Fantasy Premier League Kotlin/Compose Multiplatform sample
GalwayBus
Galway Bus Kotlin Multiplatform project using Jetpack Compose and SwiftUI
Gearsystem
Sega Master System / Game Gear / SG-1000 emulator and debugger for macOS, Windows, Linux, BSD and RetroArch.