fix: correct CPU throttle param and enforce server delete safety delay
- servers_throttle_cpu: send `percent` instead of `cpuThrottle` in request body to match VirtFusion API spec - servers_delete: enforce minimum 300s (5 min) delay on all deletions as a safety margin to prevent accidental destruction - Bump version to 1.0.1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ezscale/virtfusion-mcp",
|
"name": "@ezscale/virtfusion-mcp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "Model Context Protocol (MCP) server for the VirtFusion virtualization control panel API",
|
"description": "Model Context Protocol (MCP) server for the VirtFusion virtualization control panel API",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -100,14 +100,15 @@ export function registerServerTools(server: McpServer, client: VirtFusionClient)
|
|||||||
|
|
||||||
server.tool(
|
server.tool(
|
||||||
'servers_delete',
|
'servers_delete',
|
||||||
'Delete a server',
|
'Delete a server. A minimum 5-minute (300s) delay is enforced as a safety margin.',
|
||||||
{
|
{
|
||||||
serverId: z.number().describe('The server ID'),
|
serverId: z.number().describe('The server ID'),
|
||||||
delay: z.number().optional().describe('Delay in seconds before deletion'),
|
delay: z.number().optional().describe('Delay in seconds before deletion (minimum 300)'),
|
||||||
},
|
},
|
||||||
async ({ serverId, delay }) => {
|
async ({ serverId, delay }) => {
|
||||||
try {
|
try {
|
||||||
const result = await client.delete(`/servers/${serverId}`, undefined, { delay });
|
const safeDelay = Math.max(delay ?? 300, 300);
|
||||||
|
const result = await client.delete(`/servers/${serverId}`, undefined, { delay: safeDelay });
|
||||||
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return formatErrorResponse(error);
|
return formatErrorResponse(error);
|
||||||
@@ -220,11 +221,11 @@ export function registerServerTools(server: McpServer, client: VirtFusionClient)
|
|||||||
"Throttle a server's CPU",
|
"Throttle a server's CPU",
|
||||||
{
|
{
|
||||||
serverId: z.number().describe('The server ID'),
|
serverId: z.number().describe('The server ID'),
|
||||||
cpuThrottle: z.number().describe('CPU throttle value'),
|
cpuThrottle: z.number().describe('CPU throttle percentage (0-99). 0 removes throttle.'),
|
||||||
},
|
},
|
||||||
async ({ serverId, cpuThrottle }) => {
|
async ({ serverId, cpuThrottle }) => {
|
||||||
try {
|
try {
|
||||||
const result = await client.put(`/servers/${serverId}/modify/cpuThrottle`, { cpuThrottle });
|
const result = await client.put(`/servers/${serverId}/modify/cpuThrottle`, { percent: cpuThrottle });
|
||||||
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return formatErrorResponse(error);
|
return formatErrorResponse(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user