@lanonasis/cli 1.0.1 → 1.2.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.
package/README.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # Lanonasis CLI - Enterprise Infrastructure Management
2
2
 
3
- 🚀 **Professional CLI for Lanonasis Platform Services**
3
+ [![npm version](https://img.shields.io/npm/v/@lanonasis/cli)](https://www.npmjs.com/package/@lanonasis/cli)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![MCP Integration](https://img.shields.io/badge/MCP-Model%20Context%20Protocol-purple)](https://modelcontextprotocol.com)
4
6
 
5
- The Lanonasis CLI provides a powerful command-line interface for interacting with the entire Lanonasis ecosystem, including Memory as a Service (MaaS), infrastructure management, and multi-service orchestration. Manage your memories, search through knowledge bases, organize your thoughts, and control your infrastructure - all from the terminal.
7
+ 🚀 **Professional CLI for Lanonasis Platform Services with MCP Integration**
8
+
9
+ The Lanonasis CLI provides a powerful command-line interface for interacting with the entire Lanonasis ecosystem, including Memory as a Service (MaaS), infrastructure management, and multi-service orchestration. Now with **Model Context Protocol (MCP)** integration for unified AI-agent communication. Manage your memories, search through knowledge bases, organize your thoughts, and control your infrastructure - all from the terminal.
10
+
11
+ ## 🆕 New in v1.1.0
12
+ - **MCP Server Mode**: Run as MCP server for AI assistants (Claude, Cursor, Windsurf)
13
+ - **Hybrid Architecture**: Seamless switching between local MCP and remote API
14
+ - **Real-time Updates**: SSE streaming for live memory synchronization
15
+ - **Tool Discovery**: Dynamic MCP tool listing for AI agents
16
+ - **Unified Interface**: Same commands work with local or cloud backends
17
+ - **Auto-detection**: Intelligently chooses best connection mode
6
18
 
7
19
  ## ⚡ Quick Start
8
20
 
@@ -135,6 +147,95 @@ memory search "my query" # Direct memory command
135
147
  maas list --type knowledge # MaaS command
136
148
  ```
137
149
 
150
+ ## 🤖 MCP Integration (Model Context Protocol)
151
+
152
+ The CLI now includes full MCP support for AI agent integration:
153
+
154
+ ### Start MCP Server Mode
155
+
156
+ ```bash
157
+ # Start as MCP server for AI assistants
158
+ lanonasis mcp start # Default port 3002
159
+ lanonasis mcp start --port 8080 # Custom port
160
+ lanonasis mcp start --mode server # Explicit server mode
161
+
162
+ # Or use npx without installation
163
+ npx -y @lanonasis/cli mcp start
164
+ ```
165
+
166
+ ### Configure AI Assistants
167
+
168
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "memory-service": {
173
+ "command": "npx",
174
+ "args": ["-y", "@lanonasis/cli", "mcp", "start"],
175
+ "env": {
176
+ "LANONASIS_API_KEY": "your-api-key-here"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ ```
182
+
183
+ **Cursor/Windsurf** (Settings):
184
+ ```json
185
+ {
186
+ "mcp.servers": {
187
+ "memory-service": {
188
+ "command": "lanonasis",
189
+ "args": ["mcp", "start"],
190
+ "env": {
191
+ "LANONASIS_API_KEY": "your-api-key-here"
192
+ }
193
+ }
194
+ }
195
+ }
196
+ ```
197
+
198
+ ### MCP Commands
199
+
200
+ ```bash
201
+ # Server operations
202
+ lanonasis mcp start # Start MCP server
203
+ lanonasis mcp stop # Stop MCP server
204
+ lanonasis mcp status # Check server status
205
+ lanonasis mcp logs # View server logs
206
+
207
+ # Tool discovery
208
+ lanonasis mcp tools # List all available MCP tools
209
+ lanonasis mcp tools --json # Output as JSON
210
+
211
+ # Test connectivity
212
+ lanonasis mcp test # Test MCP connection
213
+ lanonasis mcp test --tool <name> # Test specific tool
214
+ ```
215
+
216
+ ### Available MCP Tools
217
+
218
+ - `memory_create_memory` - Create new memories with embeddings
219
+ - `memory_search_memories` - Semantic search across memories
220
+ - `memory_list_memories` - List and filter memories
221
+ - `memory_get_memory` - Retrieve specific memory
222
+ - `memory_update_memory` - Update existing memories
223
+ - `memory_delete_memory` - Delete memories
224
+ - `memory_bulk_create` - Batch create multiple memories
225
+ - `memory_bulk_delete` - Batch delete memories
226
+ - `memory_get_stats` - Get memory statistics
227
+ - `memory_export_data` - Export memories (JSON/CSV/YAML)
228
+ - `memory_import_data` - Import memories from files
229
+
230
+ ### MCP Features:
231
+ - **🔌 WebSocket Server**: Real-time bidirectional communication
232
+ - **🔄 Hybrid Mode**: Automatic fallback between local/remote
233
+ - **🔐 Secure Auth**: API key and JWT token support
234
+ - **📊 Real-time SSE**: Live updates in remote mode
235
+ - **🛠️ Tool Discovery**: Dynamic tool listing for AI agents
236
+ - **🎯 Auto-detection**: Intelligently chooses best mode
237
+ - **📝 Full Memory API**: All operations exposed as MCP tools
238
+
138
239
  ## 🌐 MaaS Service Integration
139
240
 
140
241
  This CLI is designed to work with Memory as a Service platforms that provide:
@@ -181,11 +282,43 @@ node dist/index-simple.js help
181
282
  - **Configuration** - Flexible service setup
182
283
  - **Help System** - Comprehensive documentation
183
284
 
285
+ ## 📦 SDK & Related Packages
286
+
287
+ ### Memory Client SDK
288
+ Install the TypeScript/JavaScript SDK for application integration:
289
+
290
+ ```bash
291
+ # Install SDK for your applications
292
+ npm install @lanonasis/memory-client
293
+
294
+ # Use in your code
295
+ import { createMemoryClient } from '@lanonasis/memory-client';
296
+
297
+ const client = createMemoryClient({
298
+ baseURL: 'https://api.lanonasis.com',
299
+ apiKey: 'your-api-key-here'
300
+ });
301
+ ```
302
+
303
+ ### Complete Installation for Developers
304
+ ```bash
305
+ # Install CLI globally for command-line usage
306
+ npm install -g @lanonasis/cli
307
+
308
+ # Install SDK locally for application development
309
+ npm install @lanonasis/memory-client
310
+
311
+ # Now you have both CLI and SDK available!
312
+ lanonasis --help # CLI commands
313
+ # SDK available for import in your code
314
+ ```
315
+
184
316
  ## 🔗 Related Projects
185
317
 
186
- - **Memory Service Backend** - Full MaaS API server
187
- - **Memory SDK** - JavaScript/TypeScript SDK for developers
188
- - **Memory Visualizer** - Interactive memory exploration
318
+ - **Memory Service Backend** - Full MaaS API server ([GitHub](https://github.com/thefixer3x/vibe-memory))
319
+ - **Memory Client SDK** - JavaScript/TypeScript SDK (`@lanonasis/memory-client`)
320
+ - **Memory Visualizer** - Interactive memory exploration (included in backend)
321
+ - **VSCode Extension** - IDE integration (coming soon)
189
322
 
190
323
  ## 📄 License
191
324
 
@@ -212,6 +345,33 @@ MIT License - see LICENSE file for details
212
345
  - **Research Organization** - Academic and research note-taking
213
346
  - **API Integration** - Programmatic memory management
214
347
 
348
+ ## 🏆 Production Ready Features
349
+
350
+ ### Enterprise Capabilities
351
+ - **🔐 Secure Authentication** - API key and JWT token support
352
+ - **🌐 Multi-tenant Support** - Isolated memory spaces per user/org
353
+ - **📊 Rate Limiting** - Built-in request throttling
354
+ - **🔄 Retry Logic** - Automatic retry with exponential backoff
355
+ - **📝 Comprehensive Logging** - Debug and audit trails
356
+ - **🚀 Performance Optimized** - Minimal overhead, fast responses
357
+
358
+ ### Commercial Use Cases
359
+ - **💼 Enterprise Knowledge Management** - Company-wide memory system
360
+ - **🤝 Team Collaboration** - Shared project memories
361
+ - **🎓 Educational Platforms** - Student/teacher memory sharing
362
+ - **🏥 Healthcare Systems** - Patient context management
363
+ - **💰 Financial Services** - Transaction memory and audit trails
364
+ - **🛒 E-commerce** - Customer interaction history
365
+
366
+ ### Integration Ready
367
+ - **REST API** - Standard HTTP/JSON interface
368
+ - **MCP Protocol** - AI assistant integration
369
+ - **WebSocket** - Real-time updates
370
+ - **SSE Streaming** - Live data synchronization
371
+ - **SDK Available** - TypeScript/JavaScript client library
372
+
215
373
  ---
216
374
 
217
- **Built with ❤️ for the Memory as a Service ecosystem**
375
+ **Built with ❤️ for the Memory as a Service ecosystem**
376
+
377
+ 🚀 **Ready for Production** | 📚 [Documentation](https://docs.lanonasis.com) | 🌐 [Platform](https://api.lanonasis.com)
@@ -1 +1,6 @@
1
- export declare function loginCommand(options: any): Promise<void>;
1
+ interface LoginOptions {
2
+ email?: string;
3
+ password?: string;
4
+ }
5
+ export declare function loginCommand(options: LoginOptions): Promise<void>;
6
+ export {};
@@ -49,7 +49,9 @@ export async function loginCommand(options) {
49
49
  }
50
50
  catch (error) {
51
51
  spinner.fail('Login failed');
52
- if (error.response?.status === 401) {
52
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
53
+ const errorResponse = error && typeof error === 'object' && 'response' in error ? error.response : null;
54
+ if (errorResponse && typeof errorResponse === 'object' && 'status' in errorResponse && errorResponse.status === 401) {
53
55
  console.error(chalk.red('✖ Invalid email or password'));
54
56
  // Ask if they want to register
55
57
  const answer = await inquirer.prompt([
@@ -65,7 +67,7 @@ export async function loginCommand(options) {
65
67
  }
66
68
  }
67
69
  else {
68
- console.error(chalk.red('✖ Login failed:'), error.message);
70
+ console.error(chalk.red('✖ Login failed:'), errorMessage);
69
71
  }
70
72
  process.exit(1);
71
73
  }
@@ -98,7 +100,7 @@ async function registerFlow(defaultEmail) {
98
100
  message: 'Confirm password:',
99
101
  mask: '*',
100
102
  validate: (input, answers) => {
101
- return input === answers.password || 'Passwords do not match';
103
+ return input === answers?.password || 'Passwords do not match';
102
104
  }
103
105
  },
104
106
  {
@@ -124,7 +126,8 @@ async function registerFlow(defaultEmail) {
124
126
  }
125
127
  catch (error) {
126
128
  spinner.fail('Registration failed');
127
- console.error(chalk.red('✖ Registration failed:'), error.message);
129
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
130
+ console.error(chalk.red('✖ Registration failed:'), errorMessage);
128
131
  process.exit(1);
129
132
  }
130
133
  }
@@ -3,6 +3,65 @@ import inquirer from 'inquirer';
3
3
  import { CLIConfig } from '../utils/config.js';
4
4
  import { apiClient } from '../utils/api.js';
5
5
  export function configCommands(program) {
6
+ // Generic config set command
7
+ program
8
+ .command('set <key> <value>')
9
+ .description('Set configuration value')
10
+ .action(async (key, value) => {
11
+ const config = new CLIConfig();
12
+ await config.init();
13
+ // Handle special cases
14
+ switch (key) {
15
+ case 'api-url':
16
+ await config.setApiUrl(value);
17
+ console.log(chalk.green('✓ API URL updated:'), value);
18
+ break;
19
+ case 'ai-integration':
20
+ if (value === 'claude-mcp') {
21
+ config.set('mcpEnabled', true);
22
+ config.set('aiIntegration', 'claude-mcp');
23
+ console.log(chalk.green('✓ AI integration set to Claude MCP'));
24
+ console.log(chalk.cyan(' MCP will be automatically initialized for memory operations'));
25
+ console.log(chalk.cyan(' Run "lanonasis mcp-server init" to test the connection'));
26
+ }
27
+ else {
28
+ console.log(chalk.yellow('⚠️ Unknown AI integration:'), value);
29
+ console.log(chalk.gray(' Currently supported: claude-mcp'));
30
+ }
31
+ break;
32
+ case 'mcp-use-remote':
33
+ config.set('mcpUseRemote', value === 'true');
34
+ console.log(chalk.green('✓ MCP remote mode:'), value === 'true' ? 'enabled' : 'disabled');
35
+ break;
36
+ case 'mcp-server-path':
37
+ config.set('mcpServerPath', value);
38
+ console.log(chalk.green('✓ MCP server path updated:'), value);
39
+ break;
40
+ case 'mcp-server-url':
41
+ config.set('mcpServerUrl', value);
42
+ console.log(chalk.green('✓ MCP server URL updated:'), value);
43
+ break;
44
+ default:
45
+ // Generic config set
46
+ config.set(key, value);
47
+ console.log(chalk.green(`✓ ${key} set to:`), value);
48
+ }
49
+ });
50
+ // Generic config get command
51
+ program
52
+ .command('get <key>')
53
+ .description('Get configuration value')
54
+ .action(async (key) => {
55
+ const config = new CLIConfig();
56
+ await config.init();
57
+ const value = config.get(key);
58
+ if (value !== undefined) {
59
+ console.log(chalk.green(`${key}:`), value);
60
+ }
61
+ else {
62
+ console.log(chalk.yellow(`⚠️ ${key} is not set`));
63
+ }
64
+ });
6
65
  // Show current configuration
7
66
  program
8
67
  .command('show')
@@ -26,6 +85,29 @@ export function configCommands(program) {
26
85
  }
27
86
  }
28
87
  });
88
+ // List all configuration options
89
+ program
90
+ .command('list')
91
+ .description('List all configuration options')
92
+ .action(async () => {
93
+ const config = new CLIConfig();
94
+ await config.init();
95
+ console.log(chalk.blue.bold('📋 Configuration Options'));
96
+ console.log();
97
+ const configOptions = [
98
+ { key: 'api-url', description: 'API endpoint URL', current: config.getApiUrl() },
99
+ { key: 'ai-integration', description: 'AI integration mode', current: config.get('aiIntegration') || 'none' },
100
+ { key: 'mcp-use-remote', description: 'Use remote MCP server', current: config.get('mcpUseRemote') || false },
101
+ { key: 'mcp-server-path', description: 'Local MCP server path', current: config.get('mcpServerPath') || 'default' },
102
+ { key: 'mcp-server-url', description: 'Remote MCP server URL', current: config.get('mcpServerUrl') || 'https://api.lanonasis.com' },
103
+ { key: 'mcpEnabled', description: 'MCP integration enabled', current: config.get('mcpEnabled') || false }
104
+ ];
105
+ configOptions.forEach(opt => {
106
+ console.log(chalk.green(opt.key.padEnd(20)), chalk.gray(opt.description.padEnd(30)), chalk.yellow(String(opt.current)));
107
+ });
108
+ console.log();
109
+ console.log(chalk.gray('Use "lanonasis config set <key> <value>" to update any option'));
110
+ });
29
111
  // Set API URL
30
112
  program
31
113
  .command('set-url')
@@ -72,24 +154,26 @@ export function configCommands(program) {
72
154
  console.log(chalk.green('✓ Connection successful'));
73
155
  console.log(`Status: ${health.status}`);
74
156
  console.log(`Version: ${health.version}`);
75
- console.log(`Uptime: ${Math.round(health.uptime)}s`);
76
157
  if (health.dependencies) {
77
158
  console.log();
78
159
  console.log(chalk.yellow('Dependencies:'));
79
160
  Object.entries(health.dependencies).forEach(([name, info]) => {
80
161
  const status = info.status === 'healthy' ? chalk.green('✓') : chalk.red('✖');
81
- console.log(` ${status} ${name}: ${info.status} (${info.response_time}ms)`);
162
+ const responseTime = info.response_time || info.latency_ms || 0;
163
+ console.log(` ${status} ${name}: ${info.status} (${responseTime}ms)`);
82
164
  });
83
165
  }
84
166
  }
85
167
  catch (error) {
86
168
  console.log(chalk.red('✖ Connection failed'));
87
- if (error.code === 'ECONNREFUSED') {
169
+ const errorCode = error && typeof error === 'object' && 'code' in error ? error.code : null;
170
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
171
+ if (errorCode === 'ECONNREFUSED') {
88
172
  console.error(chalk.red('Cannot connect to API server'));
89
173
  console.log(chalk.yellow('Make sure the API server is running'));
90
174
  }
91
175
  else {
92
- console.error(chalk.red('Error:'), error.message);
176
+ console.error(chalk.red('Error:'), errorMessage);
93
177
  }
94
178
  process.exit(1);
95
179
  }
@@ -1 +1,5 @@
1
- export declare function initCommand(options: any): Promise<void>;
1
+ interface InitOptions {
2
+ force?: boolean;
3
+ }
4
+ export declare function initCommand(options: InitOptions): Promise<void>;
5
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function mcpCommands(program: Command): void;