Ghidra MCP
STDIOAI-assisted binary analysis plugin connecting Ghidra to AI models via MCP
AI-assisted binary analysis plugin connecting Ghidra to AI models via MCP
A Ghidra plugin that implements the Model Context Protocol (MCP) for AI-assisted binary analysis.
GhidraMCP bridges the gap between Ghidra's powerful reverse engineering capabilities and AI assistants through the Model Context Protocol (MCP). This plugin enables AI models to connect to Ghidra and assist with binary analysis tasks, making reverse engineering more efficient and accessible.
File > Install ExtensionsFile > Configure > Miscellaneous and checking the box next to "MCPServerPlugin"The server automatically starts when you open a Ghidra project after enabling the plugin. By default, it runs on:
localhost8765You can verify the server is running by checking the Ghidra console for messages like:
MCP Server started on port 8765
To connect Claude to the GhidraMCP plugin:
Install the MCP bridge script:
pip install FastMCP
Add the following configuration to your Claude MCP setup:
{ "mcpServers": { "ghidra": { "command": "python", "args": ["PATH-TO-REPO/GhidraMCP/ghidra_server.py"] } } }
The bridge script creates a connection between Ghidra and Claude, enabling real-time binary analysis through natural language.
The plugin exposes several powerful functions through the MCP interface:
| Tool | Description | 
|---|---|
get_function(address, decompile=False) | Retrieve detailed information about a function at a specific address | 
analyze_binary(question) | Ask natural language questions about the loaded binary | 
get_imports() | List all imported functions in the binary | 
get_exports() | List all exported functions in the binary | 
get_memory_map() | Get the memory layout of the binary | 
connect_to_ghidra(host, port) | Connect to a specific Ghidra instance | 
rename_function(current_name, new_name) | Rename a function by its current name | 
rename_data(address, new_name) | Rename a data label at a specific address | 
extract_api_call_sequences(address) | Extract API calls from a function for security analysis | 
identify_user_input_sources() | Find potential sources of user input in the binary | 
generate_call_graph(address, max_depth=3) | Generate a hierarchical representation of function calls | 
identify_crypto_patterns() | Detect cryptographic implementations in the binary | 
find_obfuscated_strings() | Locate potentially obfuscated strings | 
Here are examples of questions you can ask through an MCP-compatible AI client:
GhidraMCP provides specialized tools for security-focused analysis:
Extract and categorize external API calls from a function for security analysis. This helps identify potentially dangerous functions and understand their interactions.
Identify entry points where external data enters the program, crucial for vulnerability assessment and understanding attack surfaces.
Create structured call graphs to understand execution flow, track data propagation, and identify potential attack paths.
Identify cryptographic implementations including standard algorithms (AES, RSA, etc.) and custom implementations based on code patterns.
Find strings that may be obfuscated through techniques like XOR encoding or character-by-character construction.
You can modify the server port by editing the MCPServerPlugin.java file:
server.setPort(YOUR_CUSTOM_PORT);
GhidraMCP can be integrated into your existing analysis workflows:
To build the plugin from source:
Clone this repository
git clone https://github.com/yourusername/GhidraMCP.git
Set up a Ghidra development environment as described in the Ghidra Developer Guide
Set the GHIDRA_INSTALL_DIR environment variable:
export GHIDRA_INSTALL_DIR=/path/to/ghidra
Build with Gradle:
./gradlew buildExtension
The extension ZIP will be created in the dist directory
pip install FastMCPCheck the following logs for troubleshooting:
ghidra_mcp_bridge.log for bridge script issuesContributions are welcome! Please feel free to submit issues or pull requests.
git checkout -b feature/amazing-featuregit commit -m 'Add some amazing feature'git push origin feature/amazing-featureGhidraMCP is not affiliated with or endorsed by the NSA or the Ghidra project.