Skip to main content
Glama
opensensor

Binary Ninja Cline MCP Server

by opensensor

decompile_function

Convert binary function code to readable C code for analysis and debugging in Binary Ninja.

Instructions

Decompile a function to C

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
functionYes

Implementation Reference

  • FastMCP stdio bridge handler for the decompile_function tool. Proxies the function name via HTTP POST to localhost:9009/decompile for decompilation by Binary Ninja server.
    @mcp.tool()
    def decompile_function(name: str) -> str:
        """
        Decompile a specific function by name and return the decompiled C code.
        """
        return safe_post("decompile", name)
  • FastMCP SSE bridge handler for the decompile_function tool. Proxies the function name via HTTP POST to localhost:9009/decompile, with error handling and JSON normalization.
    @mcp.tool()
    def decompile_function(name: str):
        """
        Decompile a function by exact name.
        """
        try:
            if not name or not name.strip():
                return {"ok": False, "error": "Function name cannot be empty"}
    
            data, err = _request("POST", "decompile", data=name.strip())
            if err:
                return {"ok": False, "error": err}
            # Normalize to JSON
            code = data if isinstance(data, str) else json.dumps(data)
            return {"ok": True, "code": code}
        except Exception as e:
            logger.error(f"Error in decompile_function: {e}")
            return {"ok": False, "error": str(e)}
  • Input schema definition for decompile_function tool (requires path and function params) in the JS MCP bridge's list_tools handler.
      name: "decompile_function",
      description: "Decompile a function to C",
      inputSchema: zodToJsonSchema(FunctionSchema),
    }
  • Handler case in JS MCP bridge's call_tool for decompile_function: validates arguments with Zod schema and proxies JSON-RPC call to Binary Ninja HTTP server.
    case "decompile_function": {
      try {
        const args = FunctionSchema.parse(request.params.arguments);
        result = await callBinaryNinjaServer("decompile_function", args);
      } catch (error) {
        console.error(`[ERROR] Failed to parse arguments for decompile_function: ${error.message}`);
        console.error(`[ERROR] Arguments received: ${JSON.stringify(request.params.arguments)}`);
        throw error;
      }
      break;
  • Explicit JSON schema for decompile_function tool registered in MCP_TOOLS list for the HTTP MCP server.
        "name": "decompile_function",
        "description": "Decompile to C",
        "streaming": False,
        "inputSchema": {
            "type": "object",
            "properties": {
                "path": {"type": "string"},
                "function": {"type": "string"}
            },
            "required": ["path", "function"]
        }
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/opensensor/bn_cline_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server