@mctx-ai/mcp-dev 0.5.3 → 0.5.5

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": "@mctx-ai/mcp-dev",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Local development server for @mctx-ai/mcp-server with hot reload",
5
5
  "type": "module",
6
6
  "main": "./src/cli.js",
@@ -40,6 +40,6 @@
40
40
  "provenance": true
41
41
  },
42
42
  "peerDependencies": {
43
- "@mctx-ai/mcp-server": "0.5.3"
43
+ "@mctx-ai/mcp-server": "0.6.0"
44
44
  }
45
45
  }
package/src/cli.js CHANGED
@@ -55,9 +55,7 @@ const port =
55
55
  : parseInt(process.env.PORT || "3000", 10);
56
56
 
57
57
  if (isNaN(port) || port < 1 || port > 65535) {
58
- console.error(
59
- `Error: Invalid port "${args[portFlagIndex + 1] || process.env.PORT}"`,
60
- );
58
+ console.error(`Error: Invalid port "${args[portFlagIndex + 1] || process.env.PORT}"`);
61
59
  process.exit(1);
62
60
  }
63
61
 
@@ -81,9 +79,7 @@ try {
81
79
  // Handle EADDRINUSE port conflicts (Fix #1)
82
80
  if (error.code === "EADDRINUSE") {
83
81
  console.error(`\nError: Port ${port} is already in use.`);
84
- console.error(
85
- `Try a different port: npx mctx-dev ${entryFile} --port ${port + 1}`,
86
- );
82
+ console.error(`Try a different port: npx mctx-dev ${entryFile} --port ${port + 1}`);
87
83
  process.exit(1);
88
84
  }
89
85
 
package/src/server.js CHANGED
@@ -34,9 +34,7 @@ function timestamp() {
34
34
  * Log with timestamp and color (Fix #8: separated framework vs request logs)
35
35
  */
36
36
  function log(message, color = colors.reset) {
37
- console.log(
38
- `${colors.gray}[${timestamp()}]${colors.reset} ${color}${message}${colors.reset}`,
39
- );
37
+ console.log(`${colors.gray}[${timestamp()}]${colors.reset} ${color}${message}${colors.reset}`);
40
38
  }
41
39
 
42
40
  /**
@@ -141,15 +139,11 @@ export async function startDevServer(entryUrl, port) {
141
139
  app = appModule.default;
142
140
 
143
141
  if (!app) {
144
- throw new Error(
145
- "Entry file must have a default export (the app instance)",
146
- );
142
+ throw new Error("Entry file must have a default export (the app instance)");
147
143
  }
148
144
 
149
145
  if (typeof app.fetch !== "function") {
150
- throw new Error(
151
- "App must have a fetch method (created via createServer())",
152
- );
146
+ throw new Error("App must have a fetch method (created via createServer())");
153
147
  }
154
148
 
155
149
  return true;
@@ -166,17 +160,12 @@ export async function startDevServer(entryUrl, port) {
166
160
  logFramework(`Failed to load ${entryUrl.split("/").pop()}`, colors.red);
167
161
 
168
162
  if (error instanceof SyntaxError) {
169
- console.error(
170
- `${colors.red}${colors.bright}SyntaxError:${colors.reset} ${error.message}`,
171
- );
163
+ console.error(`${colors.red}${colors.bright}SyntaxError:${colors.reset} ${error.message}`);
172
164
  if (error.stack) {
173
165
  const stackLines = error.stack.split("\n").slice(1, 4);
174
166
  console.error(colors.dim + stackLines.join("\n") + colors.reset);
175
167
  }
176
- logFramework(
177
- "Watching for changes... fix the error and save to retry.",
178
- colors.yellow,
179
- );
168
+ logFramework("Watching for changes... fix the error and save to retry.", colors.yellow);
180
169
  } else {
181
170
  console.error(formatError(error, { method: "initial-load" }));
182
171
  }
@@ -192,9 +181,7 @@ export async function startDevServer(entryUrl, port) {
192
181
  logFramework("Reload failed", colors.red);
193
182
 
194
183
  if (error instanceof SyntaxError) {
195
- console.error(
196
- `${colors.red}${colors.bright}SyntaxError:${colors.reset} ${error.message}`,
197
- );
184
+ console.error(`${colors.red}${colors.bright}SyntaxError:${colors.reset} ${error.message}`);
198
185
  if (error.stack) {
199
186
  const stackLines = error.stack.split("\n").slice(1, 4);
200
187
  console.error(colors.dim + stackLines.join("\n") + colors.reset);
@@ -215,8 +202,7 @@ export async function startDevServer(entryUrl, port) {
215
202
  jsonrpc: "2.0",
216
203
  error: {
217
204
  code: -32000,
218
- message:
219
- "Server initialization failed - fix syntax errors and save to retry",
205
+ message: "Server initialization failed - fix syntax errors and save to retry",
220
206
  },
221
207
  id: null,
222
208
  }),
@@ -280,8 +266,7 @@ export async function startDevServer(entryUrl, port) {
280
266
  rpcRequest = JSON.parse(body);
281
267
  } catch (error) {
282
268
  // Fix #9: include body snippet in parse error
283
- const bodySnippet =
284
- body.length > 100 ? body.substring(0, 100) + "..." : body;
269
+ const bodySnippet = body.length > 100 ? body.substring(0, 100) + "..." : body;
285
270
 
286
271
  res.writeHead(400, { "Content-Type": "application/json" });
287
272
  res.end(
@@ -297,9 +282,7 @@ export async function startDevServer(entryUrl, port) {
297
282
  );
298
283
 
299
284
  log(`${colors.red}✗${colors.reset} Parse error`, colors.red);
300
- console.error(
301
- `${colors.dim}Body snippet: ${bodySnippet}${colors.reset}`,
302
- );
285
+ console.error(`${colors.dim}Body snippet: ${bodySnippet}${colors.reset}`);
303
286
  return;
304
287
  }
305
288
 
@@ -308,11 +291,7 @@ export async function startDevServer(entryUrl, port) {
308
291
  log(`${colors.cyan}→${colors.reset} ${methodDisplay}`, colors.dim);
309
292
 
310
293
  // Verbose logging: log full request body (skip initialize/initialized)
311
- if (
312
- isVerbose &&
313
- rpcRequest.method !== "initialize" &&
314
- rpcRequest.method !== "initialized"
315
- ) {
294
+ if (isVerbose && rpcRequest.method !== "initialize" && rpcRequest.method !== "initialized") {
316
295
  console.log(`${colors.dim}[verbose] Request:${colors.reset}`);
317
296
  console.log(JSON.stringify(rpcRequest, null, 2));
318
297
  }
@@ -334,12 +313,8 @@ export async function startDevServer(entryUrl, port) {
334
313
  res.end(responseText);
335
314
 
336
315
  // Log response
337
- const statusColor =
338
- statusCode >= 200 && statusCode < 300 ? colors.green : colors.red;
339
- log(
340
- `${statusColor}←${colors.reset} ${statusCode} (${elapsed}ms)`,
341
- colors.dim,
342
- );
316
+ const statusColor = statusCode >= 200 && statusCode < 300 ? colors.green : colors.red;
317
+ log(`${statusColor}←${colors.reset} ${statusCode} (${elapsed}ms)`, colors.dim);
343
318
 
344
319
  // Verbose logging: log full response body (skip initialize/initialized)
345
320
  if (
@@ -371,10 +346,7 @@ export async function startDevServer(entryUrl, port) {
371
346
  const errorResponse = JSON.parse(responseText);
372
347
  if (errorResponse.error) {
373
348
  console.error(
374
- formatError(
375
- new Error(errorResponse.error.message || "Unknown error"),
376
- rpcRequest,
377
- ),
349
+ formatError(new Error(errorResponse.error.message || "Unknown error"), rpcRequest),
378
350
  );
379
351
  }
380
352
  } catch {