{"record":{"id":"0f669583ff5d510b","repo":"xpipe-io/xpipe","slug":"http-api-is-not-enabled","errorCode":null,"errorMessage":"HTTP API is not enabled","messagePattern":"HTTP API is not enabled","errorType":"exception","errorClass":"BeaconClientException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java","lineNumber":83,"sourceCode":"\n                    return McpSchema.CallToolResult.builder()\n                            .addTextContent(text)\n                            .build();\n                }))\n                .build();\n    }\n\n    public static McpServerFeatures.SyncToolSpecification callApi() throws IOException {\n        var tool = McpSchemaFiles.loadTool(\"call_api.json\");\n        return McpServerFeatures.SyncToolSpecification.builder()\n                .tool(tool)\n                .callHandler(McpToolHandler.of((req) -> {\n                    var path = req.getStringArgument(\"path\");\n                    var payload = req.getRawRequest().arguments().get(\"payload\");\n                    var payloadJson = JacksonMapper.getDefault().valueToTree(payload);\n\n                    if (!AppPrefs.get().enableHttpApi().get()) {\n                        throw new BeaconClientException(\"HTTP API is not enabled\");\n                    }\n\n                    var i = BeaconInterface.byPath(path);\n                    if (i.isEmpty()) {\n                        throw new BeaconClientException(\"No API endpoint found for path \" + path);\n                    }\n\n                    var handshakeRequest = HandshakeExchange.Request.builder()\n                            .client(BeaconClientInformation.Mcp.builder().build())\n                            .auth(BeaconAuthMethod.ApiKey.builder()\n                                    .key(AppPrefs.get().apiKey().get())\n                                    .build())\n                            .build();\n                    var handshakeReq = HttpRequest.newBuilder()\n                            .uri(URI.create(\n                                    \"http://localhost:\" + AppBeaconServer.get().getPort() + \"/handshake\"))\n                            .POST(HttpRequest.BodyPublishers.ofString(\n                                    JacksonMapper.getDefault().writeValueAsString(handshakeRequest)))","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java#L65-L101","documentation":"The MCP callApi tool proxies requests to XPipe's HTTP API. Before dispatching, it checks the enableHttpApi preference and throws this BeaconClientException when the HTTP API is disabled in app settings. The MCP tool intentionally refuses to bypass that policy switch.","triggerScenarios":"Calling the MCP 'callApi' tool while the AppPrefs.enableHttpApi setting is off (its default in many installs).","commonSituations":"Fresh XPipe installations where the HTTP API was never enabled; users who disabled the API for security after setup; headless/CI environments with a settings file that omits the option.","solutions":["Enable the HTTP API in XPipe settings (Settings > HTTP API / enableHttpApi preference) and restart if needed","Set enableHttpApi=true in the prefs/config file for headless environments","If the HTTP API must stay off, use dedicated MCP tools instead of callApi","Catch BeaconClientException and instruct the user to enable the HTTP API"],"exampleFix":"// before\nif (!AppPrefs.get().enableHttpApi().get()) { /* tool call fails */ }\n// after: enable the setting first\nAppPrefs.get().enableHttpApi().set(true); // or toggle in Settings UI","handlingStrategy":"validation","validationCode":"// check the setting before calling callApi\nconst httpApiEnabled = await getPref('enableHttpApi');\nif (!httpApiEnabled) throw new Error('Enable the HTTP API in XPipe settings before using callApi');","typeGuard":null,"tryCatchPattern":"try { return callApi(path, payload); } catch (BeaconClientException e) { if (e.message === 'HTTP API is not enabled') { /* guide the user to enable the setting */ } throw e; }","preventionTips":["Enable the HTTP API during initial XPipe setup if you plan to automate via MCP","Document the required pref in deployment/runbook configs","Verify the setting after XPipe upgrades that may reset preferences"],"tags":["mcp","feature-disabled","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}