Ghidra MCP Skill
This skill enables reverse engineering workflows using Ghidra through the Model Context Protocol (MCP).
Quick Start
- •List available programs:
list_programsto see what's loaded - •Read functions:
read_functionswith filtering to find targets - •Decompile:
decompile_codeto see source-like output - •Analyze references:
find_referencesto trace data/code flow
Core Workflows
Analyzing a New Binary
- •Use
list_programsto confirm the binary is loaded - •Use
read_functionsto get an overview of functions - •Use
decompile_codeon interesting functions (likemainor entry points) - •Use
find_referencesto understand how functions/data are used - •Use
manage_symbolsto rename functions and variables as you understand them
Understanding a Function
- •
read_functionswithnameoraddressto get function metadata - •
decompile_codewithoperation: decompileto see decompiled C code - •
manage_functionswithoperation: get_variablesto see local variables - •
manage_functionswithoperation: get_graphto see control flow - •
find_referenceswithdirection: toto find callers
Defining Data Structures
- •
read_data_typesto check existing types - •
manage_data_typeswithoperation: createandtype_kind: structto create structures - •Add fields with proper offsets and types
- •Use
manage_data_typeswithoperation: updateto modify existing types
Searching for Patterns
- •
search_memorywithsearch_type: stringfor string literals - •
search_memorywithsearch_type: bytesfor byte patterns - •
search_memorywithsearch_type: regexfor complex patterns - •Follow up with
find_referenceson interesting addresses
Bulk Operations
Use batch_operations to execute multiple changes atomically:
- •Rename multiple symbols
- •Create multiple data types
- •All operations succeed or all are rolled back
Tool Categories
Read Operations (No Modifications)
| Tool | Purpose |
|---|---|
list_programs | List all programs in the project |
read_functions | Read function details or list functions |
read_symbols | Read symbol details or list symbols |
read_data_types | Read data type details or list types |
read_memory_blocks | List memory segments |
read_listing | View disassembly at addresses |
decompile_code | Decompile functions to C-like code |
find_references | Find cross-references to/from addresses |
search_memory | Search for strings, bytes, patterns |
list_analysis_options | View analysis configuration |
Write Operations (Modify Program)
| Tool | Purpose |
|---|---|
manage_functions | Create functions, update prototypes |
manage_symbols | Create/rename labels and symbols |
manage_data_types | Create/update structs, enums, unions |
manage_memory | Read/write bytes, undefine code |
manage_project | Bookmarks, navigation, metadata |
Delete Operations
| Tool | Purpose |
|---|---|
delete_function | Remove function definitions |
delete_symbol | Remove symbols/labels |
delete_data_type | Remove data types |
delete_bookmark | Remove bookmarks |
Utility Operations
| Tool | Purpose |
|---|---|
batch_operations | Execute multiple operations atomically |
undo_redo | Undo/redo changes |
demangle_symbol | Demangle C++ symbols |
analyze_rtti | Analyze MSVC RTTI structures |
Common Patterns
Pagination
Most list operations return paginated results. Use the cursor field from the response to get the next page:
json
{"operation": "list", "cursor": "returned_cursor_value"}
Identifying Targets
Tools accept multiple ways to identify targets:
- •By address:
"address": "0x401000" - •By name:
"name": "main" - •By ID:
"symbol_id": 12345or"function_id": "0x401000"
Address Formats
Addresses can be specified as:
- •Hex with prefix:
"0x401000" - •Hex without prefix:
"401000" - •Decimal:
"4198400"
Tips
- •Start broad, then narrow: Use list operations first, then read specific items
- •Use filtering: Most list operations support
name_filterwith wildcards - •Check before modifying: Read the current state before making changes
- •Use batch for related changes: Group related modifications in
batch_operations - •Undo mistakes: Use
undo_redoif something goes wrong
Reference
See references/TOOLS.md for detailed documentation of each tool's operations and parameters.