@wonderlandengine/mcp-plugin 1.0.3 → 1.1.0

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 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 }).catch((error) => {
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
  }
@@ -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: "0.3.0",
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.map((objectId) => {
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) {
@@ -3,7 +3,7 @@ export declare class WorkQueue {
3
3
  /**
4
4
  * Push a new work item into the queue
5
5
  */
6
- push(func: () => Promise<void>): Promise<void>;
6
+ push<T = void>(func: () => Promise<T>): Promise<T>;
7
7
  /**
8
8
  * Run the top most command in the queue
9
9
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderlandengine/mcp-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
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.0-rc.3",
22
+ "@wonderlandengine/editor-api": "1.5.2",
23
23
  "express": "^5.1.0"
24
24
  },
25
25
  "devDependencies": {