ghidra-headless-mcp
Analyzes native libraries (.so ELF files) extracted from Android apps, allowing disassembly, decompilation, renaming, and commenting of functions in native code pulled from APKs (e.g. via the Revoid jadx-based server).
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
ghidra-headless-mcp
Minimal headless MCP server for Ghidra. No GUI, no plugin, no HTTP bridge: it runs Ghidra in-process through PyGhidra. Sibling of Revoid (jadx) and uses the same tool style.
Install
Requires Python 3.9+, JDK 21+ and Ghidra 11.3+ (tested on 12.1).
pip install git+https://github.com/samudoria/ghidra-headless-mcp # or the wheel from Releases{
"mcpServers": {
"ghidra": {
"command": "ghidra-headless-mcp",
"env": { "GHIDRA_INSTALL_DIR": "/opt/ghidra" }
}
}
}OpenCode
In opencode.json (project) or ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"ghidra": {
"type": "local",
"command": ["ghidra-headless-mcp"],
"environment": { "GHIDRA_INSTALL_DIR": "/opt/ghidra" },
"enabled": true
}
}
}Related MCP server: toothpick
Use with Revoid
For Android apps: in Revoid call list_native_libraries, then extract_native_library
to get a .so path on disk, and pass that path to load_binary here. Each server keeps its own renames and comments.
Tell the model to rename and comment as it goes; the notes are what the next analyst reads.
Tools
Tool | Description |
| Import a binary (ELF/.so, PE, Mach-O...) and start auto-analysis in the background. Call first. Returns immediately with |
| Load state: |
| All loaded binaries (id/path/name/state/analyzed/functions) and which one is active. |
| Free one loaded binary (refused while it is still analyzing). |
| Functions (name, |
| Resolve a name/address to |
| Decompiled C ( |
| Assembly listing of a function. |
| Paginated, |
| Call graph neighbours of a function. |
| References to an address, function or string. |
| Shortest call chain from one function to another. |
| Hex dump of bytes at an address (max 4096). |
| Byte pattern search, hex with |
| Instructions with a given scalar operand (crypto constants, magic numbers). Paginated. |
| Apply a C prototype to a function ( |
| Change a local/parameter type as seen in the decompiled C. |
| Rename a function or label. |
| Rename a local/parameter seen in the decompiled C. |
|
|
All lists take limit (default 50) and offset; the reply contains next_offset (null at the end).
Edits are saved to the Ghidra project immediately and survive restarts: reloading the same file reopens your names and comments.
Every tool also takes an optional binary selector: an absolute path, a basename, or a program name
(see list_binaries for ids). Omitted = the most recently loaded binary, so single-binary use is unchanged.
Loading a new binary no longer closes the previous one; use unload_binary to free one.
Multiple binaries
load_binary can be called repeatedly and each binary keeps its own analysis thread, decompiler and
edits. Imports are serialized (Ghidra project code is not thread-safe) but analysis and queries run in
parallel, so agents can load several libraries and work on them concurrently. Select one per call:
load_binary("/tmp/liba.so")
load_binary("/tmp/libb.so") # liba stays loaded and keeps analyzing
list_binaries() # ids + states; libb is active
list_exports(binary="liba.so") # by basename
get_function("JNI_OnLoad", binary="/tmp/libb.so")
load_status(binary="libb.so") # poll each binary independently
unload_binary(binary="liba.so")Load flow (non-blocking)
load_binary no longer blocks on either the import or Ghidra's multi-minute auto-analysis: both run on a
background thread that keeps running after the call returns. The intended agent flow:
load_binary(path)— returns at once with{"state":"importing", ...}. Calling it again for the same path is idempotent: it returns the current status and never restarts a live job. If a previous load ended inerror, passretry=Trueto discard it and import again.Poll
load_status()untilstateis no longerimporting.Read immediately, while analysis runs:
list_exports,list_imports,list_strings,list_functions,read_memory,search_bytes— the structural questions (which exports? JNI functions? suspicious imports/strings?).Poll
load_status()until{"state":"ready","analyzed":true}.Then call decompiler-driven tools:
get_function,get_disassembly,get_callers/get_callees/get_xrefs,call_path,search_constants,rename*,retype_variable,set_signature,add_comment.
Called before analysis is done, a decompiler-driven tool returns a soft
{"status":"analyzing","retry_after_s":N,"hint":...} — not an error and never an under-analyzed answer. With
analyze=False, the first such call starts analysis itself (triage cheaply, pay for analysis only when you decompile).
A re-analyzed cached project loads straight to ready with no re-analysis.
Environment
Variable | Purpose |
| Ghidra install directory (required) |
| Where projects are stored (default |
|
|
| Bind address for the HTTP transports (default |
| Per-function decompile timeout in seconds (default |
|
|
| Comma-separated analyzer names to skip when trimming (default |
HTTP / SSE
GHIDRA_INSTALL_DIR=/opt/ghidra GHIDRA_MCP_TRANSPORT=sse ghidra-headless-mcp
# SSE endpoint: http://127.0.0.1:8000/sse
# streamable-http: GHIDRA_MCP_TRANSPORT=streamable-http -> http://127.0.0.1:8000/mcp{
"mcpServers": {
"ghidra": { "type": "sse", "url": "http://127.0.0.1:8000/sse" }
}
}Several binaries may be loaded at a time; unload_binary frees one. Only one server may open a given project at a time.
Logs go to stderr; stdout is reserved for the protocol.
Test
python tests/test_state.py # state machine, no Ghidra needed
GHIDRA_INSTALL_DIR=/opt/ghidra python tests/smoke.py ./some_binary some_function # end-to-end over stdio
GHIDRA_INSTALL_DIR=/opt/ghidra python tests/smoke.py ./liba.so fn_a ./libb.so fn_b # + multi-binary flowTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Evidence-oriented REA + Ghidra static-analysis workflows, read-only PE32 and Delphi VMT tools.
Base DEX analytics, DNS/RDAP intel, URL safety, tech search, Markdown scraper & x402 probe.
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Live C/C++ game preservation decompilation workbench (Divinity II, Jade Empire, Arcanum)
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to inspect and decompile software they have no source for — Android APKs, Electron bundles, .NET assemblies, and Go, Rust or WASM binaries — plus adb device interaction, through a token-guarded Streamable HTTP MCP endpoint, stdio MCP, or a CLI. Ghidra-powered native binary decompilation can be opted in at startup for ELF, PE and Mach-O targets.8Do What The F*ck You Want To Public
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to inspect and reverse-engineer large binaries through bounded stdio JSON-RPC 2.0 tools for graph queries, SSA facts, path solving, runtime grounding, and mod scaffolding.11AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents (and a matching CLI) to inspect native binaries, JavaScript/Electron apps, .NET assemblies, Go/Rust/WASM artifacts, EVM bytecode, SQLite databases, recorded crashes, and websites without source code, explaining how features work and returning the evidence and limitations behind each conclusion. Analysis runs locally, using optional Hopper, Ghidra, or IDA providers for native targets.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to analyze and diff binaries by driving Ghidra headless or inside its GUI, exposing native reverse-engineering tools such as listing functions and segments, searching strings, decompiling, disassembling, and following cross-references. Ships with a devcontainer and supports local stdio or remote HTTP deployment.MIT