Back to MCP Servers

GhidrAssistMCP

A native Model Context Protocol server for Ghidra. Includes GUI configuration and logging, 31 powerful tools and no external dependencies.

security
By jtang613
65552Updated 1 week agoJavaMIT

Installation

npx -y GhidrAssistMCP

Configuration

{
  "mcpServers": {
    "GhidrAssistMCP": {
      "command": "npx",
      "args": ["-y", "GhidrAssistMCP"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

GhidrAssistMCP

A powerful Ghidra extension that provides an MCP (Model Context Protocol) server, enabling AI assistants and other tools to interact with Ghidra's reverse engineering capabilities through a standardized API.

Overview

GhidrAssistMCP bridges the gap between AI-powered analysis tools and Ghidra's comprehensive reverse engineering platform. By implementing the Model Context Protocol, this extension allows external AI assistants, automated analysis tools, and custom scripts to seamlessly interact with Ghidra's analysis capabilities.

Key Features

  • MCP Server Integration: Full Model Context Protocol server implementation using official SDK
  • Dual HTTP Transports: Supports SSE and Streamable HTTP transports for maximum client compatibility
  • 49 Built-in Tools: Comprehensive set of analysis tools with action-based consolidation for cleaner APIs
  • 6 MCP Resources: Static data resources for program info, functions, strings, imports, exports, and segments
  • 7 MCP Prompts: Pre-built analysis prompts for common reverse engineering tasks
  • Result Caching: Intelligent caching system to improve performance for repeated queries
  • Async Task Support: Long-running operations execute asynchronously with task management
  • Multi-Program Support: Work with multiple open programs simultaneously using program_name; use list_binaries Project Path values to disambiguate duplicate filenames
  • Multi-Window Support: Single MCP server shared across all CodeBrowser windows with intelligent focus tracking
  • Active Context Awareness: Automatic detection of which binary window is in focus, with context hints in all tool responses
  • Configurable UI: Easy-to-use interface for managing tools and monitoring activity
  • Real-time Logging: Track all MCP requests and responses with detailed logging
  • Dynamic Tool Management: Enable/disable tools individually with persistent settings

Clients

Shameless self-promotion: GhidrAssist supports GhidrAssistMCP right out of the box.

Screenshots

Screenshot Screenshot

Installation

Prerequisites

  • Ghidra 11.4+ (tested with Ghidra 12.1 Public)
  • An MCP Client (Like GhidrAssist)

Binary Release (Recommended)

  1. Download the latest release:

    • Go to the Releases page
    • Download the latest .zip file (e.g., GhidrAssistMCP-v1.0.0.zip)
  2. Install the extension:

    • In Ghidra: File → Install Extensions → Add Extension
    • Select the downloaded ZIP file
    • Restart Ghidra when prompted
  3. Enable the plugin:

    • File → Configure → Configure Plugins
    • Search for "GhidrAssistMCP"
    • Check the box to enable the plugin

Building from Source

  1. Clone the repository:

    git clone <repository-url>
    cd GhidrAssistMCP
  2. Point Gradle at your Ghidra install:

    • Set GHIDRA_INSTALL_DIR (environment variable), or pass -PGHIDRA_INSTALL_DIR=<path> when you run Gradle.
  3. Build + install:

    Ensure Ghidra isn't running and run:

    gradle installExtension

    This copies the built ZIP into your Ghidra install ([GHIDRA_INSTALL_DIR]/Extensions/Ghidra) and extracts it into your Ghidra user Extensions folder (replacing any existing extracted copy).

    If you need to override that location, pass -PGHIDRA_USER_EXTENSIONS_DIR=<path>.

  4. Restart / verify:

    • Restart Ghidra.
    • If the plugin doesn't appear, enable it via File → Configure → Configure Plugins (search for "GhidrAssistMCP").

Configuration

Initial Setup

  1. Open the Control Panel:

    • Window → GhidrAssistMCP (or use the toolbar icon)
  2. Configure Server Settings:

    • Host: Default is localhost
    • Port: Default is 8080
    • Enable/Disable: Toggle the MCP server on/off

Tool Management

The Configuration tab allows you to:

  • View all available tools (49 total)
  • Enable/disable individual tools using checkboxes
  • Save configuration to persist across sessions
  • Monitor tool status in real-time

Headless Mode Quickstart

GhidrAssistMCP can also be started from Ghidra's analyzeHeadless launcher. This is useful when you want MCP access to a program loaded in headless Ghidra without opening the CodeBrowser UI.

First, build and install the extension so Ghidra can load the compiled classes and bundled dependencies:

cd /path/to/GhidrAssistMCP

export GHIDRA_INSTALL_DIR=/path/to/ghidra_12.1_PUBLIC
gradle installExtension

Set paths for your Ghidra install and extracted user extension. On Linux, Ghidra user extensions usually live under ~/.config/ghidra/<ghidra_profile>/Extensions:

export GHIDRA_INSTALL_DIR=/path/to/ghidra_12.1_PUBLIC
export GHIDRA_USER_EXTENSIONS_DIR="$HOME/.config/ghidra/ghidra_12.1_PUBLIC/Extensions"
export GHIDRASSISTMCP_EXT="$GHIDRA_USER_EXTENSIONS_DIR/GhidrAssistMCP"

Import a binary and start the MCP server as a headless pre-script:

"$GHIDRA_INSTALL_DIR/support/analyzeHeadless" /tmp/ghidra-projects McpHeadless \
  -import /path/to/binary \
  -scriptPath "$GHIDRASSISTMCP_EXT/ghidra_scripts" \
  -preScript GAMCPStartServerScript.java "host=127.0.0.1" "port=8080"

For a binary that is already imported into the project, use -process instead:

"$GHIDRA_INSTALL_DIR/support/analyzeHeadless" /tmp/ghidra-projects McpHeadless \
  -process binary_name \
  -scriptPath "$GHIDRASSISTMCP_EXT/ghidra_scripts" \
  -preScript GAMCPStartServerScript.java "host=127.0.0.1" "port=8080"

To keep a headless MCP session open after analysis completes, run the server as a post-script with wait mode:

"$GHIDRA_INSTALL_DIR/support/analyzeHeadless" /tmp/ghidra-projects McpHeadless \
  -process binary_name \
  -scriptPath "$GHIDRASSISTMCP_EXT/ghidra_scripts" \
  -postScript GAMCPStartServerScript.java "host=127.0.0.1" "port=8080" "wait=true"

MCP clients can connect to:

SSE:             http://127.0.0.1:8080/sse
SSE messages:    http://127.0.0.1:8080/message
Streamable HTTP: http://127.0.0.1:8080/mcp

The headless MCP server runs inside the analyzeHeadless JVM and uses the loaded currentProgram. The server holds a program consumer while it is running so MCP requests do not race against program database closure. Use wait=true when you want analyzeHeadless to stay open for interactive MCP clients; cancel the script or terminate the process to stop the server.

Available Tools

GhidrAssistMCP provides 49 tools organized into categories. Several tools use an action-based API pattern where a single tool provides multiple related operations.

Binary & Program Management

ToolDescription
get_binary_infoGet basic program information (name, architecture, compiler, etc.)
list_binariesList all open programs across all CodeBrowser windows, including Project Path values for unambiguous program_name targeting
open_programList/open project programs in CodeBrowser, with optional analysis prompt suppression and analysis-after-open task submission
close_programClose an open CodeBrowser program; changed programs require save=true or ignore_changes=true
import_fileImport a host file into the current Ghidra project and optionally open it (disabled by default)
project_filesList or delete files/folders in the active Ghidra project; deletion requires confirm=true
scriptsList/read/create/delete/run Ghidra scripts (disabled by default)
assemble_codeAssemble instruction text at an address and optionally patch it into program memory
patch_bytesPatch raw bytes in program memory at a given address
export_programExport the current program to disk (binary or original_file) (disabled by default)

Security-sensitive tools: import_file, scripts, and export_program are disabled by default because they interact with the host filesystem or execute script code. Enable them explicitly in the plugin configuration UI when needed. project_files deletes entries from the active Ghidra project database, not the original imported host files, and requires confirm=true.

Auto Analysis

ToolDescription
analysis_optionsList/set/reset Auto Analysis options and save/apply/list/delete option presets for the current program
analyze_programRun Auto Analysis on the current program or all open programs; supports full re-analysis, pending-changes analysis, address ranges, and option overrides
analysis_controlQuery Auto Analysis status or request cancellation of queued analysis tasks

Function Discovery & Analysis

ToolDescription
get_functionsList functions with optional pattern filtering and pagination
search_functions_by_nameFind functions by name pattern
get_function_statisticsComprehensive statistics for all functions
analyze_functionGet detailed function information (signature, variables, etc.)
get_current_functionGet function at current cursor position
get_function_stack_layoutGet stack frame layout with variable offsets
get_basic_blocksGet basic block information for a function
create_functionCreate/define a function at an address, optionally clearing existing data/code first
disassemble_atDisassemble code at an address, optionally clearing existing data/code in the range first

Binary Information

ToolDescription
get_importsList imported functions/symbols
get_exportsList exported functions/symbols
get_stringsList string references with optional filtering
search_stringsSearch strings by pattern
get_segmentsList memory segments
get_namespacesList namespaces in the program
get_relocationsList relocation entries
get_entry_pointsList all binary entry points

Data Analysis

ToolDescription
get_data_varsList data definitions in the program
get_data_atGet hexdump/data at a specific address
create_data_varDefine data variables at addresses
get_current_addressGet current cursor address

Consolidated Tools

These tools bundle related operations behind a discriminator parameter (e.g., action, target, target_type, or format).

get_code - Code Retrieval Tool

ParameterValuesDescription
formatdecompiler, disassembly, pcodeOutput format
rawbooleanOnly affects format: "pcode" (raw pcode ops vs grouped by basic blocks)

classes - Class Operations Tool

ActionDescription
listList classes with optional pattern filtering and pagination
get_infoGet detailed class information (methods, fields, vtables, virtual functions)

xrefs - Cross-Reference Tool

ParameterDescription
addressFind all references to/from a specific address
functionFind all cross-references for a function
include_callsInclude callers/callees (replaces separate call graph tool)

struct - Structure Operations Tool

ActionDescription
createCreate a new structure from C definition or empty
modifyModify an existing structure with new C definition
mergeMerge (overlay) fields from a C definition onto an existing structure without deleting existing fields
set_fieldSet/insert a single field at a specific offset without needing a full C struct (

View source on GitHub