Fix TypeScript bridge packaging and comment deletes#79
Open
CX330Blake wants to merge 2 commits into
Open
Conversation
…osdickio#59) - Add "Expose to Network" setting (mcp.exposeToNetwork) for binding server to 0.0.0.0 - Fix mcp.port setting to use string type with default "9009" - Create TypeScript MCP bridge (binary-ninja-mcp) for npx execution - Implement 54 MCP tools mapping to Binary Ninja API endpoints - Add CLI options and environment variables for host/port configuration - Update documentation for npm package setup
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces and documents a TypeScript-based MCP bridge (packaged for npm usage), updates the Binary Ninja plugin settings to support binding host/port from Binary Ninja settings, and switches the TS bridge comment deletion behavior to use real HTTP DELETE.
Changes:
- Add a TypeScript MCP bridge implementation (CLI entrypoint, HTTP client, and tool registrations).
- Add npm
prepare/prepackscripts and TypeScript build config sodist/is built for packaging/install-from-git. - Update plugin settings (expose to network + port) and refresh README installation guidance.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds npm-based setup instructions and updates tool naming in docs. |
| plugin/init.py | Applies Binary Ninja settings (host/port) at server start and registers new settings. |
| bridge/tsconfig.json | Adds TypeScript compiler configuration for building dist/. |
| bridge/src/tools.ts | Registers MCP tools backed by the Binary Ninja HTTP server; updates deletions to HTTP DELETE. |
| bridge/src/index.ts | Adds Node CLI entrypoint and argument parsing for host/port. |
| bridge/src/client.ts | Adds an Axios-based HTTP client with GET/POST/DELETE helpers. |
| bridge/README.md | Documents the TypeScript bridge usage and configuration. |
| bridge/package.json | Defines the npm package, build scripts, and bin entrypoint. |
| bridge/package-lock.json | Adds the lockfile for the bridge dependencies. |
| .gitignore | Ignores bridge/node_modules. |
Files not reviewed (1)
- bridge/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+34
| server.tool( | ||
| "list_methods", | ||
| "List all function names in the program with pagination.", | ||
| { | ||
| offset: z.number().default(0).describe("Offset for pagination"), | ||
| limit: z.number().default(100).describe("Number of results to return"), | ||
| }, | ||
| async ({ offset = 0, limit = 100 }) => { | ||
| const filename = await getActiveFilename(); | ||
| const lines = await client.getLines("methods", { offset, limit }); | ||
| return { | ||
| content: [{ type: "text", text: `File: ${filename}\n${lines.join("\n")}` }], | ||
| }; | ||
| } |
Comment on lines
+68
to
+69
| const lines = await client.getLines("searchFunctions", { query, offset, limit }); | ||
| return { content: [{ type: "text", text: lines.join("\n") }] }; |
Comment on lines
+270
to
+271
| const lines = await client.getLines("comment", { address }); | ||
| return { content: [{ type: "text", text: lines[0] ?? "" }] }; |
Comment on lines
+307
to
+308
| const lines = await client.getLines("comment/function", { name: function_name }); | ||
| return { content: [{ type: "text", text: lines[0] || "" }] }; |
Comment on lines
+71
to
+74
| const text = await this.getText(endpoint, params, timeout); | ||
| return text.split("\n"); | ||
| } | ||
|
|
Comment on lines
+1
to
+12
| { | ||
| "name": "@binary-ninja/mcp-server", | ||
| "version": "1.0.0", | ||
| "lockfileVersion": 3, | ||
| "requires": true, | ||
| "packages": { | ||
| "": { | ||
| "name": "@binary-ninja/mcp-server", | ||
| "version": "1.0.0", | ||
| "license": "GPL-3.0", | ||
| "dependencies": { | ||
| "@modelcontextprotocol/sdk": "^1.0.0", |
Comment on lines
+8
to
+16
| def _apply_settings_to_config(): | ||
| """Apply Binary Ninja settings to the configuration.""" | ||
| try: | ||
| settings = Settings() | ||
|
|
||
| # Apply expose to network setting | ||
| expose_to_network = settings.get_bool("mcp.exposeToNetwork") | ||
| plugin.config.server.host = "0.0.0.0" if expose_to_network else "localhost" | ||
|
|
Comment on lines
+356
to
+361
| const lines = await client.getLines("localTypes", { | ||
| offset, | ||
| limit: count, | ||
| includeLibraries: include_libraries ? 1 : 0, | ||
| }); | ||
| return { content: [{ type: "text", text: lines.join("\n") }] }; |
| limit: z.number().default(100).describe("Number of results to return"), | ||
| }, | ||
| async ({ offset = 0, limit = 100 }) => { | ||
| const lines = await client.getLines("segments", { offset, limit }); |
Comment on lines
+794
to
+818
| server.tool( | ||
| "list_strings", | ||
| "List all strings in the database (paginated).", | ||
| { | ||
| offset: z.number().default(0).describe("Offset for pagination"), | ||
| count: z.number().default(100).describe("Number of results to return"), | ||
| }, | ||
| async ({ offset = 0, count = 100 }) => { | ||
| const lines = await client.getLines("strings", { offset, limit: count }); | ||
| return { content: [{ type: "text", text: lines.join("\n") }] }; | ||
| } | ||
| ); | ||
|
|
||
| server.tool( | ||
| "list_strings_filter", | ||
| "List matching strings in the database (paginated, filtered).", | ||
| { | ||
| offset: z.number().default(0).describe("Offset for pagination"), | ||
| count: z.number().default(100).describe("Number of results to return"), | ||
| filter: z.string().optional().describe("Filter string"), | ||
| }, | ||
| async ({ offset = 0, count = 100, filter = "" }) => { | ||
| const lines = await client.getLines("strings/filter", { offset, limit: count, filter }); | ||
| return { content: [{ type: "text", text: lines.join("\n") }] }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification