Skip to content

themixednuts/GhidraMCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub release (latest by date) Build Status Tested Ghidra Version License GitHub stars GitHub forks

Install MCP Server

GhidraMCP

Ghidra integration for the Model Context Protocol (MCP)


✨ Features

Core Analysis

  • Analyze RTTI - Microsoft RTTI structure analysis with type detection and demangling
  • Decompile Code - Function decompilation to C-like pseudocode with P-code analysis
  • Demangle Symbols - C++ symbol demangling with multiple format support
  • Script Guidance - Provides guidance on using Ghidra scripts like DemangleAllScript for advanced demangling

Management Operations

  • Manage Data Types - Create and update structures, enums, unions, typedefs, and categories
  • Manage Functions - Create, update, and manage function definitions and prototypes
  • Manage Memory - Read/write bytes, manage segments, and analyze memory layout
  • Manage Project - Navigate addresses, manage bookmarks, and control project settings
  • Manage Symbols - Create, rename, and organize symbols with namespace support

Read Operations

  • Read Data Types - Browse and query program data types with filtering and pagination
  • Read Functions - Enumerate functions with detailed metadata and filtering
  • Read Listing - View disassembly and data from program listing with address, range, or function-based viewing
  • Read Memory Blocks - View memory segments, permissions, and properties
  • Read Symbols - Browse symbols with type and namespace filtering

Delete Operations

  • Delete Bookmark - Remove bookmarks by address or category
  • Delete Data Type - Remove data type definitions from the program
  • Delete Function - Remove function definitions and associated data
  • Delete Symbol - Remove symbols by name, ID, or address

Discovery & Search

  • List Analysis Options - View available analysis options and settings
  • List Programs - Discover open and closed programs in the project with pagination and filtering
  • Find References - Locate code and data references with pagination support
  • Search Memory - Pattern search with hex, string, binary, and regex support

Utilities

  • Batch Operations - Execute multiple tool operations in a single transaction with automatic rollback on failure
  • Undo/Redo - Transaction-based undo/redo operations

πŸš€ Installation

  1. Download the latest release zip file from the Releases page.
  2. In Ghidra, go to File -> Install Extensions....
  3. Click the + button (Add extension) in the top right corner.
  4. Navigate to the downloaded zip file and select it.
  5. Ensure the GhidraMCP extension is checked in the list and click OK.
  6. Restart Ghidra.

▢️ Usage

Configure the MCP server settings (see 'Configuration' below) and ensure your MCP Client is configured to connect (see 'Configuring an MCP Client' below).

Warning

Script Error Dialogs: Some tools that execute Ghidra scripts may trigger GUI error dialogs via Msg.showError. These dialogs must be manually closed, or the server will hang and become unresponsive.

Tip

Missing fileName Parameter: When tools request a fileName parameter, use the list_programs tool to see available programs. Most tools provide this context automatically on failed calls.

βš™οΈ Configuration

The GhidraMCP server can be configured through Ghidra's application-level settings:

  1. In Ghidra, go to Browser β†’ Edit β†’ Tool Options.
  2. In the left panel, expand Miscellaneous and select GhidraMCP HTTP Server.
  3. Configure the following options:
    • Server Port: The port number for the MCP server (default: 8080)
    • Auto-start Server: Whether to automatically start the server when Ghidra launches
  4. Click OK to save your settings.

πŸ› οΈ Building from Source

  1. Clone the repository:
    git clone https://github.com/themixednuts/GhidraMCP.git
  2. Ensure you have Apache Maven and JDK 21 or later installed.
  3. Copy the following required JAR files from your Ghidra installation directory into the lib/ directory (create it if needed):
    • Ghidra/Features/Base/lib/Base.jar
    • Ghidra/Features/Decompiler/lib/Decompiler.jar
    • Ghidra/Framework/Docking/lib/Docking.jar
    • Ghidra/Framework/Generic/lib/Generic.jar
    • Ghidra/Framework/Project/lib/Project.jar
    • Ghidra/Framework/SoftwareModeling/lib/SoftwareModeling.jar
    • Ghidra/Framework/Utility/lib/Utility.jar
    • Ghidra/Framework/Gui/lib/Gui.jar
    • Ghidra/Features/MicrosoftCodeAnalyzer/lib/MicrosoftCodeAnalyzer.jar
    • Ghidra/Features/MicrosoftDemangler/lib/MicrosoftDemangler.jar
    • Ghidra/Features/MicrosoftDmang/lib/MicrosoftDmang.jar
  4. Build the project using Maven:
    mvn clean package
  5. The installable zip file will be in the target/ directory (e.g., target/GhidraMCP-0.5.0.zip). Install it using the steps above.

Tip

CI Test JAR: The test JAR with dependencies is only built when explicitly requested. To build it locally for testing:

mvn clean package -P ci-tests

πŸ”Œ Configuring an MCP Client

Configure your MCP client to connect to http://127.0.0.1:8080/mcp (or your configured port).

Agent-Specific Setup Instructions

πŸ€– Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "ghidra": {
      "url": "http://127.0.0.1:8080/mcp"
    }
  }
}

Configuration file location:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

After updating the configuration, restart Claude Desktop to apply the changes.

πŸ”§ Claude Code (CLI)

For Claude Code, use the following command to add the GhidraMCP server:

claude mcp add ghidra "http://127.0.0.1:8080/mcp" --transport http
⚑ Cursor

For Cursor, you can install via this link.

Or manually add to your MCP configuration:

{
  "mcpServers": {
    "ghidra": {
      "url": "http://127.0.0.1:8080/mcp"
    }
  }
}

Configuration file location:

  • ~/.cursor/mcp_settings.json (or your Cursor configuration directory)
πŸ› οΈ Custom MCP Client

For custom MCP clients or other implementations, use the standard MCP configuration format:

{
  "mcpServers": {
    "ghidra": {
      "url": "http://127.0.0.1:8080/mcp",
      "transport": "http"
    }
  }
}

Important

The default port is 8080 (configurable in Ghidra: Browser β†’ Edit β†’ Tool Options β†’ Miscellaneous β†’ GhidraMCP HTTP Server). If you change the port, update your client configuration accordingly. Ghidra must be running with the extension enabled for the client to connect.

Note

Timeout Issues: If you encounter timeout problems, refer to the Ghidra timeout configuration guide.

🀝 Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues. AI agents are also welcome to contribute; please ensure agents refer to the project's contribution guidelines and development conventions (often found in .cursor/rules/ or a CONTRIBUTING.md file if present).


Acknowledgements

This project is heavily inspired by and based on the work of LaurieWired. Instead of using a bridge, this plugin directly embeds the server in the plugin.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •