bethington/ghidra-mcp

▲ 23 stars today★ 3,830⑂ 138

Ghidra MCP Server — 200+ MCP tools for AI-powered reverse engineering. GUI plugin + headless server, lazy tool loading, convention enforcement, batch operations, Ghidra Server integration

About bethington/ghidra-mcp

bethington/ghidra-mcp is an open-source project on GitHub, mainly written in Java. Ghidra MCP Server — 200+ MCP tools for AI-powered reverse engineering. GUI plugin + headless server, lazy tool loading, convention enforcement It currently holds 3,830 stars and 138 forks with 64 open issues, and was last pushed on 2026-09-11 (repository created 2025-08-30).

Project Overview

AI Homed tracks it on the Today's Trending board, currently at rank #58 with 23 new stars today.

GitHub Repository Details

Repository bethington/ghidra-mcp · default branch main · size 13754 KB · watchers 10 · source: GitHub REST API and repository README

README

Ghidra MCP Server

MCP Toplist

Tests Release License GitHub Sponsors

Python Java Ghidra MCP

Stars Last commit Discussions Issues OpenSSF Scorecard

If you find this useful, please ⭐ star the repo — it helps others discover it!
> If Ghidra MCP saves you time, consider sponsoring the project. One-time and recurring support both help fund compatibility updates, production hardening, docs, and new tooling.

A production-ready Model Context Protocol (MCP) server that bridges Ghidra's powerful reverse engineering capabilities with modern AI tools and automation frameworks. 253 MCP tools, battle-tested AI workflows, and the most comprehensive Ghidra-MCP integration available — now including P-code emulation, live debugger integration, and PCode-graph data flow analysis.

Why Ghidra MCP?

Most Ghidra MCP implementations give you a handful of read-only tools and call it a day. This project is different — it was built by a reverse engineer who uses it daily on real binaries, not as a demo.

Convention Enforcement

You've been there: six months into a project you find ProcessItem, process_items, handleItem, and ItemProc in the same codebase — four functions doing the same thing, named by four different sessions or engineers with no shared contract. Fixing it takes longer than it should, and the problem will happen again.

v5.0 moves conventions from "things to remember" into the tool layer, where they can actually be enforced.

| Tier | Behavior | Example | |------|----------|---------| | Auto-fix | Applied silently | count field on a uint32 → auto-prefixed dwCount on save | | Warn | Change goes through, warning returned | processData → "name should be PascalCase with a verb: ProcessData" | | Reject | Change blocked with explanation | undefined → undefined type change → "no-op rejected, type unchanged" |

For AI agents, this means consistent output across every session, every model, every run — without pasting a style guide into every prompt. The tool knows the rules; the model just needs to make the call.

For teams, it eliminates the entire class of review comment that says "that's not our naming convention." Convention arbitration stays in the tool, not in code review.

For solo work at scale, analyze_function_completeness gives you a 0–100% score that measures honestly: structural deductions (unfixable compiler artifacts) are forgiven in your effective score, log-scaling prevents one bad category from burying everything else, and tiered plate comment quality means you know exactly what's missing and why.

🌟 Features

Core MCP Integration

Compatibility note: MCP tool names are normalized for GitHub Copilot CLI
and CAPI validation. Exposed tool names use lowercase letters, digits,
underscores, and hyphens only; nested HTTP paths such as /debugger/status
are advertised as names like debugger_status_2 when needed to avoid
collisions with static bridge tools.

Binary Analysis Capabilities

Dynamic Analysis (v5.4.0)

AI-Powered Reverse Engineering Workflows

Development & Automation

🚀 Quick Start

Prerequisites

Shared Ghidra Server users: Ghidra 12.1.2 clients require a Ghidra
Server at 12.1, 12.0.5, or a newer compatible version. Upgrade the
server before using this plugin from a 12.1 client.
> Ghidra 12.1.2 ships Jython as an optional extension. Java scripts work
by default, but .py scripts in ghidra_scripts/ require installing
the Jython extension from File > Install Extensions and restarting
Ghidra.

Installation

Recommended for all platforms: use python -m tools.setup directly.
> ensure-prereqs installs runtime Python requirements plus the Ghidra JARs needed in the local Maven repository.
deploy copies the build output, installs the user-profile extension, and patches Ghidra user config.

1. Clone the repository:

   git clone https://github.com/bethington/ghidra-mcp.git
   cd ghidra-mcp
   

2. Recommended: run environment preflight first:

   python -m tools.setup preflight --ghidra-path "F:\ghidra_12.1.2_PUBLIC"
   

3. Build and deploy to Ghidra:

   python -m tools.setup ensure-prereqs --ghidra-path "F:\ghidra_12.1.2_PUBLIC"
   python -m tools.setup build
   python -m tools.setup deploy --ghidra-path "F:\ghidra_12.1.2_PUBLIC"
   

deploy saves/closes an already-running matching Ghidra instance when needed, installs the extension, starts Ghidra, waits for MCP health, and runs schema smoke checks.

4. Optional strict/manual mode (advanced):

   # Skip automatic prerequisite setup
   python -m tools.setup build
   python -m tools.setup deploy --ghidra-path "F:\ghidra_12.1.2_PUBLIC"
   

5. Show command help:

   python -m tools.setup --help
   

6. Optional build-only mode (advanced/troubleshooting):

   python -m tools.setup build
   

Supported build path: python -m tools.setup build uses Maven under the hood and is the canonical workflow used by the repo tasks and docs.

   # Manual Maven build (requires Ghidra deps already installed in local .m2)
   mvn clean package assembly:single -DskipTests
   
   # Secondary/manual Gradle build path only (not used by tools.setup or VS Code tasks)
   GHIDRA_INSTALL_DIR=/path/to/ghidra gradle buildExtension
   

Installation (Linux — Ubuntu/Debian)

1. Clone the repository:

   git clone https://github.com/bethington/ghidra-mcp.git
   cd ghidra-mcp
   

2. Install system prerequisites (if not already installed):

   sudo apt update && sudo apt install -y openjdk-21-jdk maven python3 python3-pip python3-venv curl jq unzip
   

> Debian/Kali/Ubuntu 23.04+ note (PEP 668): these distros mark the system > Python as externally managed, so a bare pip install fails with > error: externally-managed-environment. Don't work around it with > --break-system-packages — it can corrupt apt-managed tooling. Instead use > uv (recommended — it creates and manages a > project-local .venv automatically, and is what this repo's commands use): >

   > curl -LsSf https://astral.sh/uv/install.sh | sh
   > uv run bridge-mcp-ghidra    # resolves deps into .venv and starts the bridge
   > 
> or a classic virtual environment: >
   > python3 -m venv .venv && source .venv/bin/activate
   > pip install -e .
   > bridge-mcp-ghidra
   > 

3. Run environment preflight:

   python -m tools.setup preflight --ghidra-path ~/ghidra_12.1.2_PUBLIC
   

4. Build and deploy to Ghidra (single command):

   python -m tools.setup ensure-prereqs --ghidra-path ~/ghidra_12.1.2_PUBLIC
   python -m tools.setup build
   python -m tools.setup deploy --ghidra-path ~/ghidra_12.1.2_PUBLIC
   

This will:

5. Optional: setup only Maven dependencies:
   python -m tools.setup install-ghidra-deps --ghidra-path ~/ghidra_12.1.2_PUBLIC
   

6. Show command help:

   python -m tools.setup --help
   

Linux paths: The extension is installed to $HOME/.config/ghidra/ghidra__PUBLIC/Extensions/GhidraMCP/.
Ghidra config files are in $HOME/.config/ghidra/ghidra__PUBLIC/.

Installation (macOS — Homebrew)

1. Install prerequisites:

   brew install openjdk@21 maven python ghidra
   

2. Clone the repository:

   git clone https://github.com/bethington/ghidra-mcp.git
   cd ghidra-mcp
   

3. Install Ghidra JARs into local Maven:

    python -m tools.setup install-ghidra-deps \
       --ghidra-path /opt/homebrew/opt/ghidra/libexec
   

4. Build and deploy:

    python -m tools.setup ensure-prereqs \
       --ghidra-path /opt/homebrew/opt/ghidra/libexec
    python -m tools.setup build
    python -m tools.setup deploy \
       --ghidra-path /opt/homebrew/opt/ghidra/libexec
   
The extension is installed to ~/Library/ghidra/ghidra_12.1.2_PUBLIC/Extensions/GhidraMCP/.

> Note: --ghidra-version is required when using the Homebrew path because the path contains no version string.

5. Start Ghidra and enable the plugin:

   /opt/homebrew/opt/ghidra/libexec/ghidraRun
   
In the main project window: Tools > GhidraMCP > Start MCP Server

6. Configure Cursor/Claude MCP (~/.cursor/mcp.json):

   {
     "mcpServers": {
       "ghidra": {
         "command": "uv",
         "args": ["run", "--directory", "/path/to/ghidra-mcp", "bridge-mcp-ghidra"]
       }
     }
   }
   

Installation (Arch Linux — AUR)

@Pandoriaantje maintains community AUR packages:

Install with your AUR helper of choice, e.g.:

yay -S ghidra-mcp        # or ghidra-mcp-git

Basic Usage

Option 1: Stdio Transport (Recommended for AI tools)

uv run bridge-mcp-ghidra          # or: python -m bridge_mcp_ghidra

To add the bridge to Autohand Code from a cloned checkout:

autohand mcp add ghidra uv run --directory /path/to/ghidra-mcp bridge-mcp-ghidra

Add --scope project before ghidra to save the server in the current project's .autohand configuration instead of your user configuration.

Option 2: Streamable HTTP Transport (Recommended for web/HTTP clients)

uv run bridge-mcp-ghidra --transport streamable-http --mcp-host 127.0.0.1 --mcp-port 8081

MCP client config for the HTTP transport (add to your client's MCP config file):

{
  "mcpServers": {
    "ghidra-mcp-http": {
      "url": "http://127.0.0.1:8081/mcp"
    }
  }
}

Browser-based clients (e.g. MCP Inspector) work out of the box: the HTTP transports answer CORS preflight (OPTIONS) requests and expose the mcp-session-id / mcp-protocol-version headers to scripts. Allowed origins mirror the Host-header policy — loopback on any port is always permitted, plus the bind host and any hosts listed in GHIDRA_MCP_ALLOWED_HOSTS.

Option 3: SSE Transport (Deprecated — use streamable-http instead)

uv run bridge-mcp-ghidra --transport sse --mcp-host 127.0.0.1 --mcp-port 8081

Bridge advanced flags

| Flag | Default | Description | |------|---------|-------------| | --transport | stdio | stdio (AI tools), streamable-http (web clients), sse (deprecated) | | --mcp-host | 127.0.0.1 | Bind host for HTTP transports | | --mcp-port | — | Port for HTTP transports | | --lazy | off | Load only the default tool groups on connect. Faster startup, but MCP clients that don't support tools/list_changed will see an incomplete tool list. Not recommended for Claude Code. | | --no-lazy | (default) | Load all tool groups immediately on connect. Required for most AI clients. | | --default-groups | listing,function,program | Comma-separated groups loaded on connect when --lazy is set. |

Strict program routing (multi-program safety)

Set GHIDRA_MCP_REQUIRE_PROGRAM_SELECTORS=1 to make the bridge refuse any program-scoped call that omits a program selector, returning a clear error instead of letting the call ride the server's shared "current program" (the one switch_program and the active GUI tab move).

export GHIDRA_MCP_REQUIRE_PROGRAM_SELECTORS=1
uv run bridge-mcp-ghidra

Without this, a call that leaves program= out runs against whichever program is current, which is fine for a single-program workflow but a hazard once several programs are open: the call can read or edit the wrong binary with no error. The hazard is worse when more than one client shares a server, since each one moves that current-program global out from under the others.

With strict mode on, every program-scoped call must name its target. This covers every selector that picks an open program: plain program= and the cross-program tools' source_program/target_program or program_a/program_b (declared required, but the server still falls back to the current program when one arrives empty). A forgotten selector surfaces as a loud error on the first bad call instead of a silent write to the wrong binary. Tools with no program selector (open_program and close_program take path/name) are unaffected. Off by default: with the variable unset the bridge sends calls unchanged.

Reducing tool-context overhead

The bridge exposes a large catalog. To keep the model's tool surface small, run with --lazy (loads only listing,function,program on connect) and let the model discover the rest on demand instead of registering everything:

including tools whose group isn't loaded. Each result says whether it's callable now and, if not, the exact load_tool_group(...) call to enable it. drop a category at runtime. are callable right now.

search_tools works in both eager and --lazy modes, so agents that honor tools/list_changed get full discovery without the upfront context cost.

Optional: Connect a standalone debugger server

The debugger server itself moved to the d2-game-exe repository on 2026-08-11 (its D2 calling-convention layer made it game-specific). Start it there, then point this bridge at it:

export GHIDRA_DEBUGGER_URL=http://127.0.0.1:8099

The bridge's 22 debugger_* proxy tools register only when that variable is set, so leaving it unset costs nothing — the tools simply do not appear rather than appearing and failing.

Debugger server flags:

| Flag | Default | Description | |------|---------|-------------| | --port | 8099 | HTTP server port | | --host | 127.0.0.1 | Bind address (0.0.0.0 to expose on LAN) | | --exports-dir | — | Path to a dll_exports/ directory for ordinal-to-name resolution | | --log-level | INFO | DEBUG, INFO, WARNING, or ERROR |

Set GHIDRA_DEBUGGER_URL in .env if you change the default port or host so the bridge can find it.

In Ghidra

1. Start Ghidra and open a CodeBrowser window 2. In CodeBrowser, enable the plugin via File > Configure > Configure All Plugins > GhidraMCP 3. Optional: configure custom port via CodeBrowser > Edit > Tool Options > GhidraMCP HTTP Server 4. Start the server via Tools > GhidraMCP > Start MCP Server 5. The server runs on http://127.0.0.1:8089/ by default

Verify It's Working

# Quick health check
curl http://127.0.0.1:8089/check_connection

Expected: "Connected: GhidraMCP plugin running with program ''"

Get version info

curl http://127.0.0.1:8089/get_version

Support This Project

If Ghidra MCP saves you engineering or reverse-engineering time, consider sponsoring the project.

🔒 Security

GhidraMCP is designed for localhost-only development. The default configuration — HTTP server bound to 127.0.0.1, no authentication — is safe on a trusted single-user workstation and matches pre-v5.4.1 behavior.

If you expose the server beyond loopback, configure these three environment variables first. The server refuses to start on a non-loopback bind without a token.

| Env var | Effect | |---|---| | GHIDRA_MCP_AUTH_TOKEN | When set, every HTTP request must carry Authorization: Bearer . Timing-safe comparison. /mcp/health, /health, /check_connection are exempt. | | GHIDRA_MCP_ALLOW_SCRIPTS | Set to 1, true, or yes to enable /run_script_inline and /run_ghidra_script. Off by default as of v5.4.1 — these endpoints execute arbitrary Java against the Ghidra process. In headless mode this also triggers OSGi BundleHost initialization at server startup (Felix framework, ~hundreds of ms); leave it off if you don't need script execution. | | GHIDRA_MCP_FILE_ROOT | When set to a directory path, filesystem-path endpoints (/load_program, /import_file, /open_project, /delete_file, etc.) canonicalize the input and require it to fall under this root. Prevents path-traversal. |

Name-quality enforcement is separate from security. By default, rename_function and global write endpoints reject names that fail the built-in quality gates, and struct field writes apply the built-in field prefix convention. Disable the built-in convention layer with **

GitHub Stars & Activity

3,830Stars
138Forks
64Open issues
JavaLanguage

GitHub Popularity

GitHub stars3,830
Forks138
Open issues64
Primary languageJava
LicenseApache-2.0
Stars gained today23
Created2025-08-30
Last pushed2026-09-11

Trending History

Daily boardrank #58 · ▲ 23 stars

Related AI Projects

1

github / copilot-sdk

Java★ 10,479⑂ 1,452▲ 4 stars
2

LaurieWired / GhidraMCP

Java★ 10,066⑂ 1,039▲ 21 stars
3

agentscope-ai / agentscope-java

Java★ 5,641⑂ 1,370▲ 23 stars
4

obra / superpowers

Shell★ 287,446⑂ 25,707▲ 522 stars
5

mattpocock / skills

Shell★ 263,286⑂ 22,208▲ 820 stars
6

affaan-m / ECC

JavaScript★ 259,730⑂ 38,861▲ 1,046 stars
7

NousResearch / hermes-agent

Python★ 245,944⑂ 0
8

deepseek-ai / deepseek-harness

TypeScript★ 225,686⑂ 0

More AI Rankings