@lanonasis/cli 3.0.8 → 3.0.10

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.
@@ -29,10 +29,7 @@ export class LanonasisMCPServer {
29
29
  // Initialize config and API client
30
30
  this.config = new CLIConfig();
31
31
  this.apiClient = new APIClient();
32
- // Register all tools, resources, and prompts
33
- this.registerTools();
34
- this.registerResources();
35
- this.registerPrompts();
32
+ // Note: registerTools is now async and called in initialize()
36
33
  // Setup error handling
37
34
  this.setupErrorHandling();
38
35
  }
@@ -56,6 +53,10 @@ export class LanonasisMCPServer {
56
53
  this.apiClient = new APIClient();
57
54
  // APIClient will use the config internally
58
55
  }
56
+ // Register tools, resources, and prompts after config is loaded
57
+ await this.registerTools();
58
+ await this.registerResources();
59
+ await this.registerPrompts();
59
60
  if (this.options.verbose) {
60
61
  console.log(chalk.cyan('🚀 Lanonasis MCP Server initialized'));
61
62
  console.log(chalk.gray(`API URL: ${apiUrl}`));
@@ -65,9 +66,9 @@ export class LanonasisMCPServer {
65
66
  /**
66
67
  * Register MCP tools
67
68
  */
68
- registerTools() {
69
- // Import request schemas at the top of the method
70
- const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
69
+ async registerTools() {
70
+ // Import request schemas dynamically for ES modules
71
+ const { ListToolsRequestSchema, CallToolRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
71
72
  // List available tools
72
73
  this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
73
74
  tools: [
@@ -337,8 +338,9 @@ export class LanonasisMCPServer {
337
338
  /**
338
339
  * Register MCP resources
339
340
  */
340
- registerResources() {
341
- this.server.setRequestHandler({ method: 'resources/list' }, async () => ({
341
+ async registerResources() {
342
+ const { ListResourcesRequestSchema, ReadResourceRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
343
+ this.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
342
344
  resources: [
343
345
  {
344
346
  uri: 'memory://recent',
@@ -366,7 +368,7 @@ export class LanonasisMCPServer {
366
368
  }
367
369
  ]
368
370
  }));
369
- this.server.setRequestHandler({ method: 'resources/read' }, async (request) => {
371
+ this.server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
370
372
  const { uri } = request.params;
371
373
  try {
372
374
  const content = await this.handleResourceRead(uri);
@@ -388,8 +390,9 @@ export class LanonasisMCPServer {
388
390
  /**
389
391
  * Register MCP prompts
390
392
  */
391
- registerPrompts() {
392
- this.server.setRequestHandler({ method: 'prompts/list' }, async () => ({
393
+ async registerPrompts() {
394
+ const { ListPromptsRequestSchema, GetPromptRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
395
+ this.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
393
396
  prompts: [
394
397
  {
395
398
  name: 'create_memory',
@@ -420,7 +423,7 @@ export class LanonasisMCPServer {
420
423
  }
421
424
  ]
422
425
  }));
423
- this.server.setRequestHandler({ method: 'prompts/get' }, async (request) => {
426
+ this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
424
427
  const { name, arguments: args } = request.params;
425
428
  const prompts = {
426
429
  create_memory: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "description": "LanOnasis Enterprise CLI - Memory as a Service, API Key Management, and Infrastructure Orchestration",
5
5
  "main": "dist/index-simple.js",
6
6
  "bin": {