VPS_uninstallMonarxV1
Uninstalls the Monarx malware scanner from a specified VPS instance. If Monarx is not installed, the request has no effect.
Instructions
Uninstall the Monarx malware scanner on a specified virtual machine.
If Monarx is not installed, the request will still be processed without any effect.
Use this endpoint to remove malware scanner from VPS instances.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| virtualMachineId | Yes | Virtual Machine ID |
Implementation Reference
- src/core/tools/vps.ts:1272-1295 (schema)Schema definition for VPS_uninstallMonarxV1 tool - defines it as a DELETE request to /api/vps/v1/virtual-machines/{virtualMachineId}/monarx with virtualMachineId as the required integer input parameter.
{ "name": "VPS_uninstallMonarxV1", "description": "Uninstall the Monarx malware scanner on a specified virtual machine.\n\nIf Monarx is not installed, the request will still be processed without any effect.\n\nUse this endpoint to remove malware scanner from VPS instances.", "method": "DELETE", "path": "/api/vps/v1/virtual-machines/{virtualMachineId}/monarx", "inputSchema": { "type": "object", "properties": { "virtualMachineId": { "type": "integer", "description": "Virtual Machine ID" } }, "required": [ "virtualMachineId" ] }, "security": [ { "apiToken": [] } ], "group": "vps" }, - src/core/tools/vps.ts:1826-1827 (registration)Tool list export containing VPS_uninstallMonarxV1 along with all other VPS tools - this array is exported and imported by the VPS server entry point.
]; export default tools; - src/core/runtime.js:1879-1966 (handler)The generic API handler executeApiCall in the MCPServer class handles all non-custom tools including VPS_uninstallMonarxV1. Since VPS_uninstallMonarxV1 has no 'custom' flag, it is executed via this method which makes a DELETE request to /api/vps/v1/virtual-machines/{virtualMachineId}/monarx, substituting {virtualMachineId} from the input parameters.
async executeApiCall(tool, params) { // Get method and path from tool const method = tool.method; let path = tool.path; // Clone params to avoid modifying the original const requestParams = { ...params }; // Replace path parameters with values from params Object.entries(requestParams).forEach(([key, value]) => { const placeholder = `{${key}}`; if (path.includes(placeholder)) { path = path.replace(placeholder, encodeURIComponent(String(value))); delete requestParams[key]; // Remove used parameter } }); // Build the full URL const baseUrl = this.baseUrl.endsWith("/") ? this.baseUrl : `${this.baseUrl}/`; const cleanPath = path.startsWith("/") ? path.slice(1) : path; const url = new URL(cleanPath, baseUrl).toString(); this.log('debug', `API Request: ${method} ${url}`); try { // Configure the request const config = { method: method.toLowerCase(), url, headers: { ...this.headers }, timeout: 60000, // 60s validateStatus: function (status) { return status < 500; // Resolve only if the status code is less than 500 } }; const bearerToken = process.env['API_TOKEN'] || process.env['APITOKEN']; // APITOKEN for backwards compatibility if (bearerToken) { config.headers['Authorization'] = `Bearer ${bearerToken}`; } else { this.log('error', `Bearer Token environment variable not found: API_TOKEN`); } // Add parameters based on request method if (["GET", "DELETE"].includes(method)) { // For GET/DELETE, send params as query string config.params = { ...(config.params || {}), ...requestParams }; } else { // For POST/PUT/PATCH, send params as JSON body config.data = requestParams; config.headers["Content-Type"] = "application/json"; } this.log('debug', "Request config:", { url: config.url, method: config.method, params: config.params, headers: Object.keys(config.headers) }); // Execute the request const response = await axios(config); this.log('debug', `Response status: ${response.status}`); return response.data; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.log('error', `API request failed: ${errorMessage}`); if (axios.isAxiosError(error)) { const responseData = error.response?.data; const responseStatus = error.response?.status; this.log('error', 'API Error Details:', { status: responseStatus, data: typeof responseData === 'object' ? JSON.stringify(responseData) : responseData }); // Rethrow with more context for better error handling const detailedError = new Error(`API request failed with status ${responseStatus}: ${errorMessage}`); detailedError.response = error.response; throw detailedError; } throw error; } } - src/core/runtime.js:118-170 (handler)The CallToolRequestSchema handler in MCPServer.setupHandlers() dispatches tool calls. For VPS_uninstallMonarxV1 (which is not marked as 'custom'), it routes to executeApiCall, constructing and sending the API request.
this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { id, name, arguments: params } = request.params; this.log('debug', "Handling CallTool request", { id, name, params }); let toolName; let toolDetails; // Find the requested tool for (const [tid, tool] of this.tools.entries()) { if (tool.name === name) { toolName = name; break; } } if (!toolName) { throw new Error(`Tool not found: ${name}`); } toolDetails = this.toolList.find(t => t.name === toolName); if (!toolDetails) { throw new Error(`Tool details not found for ID: ${toolName}`); } try { this.log('info', `Executing tool: ${toolName}`); let result; if (toolDetails.custom) { result = await this.executeCustomTool(toolDetails, params || {}); } else { result = await this.executeApiCall(toolDetails, params || {}); } // Return the result in the correct MCP format return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); const response = error.response; this.log('error', `Error executing tool ${name}: ${errorMessage}`); throw error; } });