ghidraMCP

repository·main·Indexed 26 days ago

https://github.com/lauriewired/ghidramcp

A Model Context Protocol (MCP) server and Ghidra plugin that bridges LLMs and the Ghidra reverse engineering suite. It allows AI agents to interact with binaries by exposing core Ghidra functionality, including decompilation, analysis, listing methods, classes, imports, and exports, and automatically renaming methods and data.

Tokens
918
Snippets
3
Records
6
Agent score
45%

What's inside ghidraMCP

  1. Overview of ghidraMCP

    main

    ghidraMCP is a Model Context Protocol (MCP) server and Ghidra plugin that enables LLMs to autonomously reverse engineer applications. It exposes core Ghidra functionality as tools to MCP clients, allowing for tasks such as:

    • Decompiling and analyzing binaries in Ghidra.
    • Automatically renaming methods and data.
    • Listing methods, classes, imports, and exports.
  2. Configure Claude Desktop as a Ghidra MCP client

    main

    To integrate ghidraMCP with Claude Desktop, edit your claude_desktop_config.json file.

    File Location:

    • macOS: /Users/YOUR_USER/Library/Application Support/Claude/claude_desktop_config.json

    Add the following configuration to the mcpServers object. Ensure you replace /ABSOLUTE_PATH_TO/ with the actual path to bridge_mcp_ghidra.py and verify the --ghidra-server URL matches your Ghidra instance (defaults to http://127.0.0.1:8080/).

    {
      "mcpServers": {
        "ghidra": {
          "command": "python",
          "args": [
            "/ABSOLUTE_PATH_TO/bridge_mcp_ghidra.py",
            "--ghidra-server",
            "http://127.0.0.1:8080/"
          ]
        }
      }
    }
  3. Configure Cline as a Ghidra MCP client

    main

    Using ghidraMCP with Cline requires manually running the MCP server using SSE transport first.

    1. Run the following command in your terminal:
    python bridge_mcp_ghidra.py --transport sse --mcp-host 127.0.0.1 --mcp-port 8081 --ghidra-server http://127.0.0.1:8080/
    1. In Cline, select MCP Servers at the top.
    2. Select Remote Servers and add a new server with these settings:
      • Server Name: GhidraMCP
      • Server URL: http://127.0.0.1:8081/sse (ensure this matches your --mcp-host and --mcp-port).
  4. Build ghidraMCP from source

    main

    To build the project from source, you must first provide the necessary Ghidra library dependencies.

    1. Prepare Dependencies

    Copy the following files from your Ghidra installation directory to the project's lib/ directory:

    • 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

    2. Build with Maven

    Run the following command to generate the zip file containing the plugin and resources:

    mvn clean package assembly:single

    mvn clean package assembly:single
  5. Install the Ghidra plugin

    main

    To use ghidraMCP, you must first install the Ghidra plugin component from a released version of the repository.

    Prerequisites

    Installation Steps

    1. Download the latest release from the GitHub repository.
    2. Run Ghidra.
    3. Select File -> Install Extensions.
    4. Click the + button and select the downloaded .zip file (e.g., GhidraMCP-1-2.zip).
    5. Restart Ghidra.
    6. Ensure the plugin is enabled via File -> Configure -> Developer.

    Optional: Configure Port

    You can configure the HTTP server port in Ghidra via Edit -> Tool Options -> GhidraMCP HTTP Server.