@lanonasis/cli 3.6.5 → 3.7.0

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.
Files changed (43) hide show
  1. package/README.md +19 -2
  2. package/dist/commands/api-keys.d.ts +2 -1
  3. package/dist/commands/api-keys.js +73 -78
  4. package/dist/commands/auth.js +244 -177
  5. package/dist/commands/completion.js +31 -39
  6. package/dist/commands/config.js +162 -201
  7. package/dist/commands/enhanced-memory.js +11 -17
  8. package/dist/commands/guide.js +79 -88
  9. package/dist/commands/init.js +14 -20
  10. package/dist/commands/mcp.d.ts +10 -0
  11. package/dist/commands/mcp.js +215 -156
  12. package/dist/commands/memory.js +77 -83
  13. package/dist/commands/organization.js +15 -21
  14. package/dist/commands/topics.js +52 -58
  15. package/dist/core/achievements.js +19 -26
  16. package/dist/core/architecture.js +42 -59
  17. package/dist/core/dashboard.js +71 -81
  18. package/dist/core/error-handler.js +30 -39
  19. package/dist/core/power-mode.js +46 -53
  20. package/dist/core/progress.js +35 -44
  21. package/dist/core/welcome.js +56 -64
  22. package/dist/enhanced-cli.js +49 -58
  23. package/dist/index-simple.js +75 -113
  24. package/dist/index.js +64 -69
  25. package/dist/mcp/access-control.js +13 -17
  26. package/dist/mcp/client/enhanced-client.js +17 -28
  27. package/dist/mcp/enhanced-server.js +10 -14
  28. package/dist/mcp/logger.js +3 -7
  29. package/dist/mcp/memory-state.js +13 -17
  30. package/dist/mcp/schemas/tool-schemas.d.ts +16 -16
  31. package/dist/mcp/schemas/tool-schemas.js +122 -126
  32. package/dist/mcp/server/lanonasis-server.js +66 -57
  33. package/dist/mcp/transports/transport-manager.js +18 -25
  34. package/dist/mcp/vector-store.js +6 -10
  35. package/dist/mcp-server.js +23 -27
  36. package/dist/utils/api.js +21 -27
  37. package/dist/utils/config.d.ts +2 -1
  38. package/dist/utils/config.js +65 -78
  39. package/dist/utils/formatting.js +6 -14
  40. package/dist/utils/hash-utils.d.ts +23 -0
  41. package/dist/utils/hash-utils.js +37 -0
  42. package/dist/utils/mcp-client.js +76 -117
  43. package/package.json +36 -5
@@ -1,19 +1,13 @@
1
- "use strict";
2
1
  /**
3
2
  * Lanonasis MCP Server Implementation
4
3
  * Provides MCP protocol access to Lanonasis MaaS functionality
5
4
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.LanonasisMCPServer = void 0;
11
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
12
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
13
- const config_js_1 = require("../../utils/config.js");
14
- const api_js_1 = require("../../utils/api.js");
15
- const chalk_1 = __importDefault(require("chalk"));
16
- class LanonasisMCPServer {
5
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { CLIConfig } from '../../utils/config.js';
8
+ import { APIClient } from '../../utils/api.js';
9
+ import chalk from 'chalk';
10
+ export class LanonasisMCPServer {
17
11
  server;
18
12
  config;
19
13
  apiClient;
@@ -32,7 +26,7 @@ class LanonasisMCPServer {
32
26
  // Initialize transport settings
33
27
  this.enableFallback = options.enableTransportFallback !== false; // Default to true
34
28
  // Initialize server with metadata
35
- this.server = new index_js_1.Server({
29
+ this.server = new Server({
36
30
  name: options.name || "lanonasis-maas-server",
37
31
  version: options.version || "3.0.1"
38
32
  }, {
@@ -43,8 +37,8 @@ class LanonasisMCPServer {
43
37
  }
44
38
  });
45
39
  // Initialize config and API client
46
- this.config = new config_js_1.CLIConfig();
47
- this.apiClient = new api_js_1.APIClient();
40
+ this.config = new CLIConfig();
41
+ this.apiClient = new APIClient();
48
42
  // Note: registerTools is now async and called in initialize()
49
43
  // Setup error handling
50
44
  this.setupErrorHandling();
@@ -66,7 +60,7 @@ class LanonasisMCPServer {
66
60
  const apiUrl = this.config.getApiUrl();
67
61
  const token = this.config.getToken();
68
62
  if (apiUrl) {
69
- this.apiClient = new api_js_1.APIClient();
63
+ this.apiClient = new APIClient();
70
64
  // APIClient will use the config internally
71
65
  }
72
66
  // Register tools, resources, and prompts after config is loaded
@@ -76,10 +70,10 @@ class LanonasisMCPServer {
76
70
  // Start connection cleanup monitoring
77
71
  this.startConnectionCleanup();
78
72
  if (this.options.verbose) {
79
- console.log(chalk_1.default.cyan('🚀 Lanonasis MCP Server initialized'));
80
- console.log(chalk_1.default.gray(`API URL: ${apiUrl}`));
81
- console.log(chalk_1.default.gray(`Authenticated: ${token ? 'Yes' : 'No'}`));
82
- console.log(chalk_1.default.gray(`Max connections: ${this.maxConnections}`));
73
+ console.log(chalk.cyan('🚀 Lanonasis MCP Server initialized'));
74
+ console.log(chalk.gray(`API URL: ${apiUrl}`));
75
+ console.log(chalk.gray(`Authenticated: ${token ? 'Yes' : 'No'}`));
76
+ console.log(chalk.gray(`Max connections: ${this.maxConnections}`));
83
77
  }
84
78
  }
85
79
  /**
@@ -859,7 +853,7 @@ Please choose an option (1-4):`
859
853
  // Check if we've reached the maximum number of connections
860
854
  if (this.connectionPool.size >= this.maxConnections) {
861
855
  if (this.options.verbose) {
862
- console.log(chalk_1.default.yellow(`⚠️ Maximum connections (${this.maxConnections}) reached, rejecting new connection`));
856
+ console.log(chalk.yellow(`⚠️ Maximum connections (${this.maxConnections}) reached, rejecting new connection`));
863
857
  }
864
858
  return false;
865
859
  }
@@ -873,7 +867,7 @@ Please choose an option (1-4):`
873
867
  };
874
868
  this.connectionPool.set(clientId, connection);
875
869
  if (this.options.verbose) {
876
- console.log(chalk_1.default.cyan(`✅ Added connection ${clientId} (${transport}) - Total: ${this.connectionPool.size}`));
870
+ console.log(chalk.cyan(`✅ Added connection ${clientId} (${transport}) - Total: ${this.connectionPool.size}`));
877
871
  }
878
872
  return true;
879
873
  }
@@ -886,7 +880,7 @@ Please choose an option (1-4):`
886
880
  this.connectionPool.delete(clientId);
887
881
  if (this.options.verbose) {
888
882
  const uptime = Date.now() - connection.connectedAt.getTime();
889
- console.log(chalk_1.default.gray(`🔌 Removed connection ${clientId} (uptime: ${Math.round(uptime / 1000)}s) - Total: ${this.connectionPool.size}`));
883
+ console.log(chalk.gray(`🔌 Removed connection ${clientId} (uptime: ${Math.round(uptime / 1000)}s) - Total: ${this.connectionPool.size}`));
890
884
  }
891
885
  }
892
886
  }
@@ -907,7 +901,7 @@ Please choose an option (1-4):`
907
901
  if (connection) {
908
902
  connection.authenticated = true;
909
903
  if (this.options.verbose) {
910
- console.log(chalk_1.default.green(`🔐 Connection ${clientId} authenticated`));
904
+ console.log(chalk.green(`🔐 Connection ${clientId} authenticated`));
911
905
  }
912
906
  }
913
907
  }
@@ -967,7 +961,7 @@ Please choose an option (1-4):`
967
961
  for (const clientId of staleConnections) {
968
962
  this.removeConnection(clientId);
969
963
  if (this.options.verbose) {
970
- console.log(chalk_1.default.yellow(`🧹 Cleaned up stale connection: ${clientId}`));
964
+ console.log(chalk.yellow(`🧹 Cleaned up stale connection: ${clientId}`));
971
965
  }
972
966
  }
973
967
  }
@@ -1081,7 +1075,7 @@ Please choose an option (1-4):`
1081
1075
  }
1082
1076
  catch (error) {
1083
1077
  if (this.options.verbose) {
1084
- console.log(chalk_1.default.yellow(`⚠️ Stored credentials validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
1078
+ console.log(chalk.yellow(`⚠️ Stored credentials validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
1085
1079
  }
1086
1080
  return false;
1087
1081
  }
@@ -1110,16 +1104,32 @@ Please choose an option (1-4):`
1110
1104
  headers['Authorization'] = `Bearer ${token}`;
1111
1105
  headers['X-Auth-Method'] = 'jwt';
1112
1106
  }
1113
- // Validate against server with health endpoint
1114
- await axios.get(`${authBase}/api/v1/health`, {
1115
- headers,
1116
- timeout: 10000
1117
- });
1118
- return true;
1107
+ const normalizedBase = authBase.replace(/\/$/, '');
1108
+ const endpoints = [
1109
+ `${normalizedBase}/health`,
1110
+ `${normalizedBase}/api/v1/health`
1111
+ ];
1112
+ let lastError;
1113
+ for (const endpoint of endpoints) {
1114
+ try {
1115
+ await axios.get(endpoint, {
1116
+ headers,
1117
+ timeout: 10000
1118
+ });
1119
+ return true;
1120
+ }
1121
+ catch (error) {
1122
+ lastError = error;
1123
+ }
1124
+ }
1125
+ if (lastError instanceof Error) {
1126
+ throw lastError;
1127
+ }
1128
+ throw new Error('Auth health endpoints unreachable');
1119
1129
  }
1120
1130
  catch (error) {
1121
1131
  if (this.options.verbose) {
1122
- console.log(chalk_1.default.yellow(`⚠️ Credential validation failed: ${error.response?.status || error.message}`));
1132
+ console.log(chalk.yellow(`⚠️ Credential validation failed: ${error.response?.status || error.message}`));
1123
1133
  }
1124
1134
  return false;
1125
1135
  }
@@ -1222,7 +1232,7 @@ Please choose an option (1-4):`
1222
1232
  };
1223
1233
  this.transportFailures.set(transport, failure);
1224
1234
  if (this.options.verbose) {
1225
- console.log(chalk_1.default.yellow(`⚠️ Transport ${transport} failure #${failure.count}: ${error instanceof Error ? error.message : 'Unknown error'}`));
1235
+ console.log(chalk.yellow(`⚠️ Transport ${transport} failure #${failure.count}: ${error instanceof Error ? error.message : 'Unknown error'}`));
1226
1236
  }
1227
1237
  }
1228
1238
  /**
@@ -1242,7 +1252,7 @@ Please choose an option (1-4):`
1242
1252
  for (const transport of fallbackOrder) {
1243
1253
  if (await this.checkTransportAvailability(transport)) {
1244
1254
  if (this.options.verbose) {
1245
- console.log(chalk_1.default.cyan(`🔄 Falling back to ${transport} transport`));
1255
+ console.log(chalk.cyan(`🔄 Falling back to ${transport} transport`));
1246
1256
  }
1247
1257
  return transport;
1248
1258
  }
@@ -1334,8 +1344,8 @@ Please choose an option (1-4):`
1334
1344
  // Try next available transport
1335
1345
  const nextTransport = await this.getBestAvailableTransport();
1336
1346
  if (nextTransport && nextTransport !== availableTransport) {
1337
- console.log(chalk_1.default.yellow(`⚠️ ${transportError.message}`));
1338
- console.log(chalk_1.default.cyan(`🔄 Attempting fallback to ${nextTransport} transport...`));
1347
+ console.log(chalk.yellow(`⚠️ ${transportError.message}`));
1348
+ console.log(chalk.cyan(`🔄 Attempting fallback to ${nextTransport} transport...`));
1339
1349
  try {
1340
1350
  await this.startTransport(nextTransport);
1341
1351
  return nextTransport;
@@ -1355,7 +1365,7 @@ Please choose an option (1-4):`
1355
1365
  async startTransport(transport) {
1356
1366
  switch (transport) {
1357
1367
  case 'stdio':
1358
- this.transport = new stdio_js_1.StdioServerTransport();
1368
+ this.transport = new StdioServerTransport();
1359
1369
  await this.server.connect(this.transport);
1360
1370
  break;
1361
1371
  case 'websocket':
@@ -1405,16 +1415,16 @@ Please choose an option (1-4):`
1405
1415
  */
1406
1416
  setupErrorHandling() {
1407
1417
  process.on('SIGINT', async () => {
1408
- console.log(chalk_1.default.yellow('\n⚠️ Shutting down MCP server...'));
1418
+ console.log(chalk.yellow('\n⚠️ Shutting down MCP server...'));
1409
1419
  await this.stop();
1410
1420
  process.exit(0);
1411
1421
  });
1412
1422
  process.on('uncaughtException', (error) => {
1413
- console.error(chalk_1.default.red('Uncaught exception:'), error);
1423
+ console.error(chalk.red('Uncaught exception:'), error);
1414
1424
  process.exit(1);
1415
1425
  });
1416
1426
  process.on('unhandledRejection', (reason, promise) => {
1417
- console.error(chalk_1.default.red('Unhandled rejection at:'), promise, 'reason:', reason);
1427
+ console.error(chalk.red('Unhandled rejection at:'), promise, 'reason:', reason);
1418
1428
  });
1419
1429
  }
1420
1430
  /**
@@ -1432,30 +1442,30 @@ Please choose an option (1-4):`
1432
1442
  version: '1.0.0'
1433
1443
  });
1434
1444
  if (this.options.verbose) {
1435
- console.log(chalk_1.default.green('✅ Lanonasis MCP Server started'));
1436
- console.log(chalk_1.default.gray(`Active transport: ${activeTransport}`));
1437
- console.log(chalk_1.default.gray('Waiting for client connections...'));
1445
+ console.log(chalk.green('✅ Lanonasis MCP Server started'));
1446
+ console.log(chalk.gray(`Active transport: ${activeTransport}`));
1447
+ console.log(chalk.gray('Waiting for client connections...'));
1438
1448
  if (this.enableFallback) {
1439
- console.log(chalk_1.default.gray('Transport fallback: enabled'));
1449
+ console.log(chalk.gray('Transport fallback: enabled'));
1440
1450
  }
1441
1451
  }
1442
1452
  // Keep the process alive
1443
1453
  process.stdin.resume();
1444
1454
  }
1445
1455
  catch (error) {
1446
- console.error(chalk_1.default.red('❌ Failed to start MCP Server:'));
1447
- console.error(chalk_1.default.red(error instanceof Error ? error.message : 'Unknown error'));
1456
+ console.error(chalk.red('❌ Failed to start MCP Server:'));
1457
+ console.error(chalk.red(error instanceof Error ? error.message : 'Unknown error'));
1448
1458
  if (this.options.verbose) {
1449
- console.log(chalk_1.default.yellow('\n🔧 Troubleshooting tips:'));
1450
- console.log(chalk_1.default.cyan('• Check if all required dependencies are installed'));
1451
- console.log(chalk_1.default.cyan('• Verify network connectivity and firewall settings'));
1452
- console.log(chalk_1.default.cyan('• Try enabling transport fallback: --enable-fallback'));
1453
- console.log(chalk_1.default.cyan('• Use --verbose for detailed error information'));
1459
+ console.log(chalk.yellow('\n🔧 Troubleshooting tips:'));
1460
+ console.log(chalk.cyan('• Check if all required dependencies are installed'));
1461
+ console.log(chalk.cyan('• Verify network connectivity and firewall settings'));
1462
+ console.log(chalk.cyan('• Try enabling transport fallback: --enable-fallback'));
1463
+ console.log(chalk.cyan('• Use --verbose for detailed error information'));
1454
1464
  const transportStatus = this.getTransportStatus();
1455
1465
  if (Object.keys(transportStatus.transportFailures).length > 0) {
1456
- console.log(chalk_1.default.yellow('\n📊 Transport failure history:'));
1466
+ console.log(chalk.yellow('\n📊 Transport failure history:'));
1457
1467
  for (const [transport, failure] of Object.entries(transportStatus.transportFailures)) {
1458
- console.log(chalk_1.default.gray(` ${transport}: ${failure.count} failures (last: ${failure.lastFailure})`));
1468
+ console.log(chalk.gray(` ${transport}: ${failure.count} failures (last: ${failure.lastFailure})`));
1459
1469
  }
1460
1470
  }
1461
1471
  }
@@ -1475,7 +1485,7 @@ Please choose an option (1-4):`
1475
1485
  this.transport = null;
1476
1486
  }
1477
1487
  if (this.options.verbose) {
1478
- console.log(chalk_1.default.gray('MCP Server stopped'));
1488
+ console.log(chalk.gray('MCP Server stopped'));
1479
1489
  }
1480
1490
  }
1481
1491
  /**
@@ -1491,7 +1501,6 @@ Please choose an option (1-4):`
1491
1501
  return new Map(this.connectionPool);
1492
1502
  }
1493
1503
  }
1494
- exports.LanonasisMCPServer = LanonasisMCPServer;
1495
1504
  // CLI entry point
1496
1505
  if (import.meta.url === `file://${process.argv[1]}`) {
1497
1506
  const server = new LanonasisMCPServer({
@@ -1500,7 +1509,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
1500
1509
  token: process.env.LANONASIS_TOKEN
1501
1510
  });
1502
1511
  server.start().catch((error) => {
1503
- console.error(chalk_1.default.red('Failed to start server:'), error);
1512
+ console.error(chalk.red('Failed to start server:'), error);
1504
1513
  process.exit(1);
1505
1514
  });
1506
1515
  }
@@ -1,21 +1,15 @@
1
- "use strict";
2
1
  /**
3
2
  * MCP Transport Manager
4
3
  * Handles multiple transport types for MCP connections
5
4
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.transportManager = exports.MCPTransportManager = void 0;
11
- const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
12
- const events_1 = require("events");
13
- const ws_1 = __importDefault(require("ws"));
14
- const chalk_1 = __importDefault(require("chalk"));
5
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
6
+ import { EventEmitter } from 'events';
7
+ import WebSocket from 'ws';
8
+ import chalk from 'chalk';
15
9
  /**
16
10
  * StdIO Transport wrapper
17
11
  */
18
- class StdioTransport extends events_1.EventEmitter {
12
+ class StdioTransport extends EventEmitter {
19
13
  transport;
20
14
  connected = false;
21
15
  constructor(config) {
@@ -23,7 +17,7 @@ class StdioTransport extends events_1.EventEmitter {
23
17
  if (!config.command) {
24
18
  throw new Error('Command required for stdio transport');
25
19
  }
26
- this.transport = new stdio_js_1.StdioClientTransport({
20
+ this.transport = new StdioClientTransport({
27
21
  command: config.command,
28
22
  args: config.args || []
29
23
  });
@@ -50,7 +44,7 @@ class StdioTransport extends events_1.EventEmitter {
50
44
  /**
51
45
  * HTTP Transport wrapper
52
46
  */
53
- class HttpTransport extends events_1.EventEmitter {
47
+ class HttpTransport extends EventEmitter {
54
48
  url;
55
49
  headers;
56
50
  connected = false;
@@ -118,7 +112,7 @@ class HttpTransport extends events_1.EventEmitter {
118
112
  /**
119
113
  * WebSocket Transport wrapper
120
114
  */
121
- class WebSocketTransport extends events_1.EventEmitter {
115
+ class WebSocketTransport extends EventEmitter {
122
116
  ws = null;
123
117
  url;
124
118
  connected = false;
@@ -153,14 +147,14 @@ class WebSocketTransport extends events_1.EventEmitter {
153
147
  async connect() {
154
148
  return new Promise((resolve, reject) => {
155
149
  try {
156
- this.ws = new ws_1.default(this.url, {
150
+ this.ws = new WebSocket(this.url, {
157
151
  headers: this.headers
158
152
  });
159
153
  this.ws.on('open', () => {
160
154
  this.connected = true;
161
155
  this.reconnectAttempts = 0;
162
156
  this.emit('connected');
163
- console.log(chalk_1.default.green(`✅ WebSocket connected to ${this.url}`));
157
+ console.log(chalk.green(`✅ WebSocket connected to ${this.url}`));
164
158
  resolve();
165
159
  });
166
160
  this.ws.on('message', (data) => {
@@ -207,10 +201,10 @@ class WebSocketTransport extends events_1.EventEmitter {
207
201
  const delay = this.reconnectConfig?.delay || 5000;
208
202
  const backoff = Math.min(delay * Math.pow(2, this.reconnectAttempts), 30000);
209
203
  this.reconnectAttempts++;
210
- console.log(chalk_1.default.yellow(`⏳ Reconnecting WebSocket in ${backoff}ms (attempt ${this.reconnectAttempts})...`));
204
+ console.log(chalk.yellow(`⏳ Reconnecting WebSocket in ${backoff}ms (attempt ${this.reconnectAttempts})...`));
211
205
  this.reconnectTimer = setTimeout(() => {
212
206
  this.connect().catch(error => {
213
- console.error(chalk_1.default.red('Reconnection failed:'), error);
207
+ console.error(chalk.red('Reconnection failed:'), error);
214
208
  });
215
209
  }, backoff);
216
210
  }
@@ -247,7 +241,7 @@ class WebSocketTransport extends events_1.EventEmitter {
247
241
  /**
248
242
  * Server-Sent Events Transport
249
243
  */
250
- class SSETransport extends events_1.EventEmitter {
244
+ class SSETransport extends EventEmitter {
251
245
  eventSource = null;
252
246
  url;
253
247
  connected = false;
@@ -307,7 +301,7 @@ class SSETransport extends events_1.EventEmitter {
307
301
  /**
308
302
  * Transport Manager class
309
303
  */
310
- class MCPTransportManager {
304
+ export class MCPTransportManager {
311
305
  transports = new Map();
312
306
  configs = new Map();
313
307
  /**
@@ -345,13 +339,13 @@ class MCPTransportManager {
345
339
  */
346
340
  setupEventForwarding(name, transport) {
347
341
  transport.on('connected', () => {
348
- console.log(chalk_1.default.green(`✅ Transport '${name}' connected`));
342
+ console.log(chalk.green(`✅ Transport '${name}' connected`));
349
343
  });
350
344
  transport.on('disconnected', (reason) => {
351
- console.log(chalk_1.default.yellow(`⚠️ Transport '${name}' disconnected:`, reason));
345
+ console.log(chalk.yellow(`⚠️ Transport '${name}' disconnected:`, reason));
352
346
  });
353
347
  transport.on('error', (error) => {
354
- console.log(chalk_1.default.red(`❌ Transport '${name}' error:`, error.message));
348
+ console.log(chalk.red(`❌ Transport '${name}' error:`, error.message));
355
349
  });
356
350
  }
357
351
  /**
@@ -436,6 +430,5 @@ class MCPTransportManager {
436
430
  return this.createTransport(name, config);
437
431
  }
438
432
  }
439
- exports.MCPTransportManager = MCPTransportManager;
440
433
  // Export singleton instance
441
- exports.transportManager = new MCPTransportManager();
434
+ export const transportManager = new MCPTransportManager();
@@ -1,19 +1,16 @@
1
- "use strict";
2
1
  /**
3
2
  * Vector Store Integration
4
3
  * Supports multiple vector stores with configurable embedding models
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.LanonasisVectorStore = void 0;
8
- const config_js_1 = require("../utils/config.js");
9
- const logger_js_1 = require("./logger.js");
10
- class LanonasisVectorStore {
5
+ import { CLIConfig } from '../utils/config.js';
6
+ import { logger } from './logger.js';
7
+ export class LanonasisVectorStore {
11
8
  config;
12
9
  storeConfig;
13
10
  isInitialized = false;
14
11
  localEmbeddings = new Map();
15
12
  constructor() {
16
- this.config = new config_js_1.CLIConfig();
13
+ this.config = new CLIConfig();
17
14
  this.storeConfig = {
18
15
  provider: 'local',
19
16
  collection: 'lanonasis_memories',
@@ -22,7 +19,7 @@ class LanonasisVectorStore {
22
19
  }
23
20
  async initialize() {
24
21
  this.isInitialized = true;
25
- logger_js_1.logger.info('Vector store initialized', { provider: this.storeConfig.provider });
22
+ logger.info('Vector store initialized', { provider: this.storeConfig.provider });
26
23
  }
27
24
  isConfigured() {
28
25
  return this.isInitialized;
@@ -30,7 +27,7 @@ class LanonasisVectorStore {
30
27
  async addMemory(memoryId, content, metadata) {
31
28
  const embedding = this.generateSimpleEmbedding(content);
32
29
  this.localEmbeddings.set(memoryId, { embedding, metadata, content });
33
- logger_js_1.logger.debug('Memory added to vector store', { memoryId });
30
+ logger.debug('Memory added to vector store', { memoryId });
34
31
  }
35
32
  async searchMemories(query, options = {}) {
36
33
  const queryEmbedding = this.generateSimpleEmbedding(query);
@@ -93,4 +90,3 @@ class LanonasisVectorStore {
93
90
  return magnitudeA && magnitudeB ? dotProduct / (magnitudeA * magnitudeB) : 0;
94
91
  }
95
92
  }
96
- exports.LanonasisVectorStore = LanonasisVectorStore;
@@ -1,25 +1,22 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
2
  /**
4
3
  * CLI-Embedded MCP Server
5
4
  * Uses the same configuration and authentication as @lanonasis/cli v1.5.2+
6
5
  * Can run standalone or be invoked by CLI commands
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CLIMCPServer = void 0;
10
- const url_1 = require("url");
11
- const path_1 = require("path");
12
- const fs_1 = require("fs");
13
- const module_1 = require("module");
14
- const child_process_1 = require("child_process");
15
- const config_js_1 = require("./utils/config.js");
16
- const __filename = (0, url_1.fileURLToPath)(import.meta.url);
17
- const __dirname = (0, path_1.dirname)(__filename);
18
- const nodeRequire = (0, module_1.createRequire)(import.meta.url);
19
- class CLIMCPServer {
7
+ import { fileURLToPath } from 'url';
8
+ import { dirname, join } from 'path';
9
+ import { existsSync } from 'fs';
10
+ import { createRequire } from 'module';
11
+ import { spawn } from 'child_process';
12
+ import { CLIConfig } from './utils/config.js';
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ const nodeRequire = createRequire(import.meta.url);
16
+ export class CLIMCPServer {
20
17
  config;
21
18
  constructor() {
22
- this.config = new config_js_1.CLIConfig();
19
+ this.config = new CLIConfig();
23
20
  }
24
21
  /**
25
22
  * Start MCP server using CLI configuration
@@ -40,8 +37,8 @@ class CLIMCPServer {
40
37
  candidates.add(process.env.MCP_SERVER_PATH);
41
38
  }
42
39
  const packageRequests = [
43
- '@lanonasis/mcp-server/dist/cli-aligned-mcp-server.js',
44
- 'lanonasis-mcp-server/dist/cli-aligned-mcp-server.js'
40
+ 'mcp-core/dist/cli-aligned-mcp-server.js',
41
+ 'mcp-core/dist/cli-aligned-mcp-server.js'
45
42
  ];
46
43
  for (const request of packageRequests) {
47
44
  try {
@@ -52,10 +49,10 @@ class CLIMCPServer {
52
49
  // Ignore resolution failures and continue through fallbacks
53
50
  }
54
51
  }
55
- candidates.add((0, path_1.join)(process.cwd(), 'mcp-server/dist/cli-aligned-mcp-server.js'));
56
- candidates.add((0, path_1.join)(__dirname, '../../../mcp-server/dist/cli-aligned-mcp-server.js'));
52
+ candidates.add(join(process.cwd(), 'mcp-server/dist/cli-aligned-mcp-server.js'));
53
+ candidates.add(join(__dirname, '../../../mcp-server/dist/cli-aligned-mcp-server.js'));
57
54
  for (const candidate of candidates) {
58
- if (candidate && (0, fs_1.existsSync)(candidate)) {
55
+ if (candidate && existsSync(candidate)) {
59
56
  return candidate;
60
57
  }
61
58
  }
@@ -67,7 +64,7 @@ class CLIMCPServer {
67
64
  async startLocalMCP(options) {
68
65
  const { mode, port, verbose } = options;
69
66
  // Path to production MCP server (uses CommonJS, no build needed)
70
- const mcpServerPath = (0, path_1.join)(__dirname, '../../../mcp-server/src/production-mcp-server.cjs');
67
+ const mcpServerPath = join(__dirname, '../../../mcp-server/src/production-mcp-server.cjs');
71
68
  const args = mode === 'http' ? ['--http'] : ['--stdio'];
72
69
  if (verbose) {
73
70
  console.error('🚀 Starting CLI-aligned MCP Server...');
@@ -86,7 +83,7 @@ class CLIMCPServer {
86
83
  MCP_VERBOSE: verbose ? 'true' : 'false',
87
84
  CLI_ALIGNED: 'true'
88
85
  };
89
- const child = (0, child_process_1.spawn)('node', [mcpServerPath, ...args], {
86
+ const child = spawn('node', [mcpServerPath, ...args], {
90
87
  env,
91
88
  stdio: mode === 'stdio' ? ['pipe', 'pipe', 'inherit'] : 'inherit'
92
89
  });
@@ -140,7 +137,6 @@ class CLIMCPServer {
140
137
  };
141
138
  }
142
139
  }
143
- exports.CLIMCPServer = CLIMCPServer;
144
140
  // Main execution when run as standalone script
145
141
  async function main() {
146
142
  const args = process.argv.slice(2);
@@ -162,7 +158,7 @@ async function main() {
162
158
  CLI MCP Server - CLI-aligned Model Context Protocol server
163
159
 
164
160
  Usage:
165
- lanonasis-mcp-server [options]
161
+ mcp-core [options]
166
162
 
167
163
  Options:
168
164
  --stdio Use stdio transport (default)
@@ -174,9 +170,9 @@ Options:
174
170
  --help Show this help
175
171
 
176
172
  Examples:
177
- lanonasis-mcp-server # Start stdio server
178
- lanonasis-mcp-server --http --port=3002 # Start HTTP server
179
- lanonasis-mcp-server --status # Check status
173
+ mcp-core # Start stdio server
174
+ mcp-core --http --port=3002 # Start HTTP server
175
+ mcp-core --status # Check status
180
176
  `);
181
177
  return;
182
178
  }
@@ -189,4 +185,4 @@ if (import.meta.url === `file://${process.argv[1]}`) {
189
185
  process.exit(1);
190
186
  });
191
187
  }
192
- exports.default = CLIMCPServer;
188
+ export default CLIMCPServer;