Skip to content

Fix TypeScript bridge packaging and comment deletes#79

Open
CX330Blake wants to merge 2 commits into
fosdickio:mainfrom
CX330Blake:fix-typescript-bridge-review
Open

Fix TypeScript bridge packaging and comment deletes#79
CX330Blake wants to merge 2 commits into
fosdickio:mainfrom
CX330Blake:fix-typescript-bridge-review

Conversation

@CX330Blake

Copy link
Copy Markdown
Collaborator

Summary

  • add a real DELETE helper to the TypeScript bridge HTTP client
  • use DELETE for comment deletion tools instead of POST with _method
  • add npm prepare and prepack scripts so dist is built for install-from-git and package creation

Verification

  • npm run build
  • npm run typecheck
  • npm_config_cache=/private/tmp/binary-ninja-mcp-npm-cache npm pack --dry-run

…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
Copilot AI review requested due to automatic review settings May 25, 2026 07:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/prepack scripts and TypeScript build config so dist/ 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 thread bridge/src/tools.ts
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 thread bridge/src/tools.ts
Comment on lines +68 to +69
const lines = await client.getLines("searchFunctions", { query, offset, limit });
return { content: [{ type: "text", text: lines.join("\n") }] };
Comment thread bridge/src/tools.ts
Comment on lines +270 to +271
const lines = await client.getLines("comment", { address });
return { content: [{ type: "text", text: lines[0] ?? "" }] };
Comment thread bridge/src/tools.ts
Comment on lines +307 to +308
const lines = await client.getLines("comment/function", { name: function_name });
return { content: [{ type: "text", text: lines[0] || "" }] };
Comment thread bridge/src/client.ts
Comment on lines +71 to +74
const text = await this.getText(endpoint, params, timeout);
return text.split("\n");
}

Comment thread bridge/package-lock.json
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 thread plugin/__init__.py
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 thread bridge/src/tools.ts
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") }] };
Comment thread bridge/src/tools.ts
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 thread bridge/src/tools.ts
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") }] };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants