@robthepcguy/rag-vault 1.5.2 → 1.5.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.
@@ -327,11 +327,19 @@ async function createHttpServerInternal(serverAccessor, config, configRouter) {
327
327
  * Start HTTP server
328
328
  */
329
329
  function startServer(app, port) {
330
- return new Promise((resolve) => {
331
- app.listen(port, () => {
330
+ return new Promise((resolve, reject) => {
331
+ const server = app.listen(port);
332
+ const onError = (error) => {
333
+ server.off('listening', onListening);
334
+ reject(error);
335
+ };
336
+ const onListening = () => {
337
+ server.off('error', onError);
332
338
  console.log(`Web server running at http://localhost:${port}`);
333
339
  resolve();
334
- });
340
+ };
341
+ server.once('error', onError);
342
+ server.once('listening', onListening);
335
343
  });
336
344
  }
337
345
  //# sourceMappingURL=http-server.js.map
package/dist/web/index.js CHANGED
@@ -52,17 +52,23 @@ const index_js_1 = require("./middleware/index.js");
52
52
  console.error('Cleaning up rate limiter...');
53
53
  (0, index_js_1.stopRateLimiterCleanup)();
54
54
  });
55
+ function isErrnoException(error) {
56
+ return (typeof error === 'object' &&
57
+ error !== null &&
58
+ 'code' in error &&
59
+ typeof error.code === 'string');
60
+ }
55
61
  /**
56
62
  * Entry point - Start RAG Web Server
57
63
  */
58
64
  async function main() {
65
+ const port = Number.parseInt(process.env['WEB_PORT'] || '3000', 10);
59
66
  try {
60
67
  // Dynamic imports to avoid loading heavy modules at CLI parse time
61
68
  const { RAGServer } = await Promise.resolve().then(() => __importStar(require('../server/index.js')));
62
69
  const { createHttpServerWithManager, startServer } = await Promise.resolve().then(() => __importStar(require('./http-server.js')));
63
70
  const { DatabaseManager } = await Promise.resolve().then(() => __importStar(require('./database-manager.js')));
64
71
  // Configuration from environment
65
- const port = Number.parseInt(process.env['WEB_PORT'] || '3000', 10);
66
72
  const uploadDir = process.env['UPLOAD_DIR'] || './uploads/';
67
73
  // Determine static files directory
68
74
  // Check multiple locations: cwd for dev, package dir for npx/global install
@@ -113,6 +119,10 @@ async function main() {
113
119
  }
114
120
  }
115
121
  catch (error) {
122
+ if (isErrnoException(error) && error.code === 'EADDRINUSE') {
123
+ console.error(`Port ${port} is already in use. Close the other RAG Vault web server or run with a different port (example: WEB_PORT=3001 npx @robthepcguy/rag-vault web).`);
124
+ process.exit(1);
125
+ }
116
126
  console.error('Failed to start RAG Web Server:', error);
117
127
  process.exit(1);
118
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robthepcguy/rag-vault",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Local RAG MCP Server - Easy-to-setup document search with minimal configuration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {