|
| 1 | +# Binary Ninja MCP Server (TypeScript) |
| 2 | + |
| 3 | +This is the TypeScript implementation of the Binary Ninja MCP bridge server. It provides a standalone MCP server that connects to a running Binary Ninja instance and exposes its capabilities through the Model Context Protocol. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Standalone MCP Server**: Run independently with any MCP client |
| 8 | +- **50+ Tools**: Full access to Binary Ninja's reverse engineering capabilities |
| 9 | +- **Easy Configuration**: CLI options and environment variables for host/port |
| 10 | +- **TypeScript**: Full type safety and better developer experience |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +### Using npx (Recommended) |
| 15 | + |
| 16 | +```bash |
| 17 | +npx -y binary-ninja-mcp |
| 18 | +``` |
| 19 | + |
| 20 | +### Global Installation |
| 21 | + |
| 22 | +```bash |
| 23 | +npm install -g binary-ninja-mcp |
| 24 | +binary-ninja-mcp |
| 25 | +``` |
| 26 | + |
| 27 | +### From Source |
| 28 | + |
| 29 | +```bash |
| 30 | +cd bridge |
| 31 | +npm install |
| 32 | +npm run build |
| 33 | +``` |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +### Command Line Options |
| 38 | + |
| 39 | +```bash |
| 40 | +# Connect to default (localhost:9009) |
| 41 | +npx -y binary-ninja-mcp |
| 42 | + |
| 43 | +# Connect to custom host/port |
| 44 | +npx -y binary-ninja-mcp --host 192.168.1.100 --port 9009 |
| 45 | + |
| 46 | +# Show help |
| 47 | +npx -y binary-ninja-mcp --help |
| 48 | +``` |
| 49 | + |
| 50 | +### Environment Variables |
| 51 | + |
| 52 | +```bash |
| 53 | +# Set host and port via environment |
| 54 | +BINJA_MCP_HOST=localhost BINJA_MCP_PORT=9009 npx -y binary-ninja-mcp |
| 55 | +``` |
| 56 | + |
| 57 | +### MCP Client Configuration |
| 58 | + |
| 59 | +#### Claude Desktop |
| 60 | + |
| 61 | +Add to `~/.config/claude-desktop/claude_desktop_config.json`: |
| 62 | + |
| 63 | +```json |
| 64 | +{ |
| 65 | + "mcpServers": { |
| 66 | + "binary-ninja-mcp": { |
| 67 | + "command": "npx", |
| 68 | + "args": ["-y", "binary-ninja-mcp", "--host", "localhost", "--port", "9009"] |
| 69 | + } |
| 70 | + } |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +#### Cline |
| 75 | + |
| 76 | +Add to your Cline MCP configuration: |
| 77 | + |
| 78 | +```json |
| 79 | +{ |
| 80 | + "mcpServers": { |
| 81 | + "binary-ninja-mcp": { |
| 82 | + "command": "npx", |
| 83 | + "args": ["-y", "binary-ninja-mcp"] |
| 84 | + } |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +#### Custom Installation |
| 90 | + |
| 91 | +If installed globally: |
| 92 | + |
| 93 | +```json |
| 94 | +{ |
| 95 | + "mcpServers": { |
| 96 | + "binary-ninja-mcp": { |
| 97 | + "command": "binary-ninja-mcp", |
| 98 | + "args": ["--host", "localhost", "--port", "9009"] |
| 99 | + } |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +## Available Tools |
| 105 | + |
| 106 | +### Function Analysis |
| 107 | + |
| 108 | +- `list_methods` - List all function names with pagination |
| 109 | +- `get_entry_points` - List entry point(s) of the loaded binary |
| 110 | +- `search_functions_by_name` - Search functions by name substring |
| 111 | +- `decompile_function` - Decompile a function to C code |
| 112 | +- `get_il` - Get IL (HLIL/MLIL/LLIL) for a function |
| 113 | +- `fetch_disassembly` - Get assembly mnemonics for a function |
| 114 | + |
| 115 | +### Rename Tools |
| 116 | + |
| 117 | +- `rename_function` - Rename a function |
| 118 | +- `rename_single_variable` - Rename a single variable |
| 119 | +- `rename_multi_variables` - Batch rename multiple variables |
| 120 | +- `rename_data` - Rename a data label |
| 121 | + |
| 122 | +### Comment Tools |
| 123 | + |
| 124 | +- `set_comment` - Set comment at an address |
| 125 | +- `get_comment` - Get comment at an address |
| 126 | +- `delete_comment` - Delete comment at an address |
| 127 | +- `set_function_comment` - Set function comment |
| 128 | +- `get_function_comment` - Get function comment |
| 129 | +- `delete_function_comment` - Delete function comment |
| 130 | + |
| 131 | +### Type Tools |
| 132 | + |
| 133 | +- `define_types` - Define types from C code |
| 134 | +- `list_local_types` - List local types |
| 135 | +- `search_types` - Search types by name |
| 136 | +- `get_user_defined_type` - Get user defined type definition |
| 137 | +- `get_type_info` - Get type information |
| 138 | +- `declare_c_type` - Declare C type |
| 139 | +- `retype_variable` - Retype a variable |
| 140 | +- `set_local_variable_type` - Set local variable type |
| 141 | + |
| 142 | +### Data Tools |
| 143 | + |
| 144 | +- `list_data_items` - List data labels |
| 145 | +- `hexdump_address` - Hexdump at address |
| 146 | +- `hexdump_data` - Hexdump data symbol |
| 147 | +- `get_data_decl` - Get data declaration and hexdump |
| 148 | + |
| 149 | +### Cross-Reference Tools |
| 150 | + |
| 151 | +- `get_xrefs_to` - Get xrefs to address |
| 152 | +- `get_xrefs_to_field` - Get xrefs to struct field |
| 153 | +- `get_xrefs_to_struct` - Get xrefs to struct |
| 154 | +- `get_xrefs_to_type` - Get xrefs to type |
| 155 | +- `get_xrefs_to_enum` - Get xrefs to enum |
| 156 | +- `get_xrefs_to_union` - Get xrefs to union |
| 157 | + |
| 158 | +### Binary Modification Tools |
| 159 | + |
| 160 | +- `set_function_prototype` - Set function prototype |
| 161 | +- `make_function_at` - Create function at address |
| 162 | +- `list_platforms` - List available platforms |
| 163 | +- `patch_bytes` - Patch bytes in binary |
| 164 | + |
| 165 | +### Utility Tools |
| 166 | + |
| 167 | +- `function_at` - Find function at address |
| 168 | +- `get_stack_frame_vars` - Get stack frame variables |
| 169 | +- `list_classes` - List classes/namespaces |
| 170 | +- `list_namespaces` - List namespaces |
| 171 | +- `list_segments` - List memory segments |
| 172 | +- `list_sections` - List sections |
| 173 | +- `list_imports` - List imports |
| 174 | +- `list_exports` - List exports |
| 175 | +- `list_strings` - List strings |
| 176 | +- `list_all_strings` - List all strings (aggregated) |
| 177 | +- `get_binary_status` - Get binary status |
| 178 | +- `list_binaries` - List open binaries |
| 179 | +- `select_binary` - Select active binary |
| 180 | +- `format_value` - Format and annotate value |
| 181 | +- `convert_number` - Convert number representations |
| 182 | + |
| 183 | +## Requirements |
| 184 | + |
| 185 | +- Node.js 18.0.0 or higher |
| 186 | +- A running Binary Ninja instance with the MCP plugin |
| 187 | +- MCP client (Claude Desktop, Cline, etc.) |
| 188 | + |
| 189 | +## License |
| 190 | + |
| 191 | +GPL-3.0 - See LICENSE file for details. |
0 commit comments