vpsnet-mcp 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/build/api-path.js +26 -0
- package/build/api.js +5 -0
- package/build/certificate-contract.js +7 -0
- package/build/file-restore-contract.js +1 -0
- package/build/index.js +240 -225
- package/build/temp-vm-contract.js +2 -0
- package/build/tool-result.js +49 -0
- package/package.json +4 -2
|
@@ -4,6 +4,7 @@ export const tempVmIdSchema = z
|
|
|
4
4
|
.number()
|
|
5
5
|
.int()
|
|
6
6
|
.positive()
|
|
7
|
+
.max(Number.MAX_SAFE_INTEGER)
|
|
7
8
|
.describe("on-demand server session ID returned by list_temp_vms");
|
|
8
9
|
export const tempVmProfileSchema = z
|
|
9
10
|
.enum(["standard", "power"])
|
|
@@ -18,6 +19,7 @@ export const tempVmOsIdSchema = z
|
|
|
18
19
|
.number()
|
|
19
20
|
.int()
|
|
20
21
|
.positive()
|
|
22
|
+
.max(Number.MAX_SAFE_INTEGER)
|
|
21
23
|
.describe("Optional enabled Firecracker guest OS ID. Omit it to use the current default; Functions runtime images are rejected.");
|
|
22
24
|
export const tempVmRootPasswordSchema = z
|
|
23
25
|
.string()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function failurePayload(value) {
|
|
2
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
const payload = value;
|
|
6
|
+
const error = payload.error;
|
|
7
|
+
const hasError = error === true
|
|
8
|
+
|| (typeof error === "string" && error.trim().length > 0)
|
|
9
|
+
|| (error !== null && typeof error === "object" && Object.keys(error).length > 0);
|
|
10
|
+
return payload.success === false
|
|
11
|
+
|| hasError
|
|
12
|
+
|| (typeof payload.http_status === "number" && payload.http_status >= 400)
|
|
13
|
+
|| payload.state === "error";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Mark returned API failures after the tool's existing safe projection.
|
|
17
|
+
* Capability values such as backup `status: false` are ordinary read results.
|
|
18
|
+
* Keep the response body and recovery guidance unchanged, and never retry.
|
|
19
|
+
*/
|
|
20
|
+
export function markToolResultError(result) {
|
|
21
|
+
if (result.isError === true)
|
|
22
|
+
return result;
|
|
23
|
+
const failed = failurePayload(result.structuredContent)
|
|
24
|
+
|| result.content.some((content) => {
|
|
25
|
+
if (content.type !== "text")
|
|
26
|
+
return false;
|
|
27
|
+
try {
|
|
28
|
+
return failurePayload(JSON.parse(content.text));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return failed ? { ...result, isError: true } : result;
|
|
35
|
+
}
|
|
36
|
+
/** Preserve each registered handler's arguments and return type. */
|
|
37
|
+
export function withToolResultErrorFlag(handler) {
|
|
38
|
+
return async (...args) => markToolResultError(await handler(...args));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Install before registering tools. Erase the SDK's conditional callback types
|
|
42
|
+
* only inside this adapter; callers retain the original generic registerTool
|
|
43
|
+
* signature, and the SDK still validates each handler's input schema.
|
|
44
|
+
*/
|
|
45
|
+
export function installToolResultErrorFlag(server) {
|
|
46
|
+
const registerTool = server.registerTool.bind(server);
|
|
47
|
+
const wrapped = (name, config, handler) => registerTool(name, config, withToolResultErrorFlag(handler));
|
|
48
|
+
server.registerTool = wrapped;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vpsnet-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server for managing VPSnet.com services, applications, DNS, domains, billing, and server lifecycle operations",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"build/file-restore-contract.js",
|
|
23
23
|
"build/index.js",
|
|
24
24
|
"build/service-rescue-contract.js",
|
|
25
|
-
"build/temp-vm-contract.js"
|
|
25
|
+
"build/temp-vm-contract.js",
|
|
26
|
+
"build/api-path.js",
|
|
27
|
+
"build/tool-result.js"
|
|
26
28
|
],
|
|
27
29
|
"repository": "github:bacarrdy/vpsnet-mcp",
|
|
28
30
|
"homepage": "https://github.com/bacarrdy/vpsnet-mcp",
|