@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 +166 -6
- package/dist/commands/auth.d.ts +6 -1
- package/dist/commands/auth.js +7 -4
- package/dist/commands/config.js +88 -4
- package/dist/commands/init.d.ts +5 -1
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +318 -0
- package/dist/commands/memory.js +37 -27
- package/dist/commands/topics.js +12 -7
- package/dist/index-simple.js +1 -1
- package/dist/index.js +28 -5
- package/dist/utils/api.d.ts +155 -15
- package/dist/utils/config.d.ts +6 -0
- package/dist/utils/config.js +46 -12
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/mcp-client.d.ts +53 -0
- package/dist/utils/mcp-client.js +249 -0
- package/package.json +17 -4
package/README.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# Lanonasis CLI - Enterprise Infrastructure Management
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@lanonasis/cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://modelcontextprotocol.com)
|
|
4
6
|
|
|
5
|
-
|
|
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
|
|
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)
|
package/dist/commands/auth.d.ts
CHANGED
package/dist/commands/auth.js
CHANGED
|
@@ -49,7 +49,9 @@ export async function loginCommand(options) {
|
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
spinner.fail('Login failed');
|
|
52
|
-
|
|
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:'),
|
|
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
|
|
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
|
-
|
|
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
|
}
|
package/dist/commands/config.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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:'),
|
|
176
|
+
console.error(chalk.red('Error:'), errorMessage);
|
|
93
177
|
}
|
|
94
178
|
process.exit(1);
|
|
95
179
|
}
|
package/dist/commands/init.d.ts
CHANGED