ghidra-mcp is an MCP server and a command-line tool for headless Ghidra analysis.
One local daemon runs the Ghidra sessions on Linux, macOS and Windows. MCP clients connect to the daemon through stdio or HTTP. The command-line tool uses the same daemon. The MD5 of a binary identifies its session for all clients.
Important
The daemon keeps configuration, binaries and analysis in the persistent home.
The default persistent home is ~/.ghidra-mcp on Linux and macOS, and %LOCALAPPDATA%\ghidra-mcp on Windows.
To use a different directory, set GHIDRA_MCP_HOME.
The daemon keeps temporary files in a private runtime directory.
If the daemon does not run, stdio clients and the command-line tool start it.
- Features
- Get started
- Usage
- Use with coding agents
- Configuration
- The MCP tools
- Files and directories
- Validation and releases
- Troubleshooting
- Documentation
- Contribute
- License
- MCP through stdio, Streamable HTTP, or legacy SSE. One daemon keeps the shared state.
- Command-line client. It lists the tools locally. It calls the tools through the daemon. It also starts, stops and examines the daemon, its sessions and its jobs.
- Sessions identified by MD5. The daemon uses a session again or opens the saved analysis again.
- Persistent sessions and jobs. Sessions and analysis jobs continue after a client disconnects.
- Remote upload. A client that is not on the daemon host sends a binary through a separate HTTP endpoint.
- Raw firmware import. The daemon imports
.bin,.hex,.ihexand.srecfiles with processor, compiler, loader and base address flags. - Local
.gprprojects. The daemon attaches a local Ghidra.gprproject in place and keeps its custom memory map. - Full Ghidra access. The Java bridge gives program data, functions, decompilation, symbols, references, memory and comments.
- One executable. The executable contains the bridge JAR and its launcher scripts.
- Background jobs.
ghidra_job list,ghidra_job getandghidra_job waitmonitor a long analysis.
Sessions can change the program by default. Coding agents must get approval from the user before they use an operation that changes the program.
For client setup snippets and walkthroughs, read the First Steps guide.
- Linux, macOS or Windows.
- Java 21.
- A local Ghidra installation that has
analyzeHeadless(analyzeHeadless.baton Windows).
If you have Node.js 18 or later, npm can install the executable for your platform:
npx @ghidra-mcp/cli toolsOr install the command for all projects:
npm install --global @ghidra-mcp/cli
ghidra-mcp toolsTo use npx from an MCP client:
{
"command": "npx",
"args": ["-y", "@ghidra-mcp/cli"]
}npm installs one platform package, such as @ghidra-mcp/linux-x64.
Do not use --omit=optional, because the platform packages are optional dependencies.
The Linux packages need glibc. On musl systems, such as Alpine, use Build from source.
The executable must also find Ghidra (see Find Ghidra).
-
Download the file for your platform from GitHub Releases.
Platform x86_64 ARM64 macOS ghidra-mcp-macos-x86_64ghidra-mcp-macos-arm64Linux ghidra-mcp-linux-x86_64ghidra-mcp-linux-arm64Windows ghidra-mcp-windows-x86_64.exeghidra-mcp-windows-arm64.exe -
Rename the file to
ghidra-mcp(ghidra-mcp.exeon Windows). -
On Linux and macOS, make the file executable with
chmod +x ghidra-mcp. -
Make sure that the executable can find Ghidra (see Find Ghidra). For example, on Windows:
$env:GHIDRA_INSTALL_DIR = 'C:\Tools\ghidra_12.1.4_PUBLIC' .\ghidra-mcp.exe tools
-
Add the executable to your MCP client:
{ "command": "C:\\Tools\\ghidra-mcp.exe", "args": [] }
The executable needs only Ghidra and Java. It writes the bridge files into the runtime directory when it opens a session.
To build from source, you also need:
- A Rust toolchain.
- The
bridge/submodule. The build uses the Gradle wrapper of the submodule. - A Ghidra installation in
GHIDRA_INSTALL_DIRorGHIDRA_HOME. The bridge compiles against this installation.
-
If you cloned the repository without submodules, get the bridge:
git submodule update --init --recursive
-
Build the release executable:
cargo xtask build --release --locked --bin ghidra-mcp
The result is target/release/ghidra-mcp (ghidra-mcp.exe on Windows).
This one file is the complete distribution.
The command cargo xtask build builds the bridge with Gradle.
Then it embeds the bridge JAR, Bridge.java and GhidraMcp.java in the executable.
The operation catalog comes from the bridge contract bridge/docs/asyncapi.yaml at compile time.
To embed a bridge JAR that you built before, set GHIDRA_MCP_BRIDGE_JAR.
A relative path starts at the workspace root.
The build then makes only Bridge.java and GhidraMcp.java, and does not compile the bridge.
Before it serves MCP, the daemon checks that it can find an executable analyzeHeadless.
If this check fails, it writes the error to stderr and daemon.log, then exits with status 1.
The daemon finds analyzeHeadless in this order:
[ghidra].analyze_headlessinconfig.toml.- The installation in
[ghidra].home,GHIDRA_INSTALL_DIRorGHIDRA_HOME. analyzeHeadlessonPATH.- The installation of
ghidraRunonPATH. - On Unix, the Homebrew Cellar and directories named
ghidra*in/Applications,~,~/Applicationsand~/opt.
Tip
If a computer has more than one Ghidra installation, set GHIDRA_INSTALL_DIR.
The default configuration does not need environment variables. These optional variables change the defaults:
| Variable | Purpose |
|---|---|
GHIDRA_INSTALL_DIR |
The Ghidra installation directory. |
GHIDRA_HOME |
Another name for the installation directory. GHIDRA_INSTALL_DIR has priority. |
GHIDRA_MCP_HOME |
The persistent home. |
Ghidra also uses the standard Java variables JAVA_HOME and JAVA_TOOL_OPTIONS.
On Unix, XDG_RUNTIME_DIR and TMPDIR set the location of the runtime directory.
An MCP client starts ghidra-mcp without arguments and talks to it through stdio:
{
"command": "/path/to/ghidra-mcp",
"args": []
}This process sends each tool call to the daemon. If the daemon does not run, the process starts it. The process connects to the daemon through a local socket. On Unix, the socket is a private Unix domain socket. On Windows, the socket is a named pipe.
The process reuses this connection across tool calls to avoid repeated handshake delays. If the daemon stops, the process reconnects on the next call.
To run from a source checkout, use cargo run -- as the command.
To run the daemon in the foreground, use this command:
ghidra-mcp daemon runThe daemon serves these endpoints on one listener:
| Endpoint | Purpose |
|---|---|
http://127.0.0.1:18489/mcp |
MCP through Streamable HTTP or legacy SSE. |
/upload |
Binary uploads. |
/ws/agent |
The WebSocket of the Ghidra bridge. |
The daemon accepts only loopback addresses.
To use a different address, use --listen:
ghidra-mcp daemon run --listen 127.0.0.1:18490With --listen 127.0.0.1:0, the system selects a free port.
The daemon writes the address in server.json and daemon.log in the runtime directory.
The daemon continues to run after all clients disconnect.
To stop a foreground daemon, press Ctrl-C.
To stop a daemon in the background, use ghidra-mcp daemon stop.
On Unix, SIGINT, SIGTERM and SIGHUP also stop it.
When the daemon stops, it closes its Ghidra sessions.
You can open the saved projects again later.
Use these commands to manage the shared daemon:
| Command | Purpose |
|---|---|
ghidra-mcp daemon start [--listen ADDR] |
Start the daemon in the background. Wait until it is ready. |
ghidra-mcp daemon stop [--force] |
Stop the daemon. It closes its sessions first. |
ghidra-mcp daemon restart [--force] [--listen ADDR] |
Stop the daemon, then start it again. |
ghidra-mcp daemon status [--json] |
Show the process ID, version, MCP URL, sessions and jobs. |
ghidra-mcp daemon logs [-n N] [-f] |
Show the last lines of daemon.log. With -f, show new lines until Ctrl-C. |
ghidra-mcp setup [DIR] [--json] |
Write Bridge.java, GhidraMcp.java and ghidra-bridge.jar into a script directory (default ~/ghidra_scripts). |
ghidra-mcp paths [--json] |
Show the persistent home, the runtime directory and their files. |
ghidra-mcp config path|show|edit|check |
Find, show, change or check config.toml. |
ghidra-mcp session list|get|open|attach|close|checkpoint|reset|delete |
Manage the sessions and checkpoints of the daemon. |
ghidra-mcp job list|get|wait |
Examine the background jobs of the daemon. |
If a session is live or a job runs, daemon stop does not stop the daemon.
To stop it, add --force.
If no daemon runs, daemon status exits with status 3, and daemon stop is successful.
These commands write text. For scripts, add --json.
MCP clients can also use ghidra_daemon shutdown. Then the daemon stops for all clients.
The command-line tool uses the same tool catalog as MCP.
To list the tools without a daemon, use this command:
ghidra-mcp toolsTo call a tool through the daemon, use this command:
ghidra-mcp call ghidra_session '{"operation":"list"}'call TOOL [JSON] accepts one JSON object. The default is {}.
If necessary, the command starts the daemon.
The command writes structuredContent as formatted JSON.
| Result | Output | Exit code |
|---|---|---|
| The call is successful. | The result on stdout. | 0 |
| The call fails. | The error on stderr. | 1 |
| The arguments are not valid. | The usage on stderr. | 2 |
--help or --version. |
The text on stdout. | 0 |
Headerless firmware files such as .bin, .hex, .ihex and .srec have no architecture header.
Pass optional import flags to ghidra_session open, ghidra_upload prepare or ghidra-mcp session open:
MCP params field |
CLI flag | Purpose |
|---|---|---|
processor |
--processor <ID> |
Ghidra language ID for -processor, for example ARM:LE:32:Cortex. |
compilerSpec |
--compiler-spec <ID> |
Ghidra compiler specification ID for -cspec. Needs processor. |
loader |
--loader <CLASS> |
Ghidra loader class for -loader, such as BinaryLoader or IntelHexLoader. |
baseAddress |
--base-address <ADDR> |
Hexadecimal load address for -loader-baseAddr, such as 0x08000000 or ram:0x08000000. |
reimport |
--reimport |
Delete the saved Ghidra project for this binary and run -import again. |
Example with ghidra_session open:
{
"operation": "open",
"params": {
"path": "/path/to/firmware.bin",
"processor": "ARM:LE:32:Cortex",
"baseAddress": "0x08000000",
"wait": true
}
}Example with the command-line tool:
ghidra-mcp session open /path/to/firmware.bin \
--processor ARM:LE:32:Cortex \
--base-address 0x08000000 \
--wait- When a file name ends in
.bin,.hex,.ihexor.srec, the daemon keeps that lowercase extension onbinary.<ext>. - For
.srecfiles, the daemon selectsMotorolaHexLoaderwhenloaderhas no value. ImportBinary.javaaligns the program image base and the default memory blocks withbaseAddressbeforeBridge.javastarts.- The daemon saves the import flags in
binary.json. - If a saved project already exists and a call gives different import flags, set
reimporttotrue(--reimport).
You can attach a Ghidra .gpr project on the daemon host without a file copy.
This workflow keeps custom image bases, memory maps and saved symbols from Ghidra GUI.
Example with ghidra_session open:
{
"operation": "open",
"params": {
"path": "/path/to/board.gpr",
"programName": "firmware/app",
"wait": true
}
}Example with the command-line tool:
ghidra-mcp session open /path/to/board.gpr --program-name firmware/app --wait- The
.gprfile must have its<name>.repdirectory beside it, and<name>must not start with.. - The daemon calculates a deterministic 32-character hexadecimal
md5from the canonical.gprpath and writesprojects/<md5>/attached.json. - Use that
md5in subsequent tool calls and inghidra_session opento reopen the project or changeprogramName. - If the project has one
Program,programName(--program-name) is optional. - If the project has multiple programs and
programNameis absent,openfails and lists the candidate program paths. - Before
OpenSavedProject.javaruns, the daemon checks<name>.lockand<name>.lock~in read-only mode and modifies no project files. - If Ghidra GUI or another process holds the project lock,
openfails at once. Close the project in Ghidra GUI first. - Binary import flags (
processor,compilerSpec,loader,baseAddressandreimport) andghidra_upload preparedo not apply to.gprprojects.
To connect an open Ghidra CodeBrowser program to the daemon, use this procedure:
-
Write the launcher scripts into your Ghidra script directory (
~/ghidra_scriptsby default):ghidra-mcp setup
-
Open the Script Manager in CodeBrowser and run
Bridge.java. The Console prints the loopback listener URL (ws://127.0.0.1:8765/ws/agentby default). -
Attach the daemon to that listener:
ghidra-mcp session attach ws://127.0.0.1:8765/ws/agent
You can also pass
--port 8765, or pass a local file path with--port 8765to use its MD5. The command does not copy the binary. -
When
Bridge.javasendsghidra.ready, the session enters thereadystate. A disconnect leaves CodeBrowser open and does not startanalyzeHeadless.
If you omit --ws-url and --port, session attach prints outbound ws_url=... session_id=... token=... arguments instead.
Use this procedure when the client is not on the daemon host.
-
On the client, calculate the MD5 and the size in bytes of the file.
-
Call the
ghidra_uploadtool:{"operation":"prepare","md5":"0123456789abcdef0123456789abcdef","params":{"fileName":"program.bin","size":1024}}fileNameis a display name. It must not contain a directory. For raw firmware,paramsalso acceptsprocessor,compilerSpec,loader,baseAddressandreimport(see Import raw firmware). The daemon keeps.bin,.hex,.ihexand.srecextensions fromfileName. -
Read the result. It contains these fields:
method:POST.url: An absolute URL for HTTP calls, for examplehttps://host/ghidra/upload. Other transports returnupload, relative to the MCP URL.headers: a single-useAuthorization: Bearercredential andContent-Type: application/octet-stream.expiresAt: the expiry time in Unix seconds.
-
Send the file as the raw request body with the headers from the result:
curl -X POST 'https://host/ghidra/upload' \ -H 'Authorization: Bearer <credential>' \ -H 'Content-Type: application/octet-stream' \ --data-binary @program.bin
-
Read the response:
- HTTP
200: the session is ready. - HTTP
202: the session starts. Useghidra_job waitwith the returnedjobId.
- HTTP
You do not need a separate ghidra_session open call.
Note
- The upload goes directly to disk. It can be larger than the MCP request limit. The daemon accepts HTTP chunked transfer.
- You must start the upload within ten minutes after
ghidra_upload prepare. This limit does not apply to an active upload. - The request uses the credential when it starts. After an upload fails, get a new credential.
- The daemon examines the size and the MD5 before it saves the binary. A failed upload leaves no file and no session.
- If Ghidra does not start, the binary stays saved. Use
ghidra_session openwith the MD5 to retry. - A reverse proxy must send both
/mcpand/uploadto the daemon, with the same prefix.
The server uses Forwarded host and protocol values first, then X-Forwarded-Host and
X-Forwarded-Proto.
X-Forwarded-Prefix supplies a path prefix that the proxy removed.
The server can also use an absolute HTTP or HTTPS Referer whose path ends in /mcp.
It does not use a Referer that points to a client page.
Without these headers, the server uses the HTTP request address.
An invalid protocol or path prefix leaves the URL relative.
The proxy must replace client-supplied address headers with the correct public values.
Coding agents start ghidra-mcp as a stdio server, or connect to the HTTP URL.
Agents that use the same runtime directory share one daemon.
For Claude Code, add the executable as a local stdio server:
claude mcp add --transport stdio --scope local ghidra-mcp -- /absolute/path/to/ghidra-mcpTo examine the connection, use claude mcp get ghidra-mcp or the /mcp panel.
The status must be Status: ✓ Connected.
Use this procedure in an agent:
- Open the binary or project:
- For a session that the daemon saved before, call
ghidra_sessionwith{"operation":"open","md5":"..."}. - For a binary on the daemon host, call
ghidra_sessionwith{"operation":"open","params":{"path":"..."}}. The daemon calculates the MD5 and saves the binary. - For raw firmware, add
processorandbaseAddressinparams(see Import raw firmware). - For a local Ghidra project, pass its
.gprpath inparams.path(see Attach a local .gpr project). - For a file on a remote client, upload it (see Upload a binary from a remote client).
- For a program that is already open in CodeBrowser, call
ghidra_sessionwith{"operation":"attach"}and pastebridgeArgsintoBridge.java.
- For a session that the daemon saved before, call
- If the session starts, call
ghidra_jobwith{"operation":"wait","params":{"jobId":"...","timeoutMs":...}}. You can useghidra_job getto monitor the job. - Confirm the ready status with
ghidra_session get. - Start the analysis: call
ghidra_analysiswith{"operation":"start","md5":"..."}. - Monitor the analysis job with
ghidra_job getorghidra_job wait. - Use the domain tools of the bridge, for example
ghidra_program get,ghidra_function listandghidra_data_type create. - Save the analysis and the changes with
ghidra_program save. The session stays open. - Get approval from the user before you use an operation that changes the program.
A session summary contains only md5, fileName, status and connected.
Operations that name one session use md5. There is no separate session ID.
ghidra_session list is optional.
For an MD5 that the daemon does not know, the daemon tells you to upload the binary.
At the first start, the daemon writes a default config.toml in the persistent home.
This example shows all the keys with their default values:
[ghidra]
home = ""
analyze_headless = ""
[analysis]
max_cpu = 4
[checkpoints]
max_per_binary = 10
[timeouts]
process_spawn_timeout_sec = 30
analysis_import_timeout_sec = 1800
bridge_connect_timeout_sec = 30
agent_ready_timeout_sec = 30
bridge_disconnect_grace_sec = 5
graceful_kill_timeout_sec = 10
force_kill_timeout_sec = 5
rpc_ms = 30000
daemon_start_timeout_sec = 8
ipc_handshake_timeout_sec = 5| Key | Purpose |
|---|---|
ghidra.home |
The Ghidra installation directory. |
ghidra.analyze_headless |
The path of analyzeHeadless. |
analysis.max_cpu |
The value of analyzeHeadless -max-cpu. |
checkpoints.max_per_binary |
The maximum number of retained checkpoints for one binary. |
timeouts.process_spawn_timeout_sec |
The time to start the Ghidra process. |
timeouts.analysis_import_timeout_sec |
The time to import a binary. It is also the default wait for ghidra_analysis start. |
timeouts.bridge_connect_timeout_sec |
A part of the total time to start a session. |
timeouts.agent_ready_timeout_sec |
The time for the bridge to complete its handshake. |
timeouts.bridge_disconnect_grace_sec |
The time for a process to stop by itself after its bridge disconnects or its session closes. |
timeouts.graceful_kill_timeout_sec |
The time for a process to stop after the daemon tells it to stop. |
timeouts.force_kill_timeout_sec |
The time for a process to stop after the daemon kills it. |
timeouts.rpc_ms |
The time for one bridge request, in milliseconds. |
timeouts.daemon_start_timeout_sec |
The time to wait for a daemon in proxy or CLI mode. |
timeouts.ipc_handshake_timeout_sec |
The timeout for the IPC handshake between proxy and daemon. |
- An empty string for
homeoranalyze_headlesshas the same effect as no value. - The daemon ignores other sections and keys. The file must be valid TOML.
- Java temporary files always go into the
tmp/directory of the runtime directory. - The daemon does not accept the removed keys
ghidra.java_tmp_dir,ghidra.script_pathandghidra.bridge_script. Remove them from your file.
tools/list shows 19 MCP tools: ghidra_help and one tool for each domain.
The bridge domain tools use the domain and operation names of the bridge MCP server.
The daemon also has local operations and does not expose the bridge shutdown operation.
This document writes an operation as the tool name and the operation name, for example ghidra_session open.
A domain tool has these arguments:
operation: necessary. The operation in the domain, for examplelist.md5: the MD5 of the binary that identifies a session. It has exactly 32 hexadecimal characters and is never inparams. Use the digest of the file or the MD5 of a session that is available, not a name. Each operation has an md5 rule:required,optionalorabsent.params: the parameters of the operation. The default is{}.
| Tool | Operations | Runs in |
|---|---|---|
ghidra_session |
open, attach, list, get, close, checkpoint.create, checkpoint.list, checkpoint.restore, reset, delete |
The daemon. |
ghidra_upload |
prepare |
The daemon. |
ghidra_job |
list, get, wait |
The daemon. |
ghidra_daemon |
status, shutdown |
The daemon. |
ghidra_analysis |
start, get |
start: the daemon, then the bridge. get: the bridge. |
ghidra_bridge, ghidra_program, ghidra_address, ghidra_memory, ghidra_listing, ghidra_global_variable, ghidra_function, ghidra_decompilation, ghidra_symbol, ghidra_reference, ghidra_comment, ghidra_data_type, ghidra_batch |
The bridge methods of the domain. | The bridge of the session. |
The bridge contract bridge/docs/asyncapi.yaml gives the bridge methods, their schemas and their read_only effects.
The daemon sends only the methods in this contract.
It does not show interface.get and session.shutdown. To stop a session, use ghidra_session close.
The parameters use the objects of the bridge, for example selector, filter, page, patch and resource.
Examples for ghidra_function get and ghidra_comment upsert:
{"operation":"get","md5":"0123456789abcdef0123456789abcdef","params":{"selector":{"entry":"ram:00100000"}}}
{"operation":"upsert","md5":"0123456789abcdef0123456789abcdef","params":{"resource":{"address":"ram:00100000","type":"eol","text":"checked"}}}To create a function, use ghidra_function with its entry address:
{
"operation": "create",
"md5": "0123456789abcdef0123456789abcdef",
"params": {
"resource": { "entry": "ram:00100000", "name": "my_function" },
"disassemble": true
}
}The name is optional. By default, the entry must have an instruction.
Set disassemble to true to decode instructions when the entry has none.
The operation fails if the entry or the function body overlaps a function.
It creates a regular function. It does not identify a thunk.
To delete a function, use its entry address in selector:
{
"operation": "delete",
"md5": "0123456789abcdef0123456789abcdef",
"params": { "selector": { "entry": "ram:00100000" } }
}The operation removes the function definition and its local variables. It keeps the instructions and data.
To get the decompiler view as editor lines, use ghidra_decompilation with format document:
{
"operation": "get",
"md5": "0123456789abcdef0123456789abcdef",
"params": {
"selector": { "entry": "ram:00100000" },
"format": "document",
"include_comments": true
}
}Each token has zero-based UTF-16 columns and the address that the Ghidra GUI selects.
Set include_comments to show all comment types and to return the repeatable comments.
If comments_complete is false, the comment list is not complete.
To apply C++ names to all mangled primary symbols, use ghidra_symbol:
{ "operation": "demangle", "md5": "0123456789abcdef0123456789abcdef", "params": {} }The operation changes names and namespaces only. It keeps function signatures and data types.
Function, symbol, and call results also give demangled_name without a change to the program.
Before the first call to an operation, call ghidra_help with the domain and operation.
Its inputSchema describes the contents of params, not the top-level tool arguments.
Check the required fields and their nested structure before the call.
The ghidra_help tool describes all tools:
{}lists the domain tools.{"domain":"function"}lists the operations of one domain with each operation description, md5 rule, effects, andinputSchema.{"domain":"function","operation":"list"}shows the full parameter schema, the md5 rule and the effects of one operation. The effects are the same as in the bridge contract, for exampleread_only,mutates_programanddestructive.
If the Ghidra process does not start, the session goes to error and its launch job goes to failed.
With wait=false, ghidra_session open returns immediately. Use ghidra_session get and ghidra_job get to see the result.
With wait=true, ghidra_session open waits and returns the error.
The MD5 hash identifies each session. The daemon manages session states through a finite state machine:
When a tool call fails, structuredContent contains a machine-readable JSON-RPC error code:
-32602(invalid_argument): An unknown tool, or invalid or absent tool arguments or operation parameters.-32001(session_lock_timeout,agent_timeout,request_in_flight): Lock timeout or request collision.-32002(missing_target): Unknown binary MD5, session, job ID, domain, or operation.-32000(disconnected,shutting_down): Disconnected bridge session or daemon shutdown.-32603(transaction_failed,bridge_internal,internal_error): Ghidra transaction failure or internal error. Database transaction failures return code-32603(transaction_failed). They do not return as invalid arguments.
On Unix, the persistent data and the runtime data are in different locations:
GHIDRA_MCP_HOME/ # default: ~/.ghidra-mcp
|-- config.toml
`-- projects/<md5>/
|-- binary # Saved binary (or binary.bin, .hex, .ihex, .srec)
|-- binary.json # File name and firmware import flags
|-- attached.json # Attached .gpr path and program name
|-- checkpoints/ # Saved project snapshots
|-- recovery-backups/ # Crash recovery backups
`-- ghidra/
|-- project.gpr
`-- project.rep/
<runtime-base>/ghidra-mcp-<uid>/
|-- projects -> GHIDRA_MCP_HOME/projects
|-- attached/<md5> -> <gpr-parent>
|-- sessions/<md5>/session.json
|-- logs/<md5>/
|-- tmp/
|-- daemon.sock
|-- daemon.log
|-- daemon.lock
|-- server.json
|-- ghidra-bridge.jar
`-- Bridge.java
- The runtime base is
XDG_RUNTIME_DIRon Linux. Otherwise, it is the temporary directory of the system. - If the runtime base has a hidden segment, the daemon uses
/tmpinstead. Ghidra does not accept hidden segments. - The runtime directory has the mode
0700. The daemon log and the lock file have the mode0600. - Ghidra cannot open a project in a hidden directory. For this reason, the daemon gives Ghidra the
projectssymbolic link. The project files stay in the persistent home. - If the
projectspath holds a different object, the daemon stops with an error. It does not replace the object. - For an attached
.gprsession, the daemon creates the non-hidden symbolic linkattached/<md5>to the parent directory of the.gprfile.
On Windows, the default layout is:
%LOCALAPPDATA%\ghidra-mcp\
|-- config.toml
|-- projects\<md5>\
| |-- binary
| |-- binary.json
| |-- attached.json
| |-- checkpoints\
| |-- recovery-backups\
| `-- ghidra\
| |-- project.gpr
| `-- project.rep\
`-- run\
|-- sessions\<md5>\session.json
|-- logs\<md5>\
|-- tmp\
|-- daemon.log
|-- daemon.lock
|-- server.json
|-- ghidra-bridge.jar
`-- Bridge.java
GHIDRA_MCP_HOMEmoves the configuration and the projects. The runtime directory stays in%LOCALAPPDATA%\ghidra-mcp\run.- Ghidra opens the project directly. There is no symbolic link.
- Clients connect through a named pipe.
server.jsoncontains its random name. Only the owner can connect. Remote clients cannot connect.
On all platforms:
- One daemon runs for each runtime directory. A file lock enforces this rule. There is no PID file.
- Each runtime directory uses one persistent home. To change
GHIDRA_MCP_HOME, stop the daemon and clear the runtime directory first. The projects in the old home stay available. - You can delete the runtime directory when the daemon does not run. Then
ghidra_session openwith the MD5 opens the saved project again. - The daemon opens a project again when
project.gprandproject.repexist. Ghidra replays its recovery journal. - The daemon does not change a project directory that it does not recognize. It shows an error.
- The daemon bounds all log files (
daemon.log,stdout.log,stderr.log) to 10 MiB. - The forwarder truncates oversized log lines. It replaces lines above 10 MiB with
[TRUNCATED_LOG_LINE]. - When a log file reaches 10 MiB, the daemon rotates it and keeps up to three backups (
.1,.2,.3). - The daemon replaces sensitive authentication tokens in log lines with
[REDACTED_TOKEN]. - On Windows, the daemon closes active write handles before it renames log files.
- The daemon rotates
daemon.logbefore it opens a file larger than 10 MiB.
To do the same checks as CI, use these commands:
cargo xtask ci
cargo xtask build --release --locked --bin ghidra-mcpOr run the checks separately:
cargo xtask check
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items --lockedCI builds release executables on macOS, Linux and Windows, for x86_64 and ARM64.
Each push to main, each pull request and each manual run starts all six builds.
A failed build does not stop the other builds.
The Windows executables link the C runtime statically.
release-please sets the versions from the Conventional Commits on main:
fix:gives a patch release.feat:gives a minor release.!orBREAKING CHANGE:gives a major release.
release-please opens a release pull request.
This pull request updates the workspace version, Cargo.lock, CHANGELOG.md and the release manifest.
After you merge it, release-please creates a version tag and a draft release at a fixed commit.
All six builds and the dependency audit use that commit.
After those checks pass, CI attaches the executables, SHA-256 checksums and license texts. Then CI publishes the npm packages and makes the draft public. Failed checks leave the release as a draft. Rerun the failed jobs. CI does not publish an npm package again if npm has that version.
CI uses the default GITHUB_TOKEN for GitHub.
For npm, CI uses trusted publishers through GitHub OIDC. You do not need other secrets.
Each npm package must have a trusted publisher for this repository and the ci.yml workflow.
Note
- The repository must let GitHub Actions make pull requests.
- A CI run for a release pull request from
GITHUB_TOKENmust have maintainer approval. Approve the run before you merge.
For runbooks about Ghidra discovery, Java 21, socket permissions, memory, and logs, read the Troubleshooting guide.
- Set
GHIDRA_INSTALL_DIRorGHIDRA_HOME. - Alternatively, put
analyzeHeadlessorghidraRunonPATH.
- Make sure that
ghidra-bridge.jaris in the runtime directory. - If you changed the bridge source, run
cargo xtask buildagain. The xtask command builds and embeds the bridge again.
- Read
daemon.login the runtime directory. - Make sure that no other program uses the HTTP address. To let the system select a free port, use
--listen 127.0.0.1:0. daemon.lockstops a second daemon in the same runtime directory. Do not delete the runtime files while the daemon runs.
- First Steps: configuration steps and the first analysis procedure.
- Troubleshooting: runbooks for discovery, Java 21, permissions, memory, and logs.
- Architecture: processes, request flows, session lifecycle, concurrency, process ownership and security.
- API documentation of each module and item:
cargo doc --no-deps --document-private-items --open. - Security policy: deployment and vulnerability reports.
- Changelog.
- The Java bridge has its own documents:
bridge/README.md,bridge/docs/protocol.md,bridge/docs/api.mdandbridge/docs/development.md.
We welcome contributions. CONTRIBUTING.md gives the prerequisites, the standards for code and text, and the extension procedures. The code of conduct applies to all participants.
The Rust code is in src/.
The xtask/ directory contains automation tools.
The Java bridge is a Git submodule.
Clone with --recurse-submodules, or use git submodule update --init --recursive.
The MIT License applies to this project.
The Java bridge in bridge/ has a separate license. See bridge/LICENSE.