1- # Binary Comparison Usage Guide
1+ # Binary Ninja Usage Guide
22
33## Overview
44
5- smartdiff now supports binary comparison through integration with Binary Ninja MCP servers. This enables AI agents to:
5+ smartdiff uses Binary Ninja MCP servers for binary inspection . This enables AI agents to:
66
771 . ** Discover binaries** loaded in Binary Ninja
882 . ** List functions** in binaries
993 . ** Decompile functions** to see high-level code
10- 4 . ** Compare binaries** (coming in Phase 3)
10+
11+ Binary-to-binary comparison is intentionally hidden in the default build. It
12+ requires the explicit ` binary-comparison ` Cargo feature.
1113
1214## Architecture
1315
@@ -26,15 +28,15 @@ Binary Ninja (GUI with Personal License)
2628### 1. Binary Ninja
2729
2830- Binary Ninja installed (Personal License or higher)
29- - Binary Ninja MCP plugin installed (from ` /home/matteius/codediff /binary_ninja_mcp/ ` )
31+ - Binary Ninja MCP plugin installed (from ` /home/matteius/smartdiff /binary_ninja_mcp/ ` )
3032
3133### 2. Binary Ninja MCP Server
3234
33- Located at: ` /home/matteius/codediff /binary_ninja_mcp/ `
35+ Located at: ` /home/matteius/smartdiff /binary_ninja_mcp/ `
3436
3537** Installation** :
3638``` bash
37- cd /home/matteius/codediff /binary_ninja_mcp
39+ cd /home/matteius/smartdiff /binary_ninja_mcp
3840python3 -m venv .venv
3941source .venv/bin/activate
4042pip install -r requirements.txt
@@ -47,12 +49,13 @@ pip install -r requirements.txt
4749
4850### 3. smartdiff MCP Server
4951
50- Located at: ` /home/matteius/codediff / `
52+ Located at: ` /home/matteius/smartdiff / `
5153
5254** Build** :
5355``` bash
54- cd /home/matteius/codediff
56+ cd /home/matteius/smartdiff
5557cargo build --release -p smart-diff-mcp-server
58+ cargo build --release -p smart-diff-cli
5659```
5760
5861## Setup Workflow
@@ -73,36 +76,51 @@ cargo build --release -p smart-diff-mcp-server
7376 - Server will start on port 9010
7477 - You'll see: "MCP Server started on port 9010"
7578
76- ### Step 2: Start Binary Ninja MCP Bridge (Optional)
79+ ### Step 2: Verify Direct Rust Access
80+
81+ The preferred smartdiff path is the Rust client talking directly to the
82+ Binary Ninja GUI plugin server:
83+
84+ ``` bash
85+ cd /home/matteius/smartdiff
86+ cargo run --release -p smart-diff-cli -- binja servers
87+ cargo run --release -p smart-diff-cli -- binja functions port_9009 --limit 25
88+ cargo run --release -p smart-diff-cli -- binja decompile port_9009 main
89+ ```
90+
91+ This avoids headless Binary Ninja entirely and works with a Personal license
92+ because the licensed GUI process owns the analysis.
93+
94+ ### Step 3: Start Binary Ninja MCP Bridge (Optional)
7795
7896If you want to use Binary Ninja MCP directly with Claude:
7997
8098``` bash
81- cd /home/matteius/codediff /binary_ninja_mcp
99+ cd /home/matteius/smartdiff /binary_ninja_mcp
82100source .venv/bin/activate
83101python bridge/bn_mcp_bridge_multi_http.py
84102```
85103
86104This bridge connects to Claude Desktop and routes requests to Binary Ninja servers.
87105
88- ### Step 3 : Start smartdiff MCP Server
106+ ### Step 4 : Start smartdiff MCP Server
89107
90108``` bash
91- cd /home/matteius/codediff
109+ cd /home/matteius/smartdiff
92110cargo run --release --bin smart-diff-mcp
93111```
94112
95113The server will start and listen on stdio for MCP requests.
96114
97- ### Step 4 : Configure Claude Desktop
115+ ### Step 5 : Configure Claude Desktop
98116
99117Edit ` ~/Library/Application Support/Claude/claude_desktop_config.json ` (macOS) or equivalent:
100118
101119``` json
102120{
103121 "mcpServers" : {
104122 "smartdiff" : {
105- "command" : " /path/to/codediff /target/release/smart-diff-mcp" ,
123+ "command" : " /home/matteius/smartdiff /target/release/smart-diff-mcp" ,
106124 "args" : []
107125 }
108126 }
@@ -115,7 +133,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
115133{
116134 "mcpServers" : {
117135 "smartdiff" : {
118- "command" : " /path/to/codediff /target/release/smart-diff-mcp" ,
136+ "command" : " /home/matteius/smartdiff /target/release/smart-diff-mcp" ,
119137 "args" : []
120138 },
121139 "binary_ninja" : {
@@ -126,7 +144,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
126144}
127145```
128146
129- ### Step 5 : Restart Claude Desktop
147+ ### Step 6 : Restart Claude Desktop
130148
131149Restart Claude Desktop to load the new MCP server configuration.
132150
@@ -262,23 +280,6 @@ Agent:
2622805 . Reports findings
263281```
264282
265- ### Workflow 3: Compare Two Binaries (Manual - Phase 3 will automate)
266-
267- ```
268- User: "I have two versions of a binary. What changed between them?"
269-
270- Agent:
271- 1 . Calls list_binja_servers() to see both binaries
272- 2 . Calls list_binary_functions() for both binaries
273- 3 . Compares function lists to find:
274- - Added functions (in v2 but not v1)
275- - Deleted functions (in v1 but not v2)
276- - Common functions (in both)
277- 4 . For common functions, decompiles both versions
278- 5 . Compares decompiled code to identify changes
279- 6 . Reports significant changes
280- ```
281-
282283## Troubleshooting
283284
284285### No servers found
@@ -310,49 +311,24 @@ Agent:
3103113. Restart the MCP server in Binary Ninja
3113124. Check firewall settings (localhost should be allowed)
312313
313- ## Next Steps (Phase 3)
314-
315- Phase 3 will add automated binary comparison:
316-
317- ### New Tools (Coming Soon)
314+ ## Rust CLI Shortcuts
318315
319- #### `compare_binaries_via_binja`
316+ The same path is available without MCP:
320317
321- Compare two binaries and identify matching functions.
322-
323- ```
324- compare_binaries_via_binja(
325- binary_a_id="port_9009",
326- binary_b_id="port_9010",
327- options={
328- "use_decompiled_code": true,
329- "similarity_threshold": 0.7
330- }
331- )
332- ```
333-
334- #### `list_binary_function_matches`
335-
336- List matched functions sorted by similarity.
337-
338- ```
339- list_binary_function_matches(
340- comparison_id="uuid",
341- sort_by="similarity_asc",
342- limit=50
343- )
318+ ```bash
319+ cargo run --release -p smart-diff-cli -- binja servers
320+ cargo run --release -p smart-diff-cli -- binja functions port_9009 --limit 25
321+ cargo run --release -p smart-diff-cli -- binja decompile port_9009 main
344322```
345323
346- #### `get_binary_function_diff`
324+ ## Feature-Gated Comparison
347325
348- Get detailed diff for a specific function match.
326+ The comparison commands and MCP tools are not exposed by default. To enable
327+ them deliberately, build with:
349328
350- ```
351- get_binary_function_diff(
352- comparison_id="uuid",
353- function_a="process_data",
354- function_b="process_data_v2"
355- )
329+ ``` bash
330+ cargo build --release -p smart-diff-cli --features binary-comparison
331+ cargo build --release -p smart-diff-mcp-server --features binary-comparison
356332```
357333
358334## Technical Details
@@ -376,12 +352,12 @@ The MCP server (`crates/mcp-server/`) now includes:
376352 - ` get_function_diff `
377353 - ` get_comparison_summary `
378354
379- - **Binary comparison tools** (new) :
355+ - ** Binary inspection tools** :
380356 - ` list_binja_servers `
381357 - ` list_binary_functions `
382358 - ` decompile_binary_function `
383359
384- All tools are available to AI agents through the MCP protocol .
360+ Only these binary tools are available to AI agents in the default build .
385361
386362## License
387363
@@ -393,4 +369,3 @@ AGPL-3.0-only
393369- [ Binary Ninja Client Library] ( crates/binary-ninja-client/README.md )
394370- [ smartdiff MCP Server] ( crates/mcp-server/README.md )
395371- [ Binary Ninja] ( https://binary.ninja/ )
396-
0 commit comments