Skip to main content

MCP Server for Binary Ninja

Project description

binaryninja-mcp

MCP Server for Binary Ninja

Installation

Server Setup

There are two ways to run the MCP server:

  1. Binary Ninja UI Plugin:

    • Install the plugin via Binary Ninja's plugin manager
    • The MCP server will start automatically when first file is loaded.
      • Auto start is configurable via Settings - MCP Server - Auto Start
      • Listen port is configurable via Settings - MCP Server - Server port number
    • All opened files are exposed to separate resources, see Available Resources section below
  2. Binary Ninja Headless Mode:

    uvx binaryninja-mcp server <filename> [filename]...
    
    • filename could be any binary files or BNDB, like in UI mode, all opened files are available to the MCP client.
    • Server runs on default port 7000
    • Use --port flag to specify a different port

MCP Client Setup

  1. Claude Desktop (stdio relay client): Configure the client to connect via stdio transport using built-in relay.

    {
      "mcpServers": {
        "binaryninja": {
          "command": "uvx",
          "args": ["binaryninja-mcp", "client"]
        }
      }
    }
    
  2. Cherry Studio:

    • SSE endpoint (recommanded): URL: http://localhost:7000/sse
    • stdio client:
      • Command: uvx
      • Arguments:
        binaryninja-mcp
        client
        

Available Tools for MCP Clients

The MCP server provides the following tools:

  • rename_symbol: Rename a function or a data variable
  • pseudo_c: Get pseudo C code of a specified function
  • pseudo_rust: Get pseudo Rust code of a specified function
  • high_level_il: Get high level IL of a specified function
  • medium_level_il: Get medium level IL of a specified function
  • disassembly: Get disassembly of a function or specified range
  • update_analysis_and_wait: Update analysis for the binary and wait for completion
  • get_triage_summary: Get basic information from BinaryNinja Triage view
  • get_imports: Get dictionary of imported symbols
  • get_exports: Get dictionary of exported symbols
  • get_segments: Get list of memory segments
  • get_sections: Get list of binary sections
  • get_strings: Get list of strings found in the binary
  • get_functions: Get list of functions
  • get_data_variables: Get list of data variables

Available Resources for MCP Clients

MCP Resources can be accessed via URIs in the format: binaryninja://{filename}/{resource_type}

The server provides these resource types for each binary:

  • triage_summary: Basic information from BinaryNinja Triage view
  • imports: Dictionary of imported symbols/functions
  • exports: Dictionary of exported symbols/functions
  • segments: List of memory segments
  • sections: List of binary sections
  • strings: List of strings found in the binary
  • functions: List of functions
  • data_variables: List of data variables

Development

uv is the recommanded package management tool for this project.

Clone directory to Binary Ninja Plugin Directory

git clone https://github.com/MCPPhalanx/binaryninja-mcp.git "${env:APPDATA}\Binary Ninja\plugins\MCPPhalanx_binaryninja_mcp"

Setup Python Environment

Binary Ninja API must be installed into virtualenv manually.

uv venv
uv sync --dev
# install binaryninja API
binaryninja-mcp install-api
# check API is correctly installed
uv run python -c 'import binaryninja as bn; print(f"ui_enabled={bn.core_ui_enabled()}")'

Setup MCP Client for Development

For MCP clients with stdio transport like Claude Desktop, change working directory to development folder.

{
  "mcpServers": {
    "binaryninja": {
      "command": "uv",
      "args": [
        "--directory",
        "C:/path/to/binaryninja-mcp",
        "run",
        "binaryninja-mcp",
        "client"
      ]
    }
  }
}

SSE-enabled MCP clients can connect using: http://localhost:7000/sse

Build

uv build

Test

pytest
# To update test snapshots:
pytest --snapshot-update

Version Bump

The PyPI package version is automatically derived from Binary Ninja's plugin.json (using package.json format), maintaining version consistency between the BN plugin and PyPI package.

# bump alpha version
uvx hatch version a

# bump release version
uvx hatch version minor,rc
uvx hatch version release

See: Versioning - Hatch

Release

uv publish

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binaryninja_mcp-0.2.2.tar.gz (108.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binaryninja_mcp-0.2.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file binaryninja_mcp-0.2.2.tar.gz.

File metadata

  • Download URL: binaryninja_mcp-0.2.2.tar.gz
  • Upload date:
  • Size: 108.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.12

File hashes

Hashes for binaryninja_mcp-0.2.2.tar.gz
Algorithm Hash digest
SHA256 87b25e75164716a6fb5e285e97ae6f1af5e8daf8a581a6dd250368c05311893e
MD5 76b566840861467e8e7cf279e1968841
BLAKE2b-256 56e00dd4e95a7ef79b8bfa56c22f9fb6a32e113b73ad2e26aeb8f278b433c23e

See more details on using hashes here.

File details

Details for the file binaryninja_mcp-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for binaryninja_mcp-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 500e98a21871d7ede061c193f67264f42be6232c3a206c1ba36f51b7da14957f
MD5 af005ebf3182731be16f4846b345beb2
BLAKE2b-256 e5702aaf83c0deb4a7736c08a64cbf3a19e27990b658b539e39db7932192d30f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page