radare2-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@radare2-mcp open the binary sample.exe and disassemble its main function"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
radare2-mcp
MCP server exposing radare2 and Rizin binary analysis capabilities. Provides 85 tools covering static analysis, disassembly, decompilation, ESIL emulation, live debugging, vulnerability scanning, and exploit development -- all through structured JSON responses over the Model Context Protocol.
What it does
Static Analysis (19 tools)
Open binaries, list functions/imports/exports/strings/sections/classes, disassemble and decompile functions, read/write bytes, rename functions, add comments, find crypto constants, list PE resources and relocations.
Advanced Analysis (10 tools)
One-shot binary triage, deep single-function analysis, constraint extraction for crackmes, ESIL execution tracing, automated vulnerability pattern scanning, crackme solver, IOC extraction, exploit development assistant, binary diffing, file format parsing.
ESIL Emulation (10 tools)
Persistent ESIL VM sessions with register/memory read-write, single-step and run-to-address, raw ESIL expression evaluation. State is preserved across tool calls for multi-step emulation workflows.
RzIL Emulation (16 Rizin-based tools)
Typed bitvector emulation via Rizin's RzIL backend. IL AST lifting, individual CPU flag access, calling convention analysis, enhanced type and symbol queries.
Live Debugging (18 tools)
Launch or attach to processes, set/remove breakpoints, continue/step execution, read/write registers and memory, inspect memory maps, threads, and backtraces. Persistent debug sessions survive across tool calls.
Search & Navigation (9 tools)
Byte pattern search, string search, ROP gadget search, call graph and control flow graph extraction, entropy analysis, raw r2 command execution (allowlisted).
Related MCP server: IDAPro-MCP Server
Requirements
Setup
npm install
npm run build
node dist/index.jsOr during development:
npm run devMCP client configuration
{
"mcpServers": {
"radare2": {
"command": "node",
"args": ["/path/to/radare2-mcp/dist/index.js"],
"env": {
"ALLOWED_DIRS": "/path/to/binaries"
}
}
}
}Environment variables
Variable | Default | Description |
| (none) | Comma-separated directories from which binaries can be opened. Unrestricted if unset. |
|
| Analysis command run after opening a binary. |
|
| Timeout in ms for individual r2 commands. |
|
| Path to the Rizin executable. |
|
| Timeout in ms for individual Rizin commands. |
Architecture
radare2/
src/
index.ts # Entry point, stdio transport, shutdown handlers
server.ts # MCP server setup, registers all tools
types.ts # Shared TypeScript interfaces and Zod schemas
r2/
session.ts # r2pipe wrapper
session-cache.ts # Session reuse across tool calls (avoids re-running aaa)
commands.ts # Typed wrappers around r2 commands
sanitize.ts # Input validation for paths, addresses, commands
debug-session-manager.ts
esil-session-manager.ts
rizin/
rizin-session.ts # Rizin process management (newline cmd, null-byte response)
rzil-session-manager.ts
tools/ # 85 tool files, one per tool
utils/ # Error helpers, formatters, pagination
tests/
unit/ # Mocked tests, no radare2 needed
integration/ # Requires r2 in PATHThree session patterns: cached sessions for static analysis (reused across calls, 5-min TTL), persistent debug sessions (UUID-identified, survive across calls), persistent ESIL/RzIL sessions (same pattern, for emulation state).
All user input is validated through sanitize.ts before being passed to r2. Binary paths are checked against ALLOWED_DIRS with symlink resolution. The r2_command tool restricts commands to a safe allowlist.
Security
No arbitrary command execution --
r2_commanduses an allowlistPath validation with symlink resolution and
ALLOWED_DIRSenforcementComments are base64-encoded to prevent r2 command injection
Search queries are sanitized against shell metacharacters
Local only -- r2pipe spawns local processes, MCP runs over stdio
License
CC BY-NC-SA 4.0 -- see LICENSE.
Available Tools
85 toolsadd_commentB
Add or update a comment at a specific address in the binary.
Inputs: address (required), comment (required), binary_path (required).
analyze_binaryB
Open and analyze a binary file, returning architecture, platform, entry point, and binary metadata as JSON.
Inputs: binary_path (required), analysis_level.
analyze_function_deepA
Deep single-function analysis: disassembly, decompilation, variables, xrefs, callers, callees, strings, and complexity metrics in one call.
Inputs: binary_path (required), address, function_name.
analyze_typesA
List type definitions from binary analysis including structs, enums, and typedefs.
Inputs: binary_path (required), limit, filter, offset.
binary_headersB
Show PE/ELF/Mach-O headers with detailed field information.
Inputs: binary_path (required).
debug_attachA
Attach the radare2 debugger to a running process by PID and return a persistent session ID.
Inputs: pid (required).
debug_continueA
Continue execution of the debugged process until a breakpoint is hit, an address is reached, or the process exits.
Inputs: session_id (required), timeout_ms, until_address.
debug_detachA
Detach from the debugged process, leaving it running, and close the debug session.
Inputs: session_id (required).
debug_get_backtraceB
Get the call stack backtrace of the debugged process.
Inputs: session_id (required).
debug_get_infoA
Get debug session information including PID, status, executable path, and command line.
Inputs: session_id (required).
debug_get_mapsA
List memory maps of the debugged process with addresses, sizes, and permissions.
Inputs: session_id (required).
debug_get_registersA
Read all register values or a specific register from the debugged process.
Inputs: session_id (required), register_name.
debug_get_threadsA
List all threads in the debugged process with their status.
Inputs: session_id (required).
debug_killA
Kill the debugged process and close the debug session.
Inputs: session_id (required).
debug_launchA
Launch a binary under the radare2 debugger and return a persistent session ID for subsequent debug commands.
Inputs: binary_path (required).
debug_list_breakpointsA
List all active breakpoints in the debug session with their addresses and status.
Inputs: session_id (required).
debug_list_sessionsA
List all active debug sessions with their session IDs, targets, and PIDs.
Inputs: no named parameters.
debug_read_memoryA
Read memory from the debugged process at a specific address, returned as hex string or formatted hexdump.
Inputs: address (required), session_id (required), count, format.
debug_remove_breakpointA
Remove a breakpoint at the specified address or remove all breakpoints.
Inputs: session_id (required), address.
debug_set_breakpointC
Set a software breakpoint at the specified address in the debugged process.
Inputs: address (required), session_id (required), hardware.
debug_set_registerB
Set a register value in the debugged process.
Inputs: value (required), session_id (required), register_name (required).
debug_stepA
Single-step the debugged process (step into or step over) and return the updated register state.
Inputs: session_id (required), count, step_over.
debug_write_memoryC
Write memory in the debugged process at a specific address using hex bytes or a string.
Inputs: address (required), session_id (required), data, as_string, +1 more.
decompile_functionA
Decompile a function to pseudo-C representation using the available decompiler backend.
Inputs: binary_path (required), address, backend, function_name.
diff_binariesA
Compare two binary versions: find added, removed, and changed functions, imports, strings, and show instruction-level diffs for modified functions.
Inputs: binary_path_a (required), binary_path_b (required), max_function_diffs.
disassembleB
Disassemble instructions at the given address or function, returning assembly with opcodes and metadata.
Inputs: binary_path (required), count, address, function_name.
disassemble_bytesA
Disassemble raw bytes into assembly instructions without loading a full binary.
Inputs: hex_bytes (required), bits, offset, architecture.
esil_destroyA
Destroy a persistent ESIL session and release its resources. Use this when you are done with an emulation session.
Inputs: session_id (required).
esil_expressionB
Evaluate a raw ESIL expression string and return the result. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: expression (required), address, session_id, binary_path.
esil_get_memoryA
Read memory contents from the ESIL emulated memory space at a given address. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: address (required), size, format, session_id, +1 more.
esil_get_registersA
Read all register values or a specific register from the ESIL virtual machine state. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: address, session_id, binary_path, register_name.
esil_initA
Initialize the ESIL virtual machine with stack memory and return a persistent session_id for subsequent ESIL tool calls. The session preserves ESIL state (registers, memory, PC) across calls.
Inputs: binary_path (required), address, stack_size, stack_address.
esil_list_sessionsA
List all active persistent ESIL sessions with their session IDs, binary paths, and creation times.
Inputs: no named parameters.
esil_runA
Run ESIL emulation until a target address is reached, a breakpoint is hit, or maximum steps are exceeded. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: address, timeout, max_steps, session_id, +2 more.
esil_set_memoryA
Write data to the ESIL emulated memory space at a given address. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: data (required), address (required), as_string, session_id, +1 more.
esil_set_registerA
Set a register value in the ESIL virtual machine. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: value (required), register_name (required), address, session_id, +1 more.
esil_stepB
Execute one or more instruction steps in the ESIL emulator and return the updated register state. If session_id is provided, uses a persistent session; otherwise creates a fresh session.
Inputs: count, address, step_over, session_id, +1 more.
exploit_hunterB
Exploit development assistant: analyze security mitigations, find dangerous functions, collect ROP gadgets, map input sources, and suggest exploitation strategies.
Inputs: binary_path (required), gadget_search, target_function.
extract_iocsB
Extract Indicators of Compromise from a binary: IP addresses, URLs, domains, file paths, registry keys, email addresses, crypto wallets, and embedded payloads.
Inputs: binary_path (required), scan_all_bytes, include_context.
file_format_analyzerA
Analyze binary file format structures: identify format via magic bytes, parse containers (RIFF/WebP, PNG, ZIP, JPEG, PDF), and show chunk hierarchy with offsets, sizes, and metadata.
Inputs: file_path (required), max_chunks, hexdump_size.
find_constraintsA
Extract comparisons, conditional branches, string references, and success/fail paths from a function — ideal for crackme and CTF challenge analysis.
Inputs: binary_path (required), address, scan_callees, function_name.
find_crypto_constantsA
Detect cryptographic constants (AES S-boxes, CRC tables, RSA constants, SHA magic numbers) in the binary.
Inputs: binary_path (required).
find_vulnerabilitiesC
Scan a binary for common vulnerability patterns: dangerous API usage, buffer overflows, format strings, integer overflows, and missing bounds checks.
Inputs: binary_path (required), scan_depth.
get_callgraphC
Get the call graph for a function showing all callers and callees as a structured graph.
Inputs: binary_path (required), depth, format, address, +1 more.
get_control_flow_graphB
Get the control flow graph of a function as a JSON structure with basic blocks and edges.
Inputs: binary_path (required), address, function_name.
get_entropyB
Calculate entropy for the binary or specific sections to detect packed or encrypted regions.
Inputs: binary_path (required), size, address.
get_function_infoA
Get detailed metadata for a single function including cyclomatic complexity, stack frame, args, locals, and basic block count.
Inputs: binary_path (required), address, function_name.
get_xrefsA
Get all cross-references to or from a specific address, identifying callers, callees, and data references.
Inputs: address (required), binary_path (required), limit, offset, +1 more.
hash_binaryA
Compute cryptographic hashes of the binary or a specific address range.
Inputs: binary_path (required), size, address, algorithm.
list_classesA
List classes and their methods from C++, Objective-C, Java, or Swift binaries.
Inputs: binary_path (required), limit, offset.
list_exportsB
List all exported functions and symbols with their addresses and types.
Inputs: binary_path (required), limit, offset.
list_functionsA
List all functions identified by radare2 analysis with their names, addresses, sizes, and call conventions.
Inputs: binary_path (required), limit, filter, offset, +1 more.
list_importsA
List all imported functions and symbols with their addresses and library origins.
Inputs: binary_path (required), limit, offset.
list_relocationsB
List all relocations in the binary with their addresses, types, and target symbols.
Inputs: binary_path (required), limit, offset.
list_resourcesA
List PE resources (icons, manifests, version info, embedded data) from the binary.
Inputs: binary_path (required), limit, offset.
list_sectionsA
List all sections and segments in the binary with addresses, sizes, and permissions.
Inputs: binary_path (required), limit, offset.
list_stringsC
Extract printable strings from the binary with their addresses, sections, and lengths.
Inputs: binary_path (required), limit, offset, min_length, +1 more.
list_variablesB
List all local variables, stack variables, and arguments of a function.
Inputs: binary_path (required), address, function_name.
r2_commandA
Execute a radare2 command directly and return the raw output. Only commands starting with these prefixes are allowed: a (analysis: aa, aaa, afl, af, ag, ax), p (print: pd, px, pf, pi), i (info: ij, iS, iE, ii, iz), s (seek), f (flags), / (search: /x, /R), e (eval/config), af (analysis functions), ag (analysis graphs), ax (analysis xrefs), CC (comments), dr (debug registers), om (open file map). Blocked characters: ; | > < ` ! ~ { } ( ) $ #!.
Inputs: command (required), binary_path (required), analysis_level.
read_bytesB
Read raw bytes from a specific address in the binary, returned as hex string or formatted hexdump.
Inputs: address (required), binary_path (required), count, format.
rename_functionA
Rename a function at the given address to a new user-defined name.
Inputs: address (required), new_name (required), binary_path (required).
rz_calling_conventionsA
List all calling conventions available for the binary architecture using Rizin afcl. Useful for understanding function signatures and ABI details.
Inputs: binary_path (required).
rz_entrypointsA
List all entry points of the binary (program entry, TLS callbacks, etc.) using Rizin iej. Returns virtual address, physical address, and entry type.
Inputs: binary_path (required).
rzil_destroyA
Destroy a persistent RzIL session and release its resources. Use this when you are done with a Rizin emulation session.
Inputs: session_id (required).
rzil_get_memoryA
Read memory contents from the Rizin RzIL emulated memory space at a given address. Requires a persistent session from rzil_init.
Inputs: address (required), session_id (required), size, format.
rzil_get_registersA
Read all register values or a specific register from the Rizin RzIL VM. Returns typed values including individual CPU flags (zf, cf, sf, etc.) as booleans — superior to ESIL which packs flags into a single register.
Inputs: session_id (required), register_name.
rzil_il_astA
Get the RzIL intermediate language AST for instructions at a given address. Each instruction is lifted to a typed RzIL expression tree with bitvector operations. This is unique to Rizin — r2 ESIL only has flat string expressions.
Inputs: binary_path (required), count, address.
rzil_initA
Initialize the Rizin RzIL virtual machine and return a persistent session_id for subsequent RzIL tool calls. RzIL uses typed bitvectors (BAP Core Theory) for superior emulation fidelity compared to ESIL.
Inputs: binary_path (required), address.
rzil_list_sessionsA
List all active persistent RzIL emulation sessions with their session IDs, binary paths, and creation times.
Inputs: no named parameters.
rzil_runB
Run RzIL emulation until a target address is reached or maximum steps are exceeded. Uses aezsu for address targets. Requires a persistent session from rzil_init.
Inputs: session_id (required), max_steps, until_address.
rzil_set_memoryA
Write data to the Rizin RzIL emulated memory space at a given address. Requires a persistent session from rzil_init.
Inputs: data (required), address (required), session_id (required), as_string.
rzil_set_registerA
Set a register value in the Rizin RzIL virtual machine. Requires a persistent session from rzil_init.
Inputs: value (required), session_id (required), register_name (required).
rzil_stepA
Execute one or more instruction steps in the Rizin RzIL emulator and return VM change events and updated register state. Requires a persistent session from rzil_init.
Inputs: session_id (required), count, show_events.
rzil_trace_stepA
Step the RzIL emulator and return detailed VM change events showing exactly which variables and memory locations were read or written. Uses aezse which outputs typed events like pc_write(old, new) and var_write(name, old, new). Superior to ESIL tracing because events are typed.
Inputs: session_id (required), count.
rz_libsA
List all linked libraries (DLLs/shared objects) from the binary using Rizin ilj. Returns a clean JSON array of library names.
Inputs: binary_path (required).
rz_symbolsB
List all symbols from the binary using Rizin. Returns enriched data including is_imported flag, library origin, flagname, and realname — more detail than r2 isj.
Inputs: binary_path (required), limit, filter, offset, +1 more.
rz_typesA
List type definitions from the binary using Rizin separate typed JSON endpoints (tsj/tej/ttj/tuj). Returns structs, enums, typedefs, and unions with full member details. Superior to r2 which returns all types in a single flat list.
Inputs: binary_path (required), limit, filter, offset, +1 more.
search_bytesA
Search for a hex byte pattern across the binary and return all matching addresses.
Inputs: pattern (required), binary_path (required), limit, offset.
search_rop_gadgetsA
Search for ROP gadgets in the binary matching optional instruction constraints.
Inputs: binary_path (required), limit, query, offset, +1 more.
search_stringC
Search for a string pattern in the binary and return all matching locations.
Inputs: query (required), binary_path (required), limit, offset, +1 more.
shellcode_analyzeA
Analyze raw shellcode bytes by loading them as a memory blob, disassembling, and identifying syscalls and patterns.
Inputs: hex_bytes (required), architecture, base_address.
solve_crackmeA
Automatically attempt to solve a crackme by extracting constraints, identifying success/fail paths, and brute-forcing input character by character using ESIL emulation.
Inputs: binary_path (required), address, charset, input_length, +3 more.
trace_executionB
Trace execution using ESIL emulation, logging comparisons, branches, memory access, and register changes at each step.
Inputs: binary_path (required), address, max_steps, stack_size, +3 more.
triage_binaryA
Perform comprehensive one-shot binary triage: file info, sections, imports, exports, strings, functions, entry points, and security features in a single call.
Inputs: binary_path (required), max_strings, max_functions, analysis_level.
write_bytesC
Patch bytes at a specific address in the binary using hex bytes or assembly instructions.
Inputs: address (required), binary_path (required), assembly, hex_bytes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 85 tools
Many tools overlap in scope: analyze_types and rz_types both list type definitions, rz_symbols overlaps list_imports/list_exports, and the ESIL/RzIL families expose nearly identical operations. Descriptions help differentiate contexts, but the parallel emulation backends and broad composite tools like triage_binary and exploit_hunter create real selection ambiguity.
Most tools use snake_case and the debug_*, esil_*, and rzil_* families are internally consistent. However, the overall set mixes verb_noun patterns like analyze_binary and list_functions with noun_verb names like shellcode_analyze and file_format_analyzer, plus noun-only names like binary_headers, exploit_hunter, and r2_command.
85 tools is far beyond the 16-25 'heavy' range and well over the 50+ threshold for an extreme mismatch. The count is inflated by parallel ESIL/RzIL tool families, redundant symbol/type listings, and multiple one-shot composite analyzers that could be consolidated.
The server covers an exceptionally broad reverse-engineering workflow: loading/analysis, disassembly, decompilation, patching, searching, debugging, emulation, diffing, and vulnerability scanning. Minor gaps exist around lifecycle management, such as no explicit close/release of the analyzed binary, no save/export of patched output, and no comment removal, but agents can usually work around these.
Maintenance
Related MCP Connectors
Hunt zero-days by talking to binaries. 40+ tools. Hosted, OAuth + SSO, invite: hi@byteray.ai
Offline methodology engine for authorized penetration testing, CTF, and security research.
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
Enrich, search, assess, and manage threat intelligence through 80+ typed MCP tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA headless Ghidra server that enables AI agents to perform deep reverse-engineering tasks such as disassembly, decompilation, and patching via the Model Context Protocol. It supports extensive automation of analysis workflows in sandboxed environments through a catalog of over 200 specialized tools.199GPL 2.0
- AlicenseNot gradedqualityDmaintenanceExposes IDA Pro's analysis capabilities through the Model Context Protocol (MCP). Provides 247 tools for reverse engineering and binary analysis.MIT
- AlicenseNot gradedqualityDmaintenanceExposes Ghidra headless binary analysis capabilities via the Model Context Protocol, enabling AI assistants to decompile, analyze, and emulate binaries with 32 tools and multi-binary support.2MIT
- FlicenseNot gradedqualityAmaintenanceEnables users to perform network scanning, symbol and binary analysis, string extraction, live packet capture, and isolated Docker command execution through the Model Context Protocol.-