Files
rea/README.md
T
morluto 729d3e927c Initial commit: betterBinaryMCP - Enhanced MCP server for Hopper Disassembler
39 tools total:
- 31 official Hopper 6 tools proxied via STDIO/NDJSON
- 8 RE-specific tools: swift_classes, get_objc_classes,
  get_objc_protocols, batch_decompile, get_call_graph,
  analyze_swift_types, find_xrefs_to_name, binary_overview

No Python injection needed - wraps official HopperMCPServer binary.
2026-04-14 08:51:30 +08:00

116 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# betterBinaryMCP
An enhanced MCP (Model Context Protocol) server for [Hopper Disassembler](https://www.hopperapp.com/) that wraps the official Hopper 6 MCP server and adds reverse engineering–specific analysis tools.
**No Python injection or plugins needed** — just Hopper open with a binary.
## Architecture
```
MCP Client ←STDIO→ betterBinaryMCP ←STDIO→ Official HopperMCPServer ←XPC→ Hopper.app
```
- Wraps the official `HopperMCPServer` binary as a subprocess
- Proxies all 31 official tools unchanged
- Adds 8 RE-specific tools built on top of official operations
## Tools
### 31 Official Tools (proxied)
| Tool | Description |
|------|-------------|
| `address_name` | Get/set name (label) at an address |
| `comment` / `inline_comment` | Get/set comments |
| `current_address` / `current_procedure` / `current_document` | Cursor state |
| `goto_address` / `next_address` / `prev_address` | Navigation |
| `list_segments` / `list_procedures` / `list_strings` / `list_names` / `list_documents` / `list_bookmarks` | Listing |
| `search_procedures` / `search_strings` | Regex search |
| `procedure_pseudo_code` / `procedure_assembly` | Decompilation |
| `procedure_callees` / `procedure_callers` | Call relationships |
| `procedure_info` / `procedure_address` | Procedure metadata |
| `set_address_name` / `set_addresses_names` | Rename labels |
| `set_comment` / `set_inline_comment` | Write comments |
| `set_bookmark` / `unset_bookmark` | Bookmarks |
| `set_current_document` | Switch active document |
| `xrefs` | Cross-references |
### 8 RE-Specific Tools (added)
| Tool | Description |
|------|-------------|
| `binary_overview()` | Segment layout, procedure/string counts, document info |
| `swift_classes(pattern)` | Swift class hierarchy from mangled `_TtC` names |
| `get_objc_classes(pattern)` | Objective-C class names from labels |
| `get_objc_protocols()` | Objective-C protocol names from labels |
| `batch_decompile(addresses)` | Decompile up to 20 procedures at once |
| `get_call_graph(address, direction, depth)` | Recursive call graph traversal (forward/backward) |
| `analyze_swift_types()` | Categorize all Swift mangled names by module/type/method |
| `find_xrefs_to_name(name)` | Find references by name lookup |
## Requirements
- **Hopper Disassembler** v6+ (ships the official MCP server)
- **Python** 3.10+
- **Hopper open** with a binary loaded and analyzed
## Installation
```bash
pip install fastmcp
```
## Usage
### As an MCP Server (recommended)
Add to your MCP client configuration (Claude Desktop, Cursor, etc.):
```json
{
"mcpServers": {
"betterBinaryMCP": {
"command": "python3",
"args": ["/path/to/betterBinaryMCP/server.py"]
}
}
}
```
### Command Line
```bash
python3 server.py
```
### Test Connection
```bash
python3 hopper_client.py
```
## Testing
```bash
pip install pytest pytest-asyncio
python -m pytest tests/ -v
```
## How It Works
1. On startup, the server launches the official `HopperMCPServer` binary as a subprocess
2. Communicates via NDJSON (newline-delimited JSON) over STDIO — no HTTP, no Content-Length framing
3. Proxied tools forward calls directly to the official server
4. RE tools compose multiple official calls (e.g., `swift_classes` calls `list_procedures` and parses `_TtC` mangled names)
## Limitations
- Requires Hopper 6+ (the official MCP server binary must exist)
- The official server connects to Hopper via XPC — Hopper must be running with a document open
- `batch_decompile` is limited to 20 procedures per call
- `get_call_graph` is limited to depth 5
## License
MIT