@softtechai/quickmcp 1.0.11 → 1.0.12

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": "@softtechai/quickmcp",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "An application to generate MCP servers from various data sources and test them",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -3,6 +3,7 @@
3
3
  const path = require('path');
4
4
  const fs = require('fs');
5
5
  const os = require('os');
6
+ const net = require('net');
6
7
 
7
8
  // Use the current working directory provided by the caller.
8
9
  // Do not change directories; keep paths relative to this script.
@@ -58,8 +59,27 @@ if (process.env.QUICKMCP_ENABLE_WEB === '1') {
58
59
  const uploadsDir = path.join(runDir, 'uploads');
59
60
  try { fs.mkdirSync(uploadsDir, { recursive: true }); } catch {}
60
61
  if (!process.env.QUICKMCP_UPLOAD_DIR) process.env.QUICKMCP_UPLOAD_DIR = uploadsDir;
61
- // This require starts the Express app and integrated MCP sidecar
62
- require('./dist/web/server.js');
62
+ // Only start Web UI if preferred port is actually free.
63
+ const preferredPort = parseInt(process.env.PORT || '3000', 10);
64
+ const probe = net.createServer();
65
+ probe.once('error', (err) => {
66
+ if (err && (err.code === 'EADDRINUSE' || err.code === 'EACCES')) {
67
+ // Port is busy or not permitted; skip starting Web UI to avoid crashing Claude session
68
+ return;
69
+ }
70
+ // For other errors, still try starting server; better to attempt than silently skip for unknown cases
71
+ try { require('./dist/web/server.js'); } catch (e) { console.error('[QuickMCP] Failed to start Web UI:', e && e.message); }
72
+ });
73
+ probe.once('listening', () => {
74
+ probe.close(() => {
75
+ try { require('./dist/web/server.js'); } catch (e) { console.error('[QuickMCP] Failed to start Web UI:', e && e.message); }
76
+ });
77
+ });
78
+ try {
79
+ probe.listen(preferredPort, '127.0.0.1');
80
+ } catch (_e) {
81
+ // If probing throws synchronously (rare), just skip UI
82
+ }
63
83
  } catch (e) {
64
84
  console.error('[QuickMCP] Failed to start Web UI:', e && e.message);
65
85
  }