robloxstudio-mcp 2.2.2 → 2.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robloxstudio-mcp",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "MCP Server for Roblox Studio Integration - Access Studio data, scripts, and objects through AI tools",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -212,8 +212,16 @@ local function pollForRequests(connIndex)
212
212
  end
213
213
  if data.request and mcpConnected then
214
214
  task.spawn(function()
215
- local response = processRequest(data.request)
216
- sendResponse(conn, data.requestId, response)
215
+ local ok, response = pcall(function()
216
+ return processRequest(data.request)
217
+ end)
218
+ if ok then
219
+ sendResponse(conn, data.requestId, response)
220
+ else
221
+ sendResponse(conn, data.requestId, {
222
+ error = tostring(response),
223
+ })
224
+ end
217
225
  end)
218
226
  end
219
227
  elseif conn.isActive then
@@ -3087,13 +3095,18 @@ local function startPlaytest(requestData)
3087
3095
  testError = nil
3088
3096
  cleanupStopListener()
3089
3097
  if serverPort ~= nil and serverPort > 0 then
3090
- -- HttpEnabled is typed readonly but writable from plugin context
3091
- HttpService.HttpEnabled = true
3092
- local listener = Instance.new("Script")
3093
- listener.Name = STOP_LISTENER_NAME
3094
- listener.Source = buildStopListenerSource(serverPort)
3095
- listener.Parent = ServerScriptService
3096
- stopListenerScript = listener
3098
+ local injected, injErr = pcall(function()
3099
+ -- HttpEnabled is typed readonly but writable from plugin context
3100
+ HttpService.HttpEnabled = true
3101
+ local listener = Instance.new("Script")
3102
+ listener.Name = STOP_LISTENER_NAME
3103
+ listener.Source = buildStopListenerSource(serverPort)
3104
+ listener.Parent = ServerScriptService
3105
+ stopListenerScript = listener
3106
+ end)
3107
+ if not injected then
3108
+ warn(`[MCP] Failed to inject stop listener: {injErr}`)
3109
+ end
3097
3110
  end
3098
3111
  logConnection = LogService.MessageOut:Connect(function(message, messageType)
3099
3112
  local _outputBuffer = outputBuffer
@@ -3173,7 +3186,7 @@ return {
3173
3186
  <Properties>
3174
3187
  <string name="Name">State</string>
3175
3188
  <string name="Source"><![CDATA[-- Compiled with roblox-ts v3.0.0
3176
- local CURRENT_VERSION = "2.2.2"
3189
+ local CURRENT_VERSION = "2.2.3"
3177
3190
  local MAX_CONNECTIONS = 5
3178
3191
  local BASE_PORT = 58741
3179
3192
  local activeTabIndex = 0
@@ -163,8 +163,12 @@ function pollForRequests(connIndex: number) {
163
163
 
164
164
  if (data.request && mcpConnected) {
165
165
  task.spawn(() => {
166
- const response = processRequest(data.request!);
167
- sendResponse(conn, data.requestId!, response);
166
+ const [ok, response] = pcall(() => processRequest(data.request!));
167
+ if (ok) {
168
+ sendResponse(conn, data.requestId!, response);
169
+ } else {
170
+ sendResponse(conn, data.requestId!, { error: tostring(response) });
171
+ }
168
172
  });
169
173
  }
170
174
  } else if (conn.isActive) {
@@ -77,14 +77,19 @@ function startPlaytest(requestData: Record<string, unknown>) {
77
77
  cleanupStopListener();
78
78
 
79
79
  if (serverPort !== undefined && serverPort > 0) {
80
- // HttpEnabled is typed readonly but writable from plugin context
81
- (HttpService as unknown as { HttpEnabled: boolean }).HttpEnabled = true;
82
-
83
- const listener = new Instance("Script");
84
- listener.Name = STOP_LISTENER_NAME;
85
- listener.Source = buildStopListenerSource(serverPort);
86
- listener.Parent = ServerScriptService;
87
- stopListenerScript = listener;
80
+ const [injected, injErr] = pcall(() => {
81
+ // HttpEnabled is typed readonly but writable from plugin context
82
+ (HttpService as unknown as { HttpEnabled: boolean }).HttpEnabled = true;
83
+
84
+ const listener = new Instance("Script");
85
+ listener.Name = STOP_LISTENER_NAME;
86
+ listener.Source = buildStopListenerSource(serverPort);
87
+ listener.Parent = ServerScriptService;
88
+ stopListenerScript = listener;
89
+ });
90
+ if (!injected) {
91
+ warn(`[MCP] Failed to inject stop listener: ${injErr}`);
92
+ }
88
93
  }
89
94
 
90
95
  logConnection = LogService.MessageOut.Connect((message, messageType) => {