Ghidra Headless MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
python3 -m venv .venv
. .venv/bin/activate
pip install .
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "GHIDRA_INSTALL_DIR=${GHIDRA_INSTALL_DIR}" ghidra-headless-mcp -- python3 "<FULL_PATH_TO_GHIDRA_HEADLESS_MCP>/dist/index.js" --ghidra-install-dir /ABSOLUTE/PATH/TO/ghidra

Replace <FULL_PATH_TO_GHIDRA_HEADLESS_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:GHIDRA_INSTALL_DIR
README.md

Headless Ghidra server for AI-driven reverse engineering and analysis

Ghidra Headless MCP

A headless Ghidra server that speaks MCP (Model Context Protocol), giving AI agents full access to deep reverse-engineering workflows: program lifecycle, disassembly, decompilation, patching, types, xrefs, scripting, and more, without a GUI.

Designed to run in the same Docker container as the agent runtime. No sidecars, no extra services.

This entire project---code, tests, and documentation---is 100% vibe coded.

Why

Existing Ghidra automation usually assumes either interactive GUI use or ad hoc scripts with a narrow workflow. This server is headless-only and designed for agent-driven workflows in sandboxed VM/container environments: the agent gets full control over the analysis system, automating large parts of reverse engineering while you interactively discuss and steer the process.

The goal is an interface where agents can inspect, refine, and extend an analysis over time: updating types, symbols, and metadata, improving the analysis database incrementally, applying patches and iterating safely with transactions and undo/redo, and running custom scripts when a workflow needs something bespoke.

Features

  • 212 tools across 34 feature groups: project and program lifecycle, disassembly, decompilation, patching, transactions, types, layouts, memory, search, graph extraction, scripting, and more.
  • Read-only by default with safe mutation workflows (transactions, undo/redo, explicit save paths).
  • Scripting access via ghidra.eval, ghidra.call, and ghidra.script for anything the tool catalog doesn't cover.
  • Stdio and TCP transports.
  • Real pyghidra backend for live headless Ghidra workflows.
  • Fake backend mode for CI and development without a Ghidra install.

Prerequisites

  • Python 3.11+
  • A Ghidra installation plus pyghidra in your runtime (for real analysis)
  • For CI/development without Ghidra, use fake backend mode

Installation

From the repo root:

python3 -m venv .venv
. .venv/bin/activate
pip install .

For development:

pip install -e ".[dev]"

Quick Start

Stdio transport (default):

GHIDRA_INSTALL_DIR=/ABSOLUTE/PATH/TO/ghidra python3 ghidra_headless_mcp.py

TCP transport:

GHIDRA_INSTALL_DIR=/ABSOLUTE/PATH/TO/ghidra python3 ghidra_headless_mcp.py --transport tcp --host 127.0.0.1 --port 8765

Fake backend mode (no Ghidra required):

python3 ghidra_headless_mcp.py --fake-backend

Installed console script:

ghidra-headless-mcp --version

Use With AI Agents

This server speaks standard MCP over stdio (default) or tcp, so any MCP-capable agent host can use it.

Claude Code

claude mcp add ghidra_headless_mcp -- python3 /path/to/ghidra-headless-mcp/ghidra_headless_mcp.py --ghidra-install-dir /ABSOLUTE/PATH/TO/ghidra

Or add it to your project's .mcp.json:

{
  "mcpServers": {
    "ghidra_headless_mcp": {
      "command": "python3",
      "args": [
        "ghidra_headless_mcp.py",
        "--ghidra-install-dir",
        "/ABSOLUTE/PATH/TO/ghidra"
      ],
      "cwd": "/path/to/ghidra-headless-mcp"
    }
  }
}

For fake mode, append --fake-backend and omit the install dir.

Codex

codex mcp add ghidra_headless_mcp -- python3 ghidra_headless_mcp.py --ghidra-install-dir /ABSOLUTE/PATH/TO/ghidra

Generic MCP Host

  • Register a server named ghidra_headless_mcp.
  • Use command python3 with args ["ghidra_headless_mcp.py", "--ghidra-install-dir", "/ABSOLUTE/PATH/TO/ghidra"] when cwd is the repo root, or use an absolute script path in args.
  • Set cwd to the repo path if you want relative paths like samples/ls to resolve correctly.
  • Use stdio transport unless your host requires TCP.
  • For fake mode (no Ghidra installed), append --fake-backend.
  • Verify connectivity by calling health.ping, then program.open.

Docker Co-Location Pattern

Recommended deployment model: run the agent process and this MCP server in the same container image.

Example baseline:

FROM kalilinux/kali-rolling:latest
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip ghidra
WORKDIR /app
COPY . /app
RUN python3 -m pip install --upgrade pip --break-system-packages \
 && python3 -m pip install ".[dev]" --break-system-packages
CMD ["python3", "ghidra_headless_mcp.py", "--fake-backend"]

If you need real Ghidra analysis in-container, keep Ghidra installed in that same image and set GHIDRA_INSTALL_DIR or pass --ghidra-install-dir.

MCP Methods

  • initialize
  • ping
  • tools/list
  • tools/call
  • shutdown

tools/list behavior:

  • Without explicit pagination params, returns the full tool catalog.
  • If offset or limit is provided, uses paginated output (offset=0, limit=50 default in paged mode).
  • Supports filtering via:
    • prefix (for example `p

Tools (2)

program.openOpens a program for analysis in the Ghidra environment.
health.pingChecks the connectivity and status of the Ghidra server.

Environment Variables

GHIDRA_INSTALL_DIRrequiredAbsolute path to the Ghidra installation directory

Configuration

claude_desktop_config.json
{"mcpServers": {"ghidra_headless_mcp": {"command": "python3", "args": ["ghidra_headless_mcp.py", "--ghidra-install-dir", "/ABSOLUTE/PATH/TO/ghidra"], "cwd": "/path/to/ghidra-headless-mcp"}}}

Try it

Open the binary at /samples/ls and provide a summary of the main function.
Decompile the entry point of the loaded program and identify any suspicious system calls.
Apply a patch to the function at address 0x401000 to bypass the license check.
List all cross-references to the 'password_check' function in the current program.

Frequently Asked Questions

What are the key features of Ghidra Headless MCP?

Access to over 200 specialized tools for disassembly, decompilation, and patching. Supports safe mutation workflows with transactions, undo, and redo capabilities. Enables scripting access via ghidra.eval, ghidra.call, and ghidra.script. Supports both stdio and TCP transports for flexible agent integration. Includes a fake backend mode for CI and development without a full Ghidra install.

What can I use Ghidra Headless MCP for?

Automating large-scale reverse engineering workflows for security research. Iteratively refining analysis databases by updating types, symbols, and metadata. Safe patching and testing of binary code within sandboxed container environments. Extracting graph data and cross-references for complex binary analysis.

How do I install Ghidra Headless MCP?

Install Ghidra Headless MCP by running: python3 -m venv .venv && . .venv/bin/activate && pip install .

What MCP clients work with Ghidra Headless MCP?

Ghidra Headless MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Ghidra Headless MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare