@envnyx/robloxstudio-mcp 3.6.0 → 3.6.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/dist/index.js CHANGED
@@ -29123,12 +29123,12 @@ function createHttpServer(tools, bridge, allowedTools, serverConfig, security) {
29123
29123
  };
29124
29124
  return app;
29125
29125
  }
29126
- async function listenWithRetry(app, host, startPort, maxAttempts = 5) {
29126
+ async function listenWithFactory(createApp, host, startPort, maxAttempts = 5) {
29127
29127
  for (let i = 0; i < maxAttempts; i++) {
29128
29128
  const port = startPort + i;
29129
29129
  try {
29130
- const server = await bindPort(app, host, port);
29131
- return { server, port };
29130
+ const { server, app } = await bindPortWithFactory(createApp, host, port);
29131
+ return { server, port, app };
29132
29132
  } catch (error) {
29133
29133
  if (error !== null && typeof error === "object" && "code" in error && error.code === "EADDRINUSE") {
29134
29134
  if (i + 1 < maxAttempts)
@@ -29140,9 +29140,9 @@ async function listenWithRetry(app, host, startPort, maxAttempts = 5) {
29140
29140
  }
29141
29141
  throw new Error(maxAttempts === 1 ? `Port ${startPort} is in use.` : `All ports ${startPort}-${startPort + maxAttempts - 1} are in use. Stop some MCP server instances and retry.`);
29142
29142
  }
29143
- function bindPort(app, host, port) {
29143
+ function bindPortWithFactory(createApp, host, port) {
29144
29144
  const { promise, resolve: resolve7, reject } = Promise.withResolvers();
29145
- const server = http.createServer(app);
29145
+ const server = http.createServer();
29146
29146
  const onError = (err2) => {
29147
29147
  server.removeListener("error", onError);
29148
29148
  reject(err2);
@@ -29150,13 +29150,20 @@ function bindPort(app, host, port) {
29150
29150
  server.once("error", onError);
29151
29151
  server.listen(port, host, () => {
29152
29152
  server.removeListener("error", onError);
29153
+ let app;
29153
29154
  try {
29155
+ app = createApp();
29156
+ server.on("request", app);
29154
29157
  if ("attachStudioTransport" in app && typeof app.attachStudioTransport === "function") {
29155
29158
  app.attachStudioTransport(server);
29156
29159
  }
29157
- resolve7(server);
29160
+ resolve7({ server, app });
29158
29161
  } catch (error) {
29159
29162
  server.close();
29163
+ if (app && "cleanup" in app && typeof app.cleanup === "function") {
29164
+ void Promise.resolve(app.cleanup()).catch(() => {
29165
+ });
29166
+ }
29160
29167
  reject(error);
29161
29168
  }
29162
29169
  });
@@ -29894,10 +29901,10 @@ var RobloxStudioMCPServer = class {
29894
29901
  let boundPort = 0;
29895
29902
  let promotionInterval;
29896
29903
  try {
29897
- primaryApp = createHttpServer(this.tools, this.bridge, this.allowedToolNames, this.config, security);
29898
- const result = await listenWithRetry(primaryApp, host, basePort, 1);
29904
+ const result = await listenWithFactory(() => createHttpServer(this.tools, this.bridge, this.allowedToolNames, this.config, security), host, basePort, 1);
29899
29905
  httpHandle = result.server;
29900
29906
  boundPort = result.port;
29907
+ primaryApp = result.app;
29901
29908
  console.error(`HTTP server listening on ${host}:${boundPort} for Studio plugin (primary mode)`);
29902
29909
  console.error(`Streamable HTTP MCP endpoint: http://localhost:${boundPort}/mcp`);
29903
29910
  await this.installStudioPlugin();
@@ -29920,13 +29927,20 @@ var RobloxStudioMCPServer = class {
29920
29927
  console.error(`Port ${basePort} is owned by MCP server v${primaryVersion}; this v${this.config.version} session forwards to it and leaves its Studio plugin installed. Close the older session to use v${this.config.version}; this session takes the port and installs its plugin once it is free.`);
29921
29928
  }
29922
29929
  const promotionIntervalMs = parseInt(process.env.ROBLOX_STUDIO_PROXY_PROMOTION_INTERVAL_MS || "5000");
29930
+ let promoting = false;
29923
29931
  promotionInterval = setInterval(async () => {
29932
+ if (promoting)
29933
+ return;
29934
+ promoting = true;
29924
29935
  let promoted = false;
29925
- const candidateBridge = new BridgeService();
29926
- const candidateTools = new RobloxStudioTools(candidateBridge);
29927
- const candidateApp = createHttpServer(candidateTools, candidateBridge, this.allowedToolNames, this.config, security);
29936
+ let candidateBridge;
29937
+ let candidateTools;
29928
29938
  try {
29929
- const result = await listenWithRetry(candidateApp, host, basePort, 1);
29939
+ const result = await listenWithFactory(() => {
29940
+ candidateBridge = new BridgeService();
29941
+ candidateTools = new RobloxStudioTools(candidateBridge);
29942
+ return createHttpServer(candidateTools, candidateBridge, this.allowedToolNames, this.config, security);
29943
+ }, host, basePort, 1);
29930
29944
  const oldBridge = this.bridge;
29931
29945
  const oldTools = this.tools;
29932
29946
  this.bridge = candidateBridge;
@@ -29936,7 +29950,7 @@ var RobloxStudioMCPServer = class {
29936
29950
  }
29937
29951
  httpHandle = result.server;
29938
29952
  boundPort = result.port;
29939
- primaryApp = candidateApp;
29953
+ primaryApp = result.app;
29940
29954
  bridgeMode = "primary";
29941
29955
  primaryApp.setMCPServerActive(true);
29942
29956
  console.error(`Promoted from proxy to primary on port ${boundPort}`);
@@ -29945,8 +29959,12 @@ var RobloxStudioMCPServer = class {
29945
29959
  promoted = true;
29946
29960
  await oldTools.dispose();
29947
29961
  } catch {
29948
- await candidateApp.cleanup().catch(() => {
29949
- });
29962
+ if (candidateTools && candidateTools !== this.tools) {
29963
+ await candidateTools.dispose().catch(() => {
29964
+ });
29965
+ }
29966
+ } finally {
29967
+ promoting = false;
29950
29968
  }
29951
29969
  if (promoted)
29952
29970
  await this.installStudioPlugin();
package/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@envnyx/robloxstudio-mcp",
3
- "version": "3.6.0",
4
- "description": "MCP server for testing, debugging, and controlling Roblox Studio from AI coding tools",
5
- "main": "dist/index.js",
6
- "type": "module",
7
- "engines": {
8
- "node": ">=22"
9
- },
10
- "bin": {
11
- "robloxstudio-mcp": "dist/index.js"
12
- },
13
- "files": [
14
- "dist/**/*",
15
- "studio-plugin/MCPPlugin.rbxmx"
16
- ],
17
- "scripts": {
18
- "build": "tsup",
19
- "prepack": "node ../../scripts/prepack.mjs",
20
- "postpack": "node ../../scripts/postpack.mjs"
21
- },
22
- "keywords": [
23
- "mcp",
24
- "roblox",
25
- "studio",
26
- "ai",
27
- "model-context-protocol",
28
- "game-development"
29
- ],
30
- "author": "",
31
- "license": "MIT",
32
- "repository": {
33
- "type": "git",
34
- "url": "git+https://github.com/envnyx/robloxstudio-mcp.git"
35
- },
36
- "homepage": "https://github.com/envnyx/robloxstudio-mcp#readme",
37
- "bugs": {
38
- "url": "https://github.com/envnyx/robloxstudio-mcp/issues"
39
- },
40
- "dependencies": {
41
- "@modelcontextprotocol/node": "^2.0.0",
42
- "@modelcontextprotocol/server": "^2.0.0",
43
- "express": "^4.18.2",
44
- "node-fetch": "^3.3.2",
45
- "ws": "^8.14.2"
46
- },
47
- "devDependencies": {
48
- "@chrrxs/robloxstudio-mcp-core": "*"
49
- },
50
- "publishConfig": {
51
- "access": "public"
52
- }
53
- }
1
+ {
2
+ "name": "@envnyx/robloxstudio-mcp",
3
+ "version": "3.6.1",
4
+ "description": "MCP server for testing, debugging, and controlling Roblox Studio from AI coding tools",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "bin": {
11
+ "robloxstudio-mcp": "dist/index.js"
12
+ },
13
+ "files": [
14
+ "dist/**/*",
15
+ "studio-plugin/MCPPlugin.rbxmx"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsup",
19
+ "prepack": "node ../../scripts/prepack.mjs",
20
+ "postpack": "node ../../scripts/postpack.mjs"
21
+ },
22
+ "keywords": [
23
+ "mcp",
24
+ "roblox",
25
+ "studio",
26
+ "ai",
27
+ "model-context-protocol",
28
+ "game-development"
29
+ ],
30
+ "author": "",
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/envnyx/robloxstudio-mcp.git"
35
+ },
36
+ "homepage": "https://github.com/envnyx/robloxstudio-mcp#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/envnyx/robloxstudio-mcp/issues"
39
+ },
40
+ "dependencies": {
41
+ "@modelcontextprotocol/node": "^2.0.0",
42
+ "@modelcontextprotocol/server": "^2.0.0",
43
+ "express": "^4.18.2",
44
+ "node-fetch": "^3.3.2",
45
+ "ws": "^8.14.2"
46
+ },
47
+ "devDependencies": {
48
+ "@chrrxs/robloxstudio-mcp-core": "*"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }
@@ -2841,9 +2841,9 @@ local function computeBridgeStamp()
2841
2841
  for i = 1, #combined do
2842
2842
  h = (h * 33 + (string.byte(combined, i))) % 2147483647
2843
2843
  end
2844
- -- "3.6.0" is replaced with the package version at package time
2844
+ -- "3.6.1" is replaced with the package version at package time
2845
2845
  -- (scripts/build-plugin.mjs injectVersion), so a release bump also restamps.
2846
- return `{tostring(h)}-3.6.0`
2846
+ return `{tostring(h)}-3.6.1`
2847
2847
  end
2848
2848
  local BRIDGE_STAMP = computeBridgeStamp()
2849
2849
  local function setSource(scriptInst, source)
@@ -13846,7 +13846,7 @@ return {
13846
13846
  <Properties>
13847
13847
  <string name="Name">State</string>
13848
13848
  <string name="Source"><![CDATA[-- Compiled with roblox-ts v3.0.0
13849
- local CURRENT_VERSION = "3.6.0"
13849
+ local CURRENT_VERSION = "3.6.1"
13850
13850
  local PLUGIN_VARIANT = "main"
13851
13851
  local BASE_PORT = 58741
13852
13852
  local SENSITIVE_DIAGNOSTIC_TERMS = { "token", "authorization", "bearer", "password", "cookie", "secret" }