@wonderlandengine/mcp-plugin 1.0.3 → 1.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/build/index.mjs +5 -2
- package/build/mcp-server.js +7 -4
- package/build/schemas.d.ts +47 -79
- package/build/utils/work-queue.d.ts +1 -1
- package/package.json +2 -2
package/build/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditorPlugin, ui, tools } from "@wonderlandengine/editor-api";
|
|
2
2
|
import { main, shutdown } from "./server.js";
|
|
3
3
|
import { WorkQueue } from "./utils/work-queue.js";
|
|
4
|
-
const PORT = 3020;
|
|
4
|
+
const PORT = Number(process?.env?.WLE_MCP_PORT ?? 3020);
|
|
5
5
|
const CONFIG_EXAMPLE = ` "wonderland-editor-mcp": {
|
|
6
6
|
"url": "http://localhost:${PORT}/mcp"
|
|
7
7
|
}
|
|
@@ -15,7 +15,10 @@ export default class Index extends EditorPlugin {
|
|
|
15
15
|
super();
|
|
16
16
|
this.name = "MCP Server";
|
|
17
17
|
this.queue = new WorkQueue();
|
|
18
|
-
main({ port: PORT, queue: this.queue }).
|
|
18
|
+
main({ port: PORT, queue: this.queue }).then(() => {
|
|
19
|
+
console.log("[mcp] server running on port", PORT);
|
|
20
|
+
}).catch((error) => {
|
|
21
|
+
console.error("[mcp][error]", error.toString());
|
|
19
22
|
this.status = "[error]" + error.toString();
|
|
20
23
|
});
|
|
21
24
|
}
|
package/build/mcp-server.js
CHANGED
|
@@ -9,7 +9,7 @@ const jsComponentProps = new Map();
|
|
|
9
9
|
const jsComponentPropsByObjectType = new Map();
|
|
10
10
|
export const server = new McpServer({
|
|
11
11
|
name: "Wonderland Editor",
|
|
12
|
-
version: "
|
|
12
|
+
version: "1.1.0",
|
|
13
13
|
});
|
|
14
14
|
let queue = null;
|
|
15
15
|
export function setQueue(q) {
|
|
@@ -179,13 +179,16 @@ server.registerTool("delete_objects", {
|
|
|
179
179
|
inputSchema: deleteObjectsSchema,
|
|
180
180
|
}, async ({ objectIds }) => {
|
|
181
181
|
try {
|
|
182
|
-
await queue.push(async () => {
|
|
183
|
-
objectIds.
|
|
182
|
+
const missingObjects = await queue.push(async () => {
|
|
183
|
+
return objectIds.filter((objectId) => {
|
|
184
|
+
if (!data.objects[objectId].exists)
|
|
185
|
+
return true;
|
|
184
186
|
delete data.objects[objectId];
|
|
187
|
+
return false;
|
|
185
188
|
});
|
|
186
189
|
});
|
|
187
190
|
return {
|
|
188
|
-
content: [{ type: "text", text: "Done." }],
|
|
191
|
+
content: [{ type: "text", text: missingObjects.length != 0 ? "The following objects were not found: " + missingObjects.join(", ") : "Done." }],
|
|
189
192
|
};
|
|
190
193
|
}
|
|
191
194
|
catch (error) {
|
package/build/schemas.d.ts
CHANGED
|
@@ -1,121 +1,89 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const ResourceTypes: readonly ["objects", "textures", "meshes", "materials", "animations", "skins", "images", "shaders", "pipelines", "fonts", "morphTargets", "particleEffects"];
|
|
3
3
|
export declare const queryResourcesSchema: {
|
|
4
|
-
resourceType: z.ZodEnum<
|
|
5
|
-
|
|
4
|
+
resourceType: z.ZodEnum<{
|
|
5
|
+
objects: "objects";
|
|
6
|
+
textures: "textures";
|
|
7
|
+
meshes: "meshes";
|
|
8
|
+
materials: "materials";
|
|
9
|
+
animations: "animations";
|
|
10
|
+
skins: "skins";
|
|
11
|
+
images: "images";
|
|
12
|
+
shaders: "shaders";
|
|
13
|
+
pipelines: "pipelines";
|
|
14
|
+
fonts: "fonts";
|
|
15
|
+
morphTargets: "morphTargets";
|
|
16
|
+
particleEffects: "particleEffects";
|
|
17
|
+
}>;
|
|
18
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
19
|
includeFilter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
7
20
|
excludeFilter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
8
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodString
|
|
21
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
22
|
};
|
|
10
23
|
export declare const querySettingsSchema: {
|
|
11
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodString
|
|
24
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
25
|
};
|
|
13
26
|
export declare const modifySettingsSchema: {
|
|
14
27
|
changeSettings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
15
|
-
resetPaths: z.ZodOptional<z.ZodArray<z.ZodString
|
|
28
|
+
resetPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
29
|
};
|
|
17
30
|
export declare const queryComponentTypesSchema: {
|
|
18
|
-
names: z.ZodOptional<z.ZodArray<z.ZodString
|
|
31
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
32
|
};
|
|
20
33
|
export declare const deleteObjectsSchema: {
|
|
21
|
-
objectIds: z.ZodArray<z.ZodString
|
|
34
|
+
objectIds: z.ZodArray<z.ZodString>;
|
|
22
35
|
};
|
|
23
36
|
export declare const modifyObjectsSchema: {
|
|
24
37
|
modifications: z.ZodArray<z.ZodObject<{
|
|
25
38
|
name: z.ZodOptional<z.ZodString>;
|
|
26
39
|
id: z.ZodOptional<z.ZodString>;
|
|
27
40
|
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
-
position: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
29
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
30
|
-
scaling: z.ZodOptional<z.ZodArray<z.ZodNumber
|
|
41
|
+
position: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
42
|
+
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
43
|
+
scaling: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
31
44
|
addComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
45
|
type: z.ZodString;
|
|
33
46
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
34
|
-
},
|
|
35
|
-
type: string;
|
|
36
|
-
properties?: Record<string, any> | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
type: string;
|
|
39
|
-
properties?: Record<string, any> | undefined;
|
|
40
|
-
}>, "many">>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
41
48
|
modifyComponents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
49
|
index: z.ZodNumber;
|
|
43
50
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}, {
|
|
48
|
-
index: number;
|
|
49
|
-
properties?: Record<string, any> | undefined;
|
|
50
|
-
}>, "many">>;
|
|
51
|
-
removeComponents: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
52
|
-
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
name?: string | undefined;
|
|
54
|
-
id?: string | undefined;
|
|
55
|
-
parentId?: string | null | undefined;
|
|
56
|
-
position?: number[] | undefined;
|
|
57
|
-
rotation?: number[] | undefined;
|
|
58
|
-
scaling?: number[] | undefined;
|
|
59
|
-
addComponents?: {
|
|
60
|
-
type: string;
|
|
61
|
-
properties?: Record<string, any> | undefined;
|
|
62
|
-
}[] | undefined;
|
|
63
|
-
modifyComponents?: {
|
|
64
|
-
index: number;
|
|
65
|
-
properties?: Record<string, any> | undefined;
|
|
66
|
-
}[] | undefined;
|
|
67
|
-
removeComponents?: number[] | undefined;
|
|
68
|
-
}, {
|
|
69
|
-
name?: string | undefined;
|
|
70
|
-
id?: string | undefined;
|
|
71
|
-
parentId?: string | null | undefined;
|
|
72
|
-
position?: number[] | undefined;
|
|
73
|
-
rotation?: number[] | undefined;
|
|
74
|
-
scaling?: number[] | undefined;
|
|
75
|
-
addComponents?: {
|
|
76
|
-
type: string;
|
|
77
|
-
properties?: Record<string, any> | undefined;
|
|
78
|
-
}[] | undefined;
|
|
79
|
-
modifyComponents?: {
|
|
80
|
-
index: number;
|
|
81
|
-
properties?: Record<string, any> | undefined;
|
|
82
|
-
}[] | undefined;
|
|
83
|
-
removeComponents?: number[] | undefined;
|
|
84
|
-
}>, "many">;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
removeComponents: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
85
54
|
};
|
|
86
55
|
export declare const modifyResourcesSchema: {
|
|
87
56
|
modifications: z.ZodArray<z.ZodObject<{
|
|
88
|
-
resourceType: z.ZodEnum<
|
|
57
|
+
resourceType: z.ZodEnum<{
|
|
58
|
+
objects: "objects";
|
|
59
|
+
textures: "textures";
|
|
60
|
+
meshes: "meshes";
|
|
61
|
+
materials: "materials";
|
|
62
|
+
animations: "animations";
|
|
63
|
+
skins: "skins";
|
|
64
|
+
images: "images";
|
|
65
|
+
shaders: "shaders";
|
|
66
|
+
pipelines: "pipelines";
|
|
67
|
+
fonts: "fonts";
|
|
68
|
+
morphTargets: "morphTargets";
|
|
69
|
+
particleEffects: "particleEffects";
|
|
70
|
+
}>;
|
|
89
71
|
id: z.ZodOptional<z.ZodString>;
|
|
90
72
|
changeProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
91
|
-
resetProperties: z.ZodOptional<z.ZodArray<z.ZodString
|
|
92
|
-
},
|
|
93
|
-
resourceType: "objects" | "textures" | "meshes" | "materials" | "animations" | "skins" | "images" | "shaders" | "pipelines" | "fonts" | "morphTargets" | "particleEffects";
|
|
94
|
-
id?: string | undefined;
|
|
95
|
-
changeProperties?: Record<string, any> | undefined;
|
|
96
|
-
resetProperties?: string[] | undefined;
|
|
97
|
-
}, {
|
|
98
|
-
resourceType: "objects" | "textures" | "meshes" | "materials" | "animations" | "skins" | "images" | "shaders" | "pipelines" | "fonts" | "morphTargets" | "particleEffects";
|
|
99
|
-
id?: string | undefined;
|
|
100
|
-
changeProperties?: Record<string, any> | undefined;
|
|
101
|
-
resetProperties?: string[] | undefined;
|
|
102
|
-
}>, "many">;
|
|
73
|
+
resetProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
103
75
|
};
|
|
104
76
|
export declare const importSceneFilesSchema: {
|
|
105
77
|
imports: z.ZodArray<z.ZodObject<{
|
|
106
78
|
path: z.ZodString;
|
|
107
|
-
},
|
|
108
|
-
path: string;
|
|
109
|
-
}, {
|
|
110
|
-
path: string;
|
|
111
|
-
}>, "many">;
|
|
79
|
+
}, z.core.$strip>>;
|
|
112
80
|
};
|
|
113
81
|
export declare const importFilesSchema: {
|
|
114
|
-
imports: z.ZodArray<z.ZodString
|
|
82
|
+
imports: z.ZodArray<z.ZodString>;
|
|
115
83
|
};
|
|
116
84
|
export declare const computeMeshBoundsSchema: {
|
|
117
|
-
meshIds: z.ZodArray<z.ZodString
|
|
85
|
+
meshIds: z.ZodArray<z.ZodString>;
|
|
118
86
|
};
|
|
119
87
|
export declare const computeObjectBoundsSchema: {
|
|
120
|
-
objectIds: z.ZodArray<z.ZodString
|
|
88
|
+
objectIds: z.ZodArray<z.ZodString>;
|
|
121
89
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderlandengine/mcp-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "./build/index.mjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./build/index.mjs",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"wonderlandengine": {},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@modelcontextprotocol/sdk": "^1.13.2",
|
|
22
|
-
"@wonderlandengine/editor-api": "1.5.
|
|
22
|
+
"@wonderlandengine/editor-api": "1.5.2",
|
|
23
23
|
"express": "^5.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|