A native Model Context Protocol server for Ghidra. Includes GUI configuration and logging, 31 powerful tools and no external dependencies.
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.
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.
Shameless self-promotion: GhidrAssist supports GhidrAssistMCP right out of the box.
Download the latest release:
.zip
file (e.g., GhidrAssistMCP-v1.0.0.zip
)Install the extension:
Enable the plugin:
Clone the repository:
git clone <repository-url>
cd GhidrAssistMCP
Set Ghidra installation path:
export GHIDRA_INSTALL_DIR=/path/to/your/ghidra/installation
Build the extension:
gradle buildExtension
Install the extension:
dist/
directoryEnable the plugin:
Open the Control Panel:
Configure Server Settings:
localhost
8080
The Configuration tab allows you to:
get_program_info
- Get basic program informationlist_functions
- List all functions in the programlist_data
- List data definitionslist_strings
- List string referenceslist_imports
- List imported functionslist_exports
- List exported functionslist_segments
- List memory segmentslist_namespaces
- List namespaceslist_classes
- List class definitionslist_methods
- List method definitionsget_function_info
- Get detailed function informationget_class_info
- Get detailed class informationget_function_by_address
- Find function at specific addressget_current_function
- Get function at cursor positiondecompile_function
- Decompile function to C-like codedisassemble_function
- Get assembly disassemblysearch_functions
- Search functions by name patternsearch_classes
- Search classes by name patternfunction_xrefs
- Get function cross-referencesget_current_address
- Get current cursor addressxrefs_to
- Find references to an addressxrefs_from
- Find references from an addressrename_function
- Rename functionsrename_function_by_address
- Rename function at specific addressrename_variable
- Rename variablesrename_data
- Rename data definitionsset_function_prototype
- Set function signaturesset_local_variable_type
- Set variable data typesset_disassembly_comment
- Add disassembly commentsset_decompiler_comment
- Add decompiler commentsauto_create_struct
- Automatically create structures from variable usage patterns{
"method": "tools/call",
"params": {
"name": "get_program_info"
}
}
{
"method": "tools/call",
"params": {
"name": "get_function_info",
"arguments": {
"function_name": "main"
}
}
}
{
"method": "tools/call",
"params": {
"name": "decompile_function",
"arguments": {
"function_name": "encrypt_data"
}
}
}
{
"method": "tools/call",
"params": {
"name": "auto_create_struct",
"arguments": {
"function_identifier": "0x00401000",
"variable_name": "ctx"
}
}
}
{
"method": "tools/call",
"params": {
"name": "set_function_prototype",
"arguments": {
"function_address": "0x00401000",
"prototype": "int main(int argc, char** argv)"
}
}
}
GhidrAssistMCP/
├── GhidrAssistMCPPlugin # Main plugin entry point
├── GhidrAssistMCPServer # HTTP/SSE MCP server
├── GhidrAssistMCPBackend # Tool management and execution
├── GhidrAssistMCPProvider # UI component provider
└── tools/ # Individual MCP tools
├── Analysis Tools/
├── Modification Tools/
└── Navigation Tools/
GET /sse
- SSE connection for bidirectional communicationPOST /message
- Message exchange endpointsrc/main/java/ghidrassistmcp/
├── GhidrAssistMCPPlugin.java # Main plugin class
├── GhidrAssistMCPProvider.java # UI provider with tabs
├── GhidrAssistMCPServer.java # MCP server implementation
├── GhidrAssistMCPBackend.java # Backend tool management
├── McpBackend.java # Backend interface
├── McpTool.java # Tool interface
├── McpEventListener.java # Event notification interface
└── tools/ # Tool implementations
├── ProgramInfoTool.java
├── ListFunctionsTool.java
├── DecompileFunctionTool.java
├── AutoCreateStructTool.java
└── ... (29 total tools)
Implement McpTool interface:
public class MyCustomTool implements McpTool {
@Override
public String getName() { return "my_custom_tool"; }
@Override
public String getDescription() { return "Description"; }
@Override
public McpSchema.JsonSchema getInputSchema() { /* ... */ }
@Override
public McpSchema.CallToolResult execute(Map<String, Object> arguments, Program program) {
// Implementation
}
}
Register in backend:
// In GhidrAssistMCPBackend constructor
registerTool(new MyCustomTool());
# Clean build
gradle clean
# Build extension
gradle buildExtension
# Build with specific Ghidra path
gradle -PGHIDRA_INSTALL_DIR=/path/to/ghidra buildExtension
# Debug build
gradle buildExtension --debug
io.modelcontextprotocol.sdk:mcp:0.10.0
11.0.20
(HTTP/SSE transport)2.17.0
(JSON processing)The Log tab provides real-time monitoring:
REQ: tool_name {parameters...}
RES: tool_name {response...}
Detailed logging in Ghidra's console:
Server Won't Start
Tools Not Appearing
MCP Client Connection Issues
curl http://localhost:8080/sse
Tool Execution Failures
Enable debug logging by adding to Ghidra startup:
-Dlog4j.logger.ghidrassistmcp=DEBUG
git checkout -b feature-name
This project is licensed under the MIT License - see the LICENSE file for details.
Questions or Issues?
Please open an issue on the project repository for bug reports, feature requests, or questions about usage and development.