@lanonasis/cli 1.1.0 → 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,14 +1,20 @@
1
1
  # Lanonasis CLI - Enterprise Infrastructure Management
2
2
 
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)
6
+
3
7
  šŸš€ **Professional CLI for Lanonasis Platform Services with MCP Integration**
4
8
 
5
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.
6
10
 
7
11
  ## šŸ†• New in v1.1.0
8
- - **MCP Integration**: Full Model Context Protocol support for AI agents
9
- - **Hybrid Mode**: Seamless switching between local MCP and remote API
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
10
14
  - **Real-time Updates**: SSE streaming for live memory synchronization
15
+ - **Tool Discovery**: Dynamic MCP tool listing for AI agents
11
16
  - **Unified Interface**: Same commands work with local or cloud backends
17
+ - **Auto-detection**: Intelligently chooses best connection mode
12
18
 
13
19
  ## ⚔ Quick Start
14
20
 
@@ -145,35 +151,90 @@ maas list --type knowledge # MaaS command
145
151
 
146
152
  The CLI now includes full MCP support for AI agent integration:
147
153
 
154
+ ### Start MCP Server Mode
155
+
148
156
  ```bash
149
- # Connect to MCP server
150
- lanonasis mcp connect # Auto-detect mode
151
- lanonasis mcp connect --remote # Use cloud API
152
- lanonasis mcp connect --local # Use local server
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
153
161
 
154
- # Check MCP status
155
- lanonasis mcp status
162
+ # Or use npx without installation
163
+ npx -y @lanonasis/cli mcp start
164
+ ```
156
165
 
157
- # List available tools
158
- lanonasis mcp tools
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
+ ```
159
182
 
160
- # Memory operations via MCP
161
- lanonasis mcp memory create -t "Title" -c "Content"
162
- lanonasis mcp memory search "query"
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
+ ```
163
197
 
164
- # Stream real-time updates
165
- lanonasis memory-mcp stream
198
+ ### MCP Commands
166
199
 
167
- # Configure MCP preferences
168
- lanonasis mcp config --prefer-remote
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
169
214
  ```
170
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
+
171
230
  ### MCP Features:
172
- - **Unified Interface**: Same commands for local/remote backends
173
- - **Auto-Connect**: Automatically connects based on auth status
174
- - **Tool Discovery**: Dynamic listing of available MCP tools
175
- - **Real-time SSE**: Live updates when using remote mode
176
- - **Hybrid Mode**: Seamless fallback between MCP and REST API
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
177
238
 
178
239
  ## 🌐 MaaS Service Integration
179
240
 
@@ -284,6 +345,33 @@ MIT License - see LICENSE file for details
284
345
  - **Research Organization** - Academic and research note-taking
285
346
  - **API Integration** - Programmatic memory management
286
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
+
287
373
  ---
288
374
 
289
- **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)
@@ -6,6 +6,7 @@ import wrap from 'word-wrap';
6
6
  import { format } from 'date-fns';
7
7
  import { apiClient } from '../utils/api.js';
8
8
  import { formatBytes, truncateText } from '../utils/formatting.js';
9
+ // Using GetMemoriesParams from api.ts
9
10
  export function memoryCommands(program) {
10
11
  // Create memory
11
12
  program
@@ -101,25 +102,26 @@ export function memoryCommands(program) {
101
102
  try {
102
103
  const spinner = ora('Fetching memories...').start();
103
104
  const params = {
104
- page: parseInt(options.page || '1'),
105
+ offset: (parseInt(options.page || '1') - 1) * parseInt(options.limit || '20'),
105
106
  limit: parseInt(options.limit || '20'),
106
- sort: options.sort || 'created_at',
107
- order: options.order || 'desc'
107
+ sort_by: (options.sort || 'created_at'),
108
+ sort_order: (options.order || 'desc')
108
109
  };
109
110
  if (options.type)
110
111
  params.memory_type = options.type;
111
112
  if (options.tags)
112
- params.tags = options.tags;
113
- if (options.userId)
114
- params.user_id = options.userId;
113
+ params.tags = options.tags.split(',').map(t => t.trim());
114
+ // Note: user_id filtering removed as it's handled by authentication
115
115
  const result = await apiClient.getMemories(params);
116
116
  spinner.stop();
117
- if (result.memories.length === 0) {
117
+ if (result.data.length === 0) {
118
118
  console.log(chalk.yellow('No memories found'));
119
119
  return;
120
120
  }
121
121
  console.log(chalk.blue.bold(`\nšŸ“š Memories (${result.pagination.total} total)`));
122
- console.log(chalk.gray(`Page ${result.pagination.page} of ${result.pagination.pages}`));
122
+ const currentPage = Math.floor(result.pagination.offset / result.pagination.limit) + 1;
123
+ const totalPages = Math.ceil(result.pagination.total / result.pagination.limit);
124
+ console.log(chalk.gray(`Page ${currentPage} of ${totalPages}`));
123
125
  console.log();
124
126
  const outputFormat = process.env.CLI_OUTPUT_FORMAT || 'table';
125
127
  if (outputFormat === 'json') {
@@ -127,7 +129,7 @@ export function memoryCommands(program) {
127
129
  }
128
130
  else {
129
131
  // Table format
130
- const tableData = result.memories.map((memory) => [
132
+ const tableData = result.data.map((memory) => [
131
133
  truncateText(memory.title, 30),
132
134
  memory.memory_type,
133
135
  memory.tags.slice(0, 3).join(', '),
@@ -135,7 +137,6 @@ export function memoryCommands(program) {
135
137
  memory.access_count
136
138
  ]);
137
139
  const tableConfig = {
138
- header: ['Title', 'Type', 'Tags', 'Created', 'Access'],
139
140
  columnDefault: {
140
141
  width: 20,
141
142
  wrapWord: true
@@ -148,10 +149,12 @@ export function memoryCommands(program) {
148
149
  { width: 8 }
149
150
  ]
150
151
  };
151
- console.log(table([tableConfig.header, ...tableData], tableConfig));
152
+ const tableHeaders = ['Title', 'Type', 'Tags', 'Created', 'Access'];
153
+ console.log(table([tableHeaders, ...tableData], tableConfig));
152
154
  // Pagination info
153
- if (result.pagination.pages > 1) {
154
- console.log(chalk.gray(`\nUse --page ${result.pagination.page + 1} for next page`));
155
+ if (result.pagination.has_more) {
156
+ const nextPage = currentPage + 1;
157
+ console.log(chalk.gray(`\nUse --page ${nextPage} for next page`));
155
158
  }
156
159
  }
157
160
  }
@@ -185,14 +188,14 @@ export function memoryCommands(program) {
185
188
  }
186
189
  const result = await apiClient.searchMemories(query, searchOptions);
187
190
  spinner.stop();
188
- if (result.results.length === 0) {
191
+ if (result.data.length === 0) {
189
192
  console.log(chalk.yellow('No memories found matching your search'));
190
193
  return;
191
194
  }
192
- console.log(chalk.blue.bold(`\nšŸ” Search Results (${result.total_results} found)`));
193
- console.log(chalk.gray(`Query: "${query}" | Search time: ${result.search_time_ms}ms`));
195
+ console.log(chalk.blue.bold(`\nšŸ” Search Results (${result.pagination.total} found)`));
196
+ console.log(chalk.gray(`Query: "${query}"`));
194
197
  console.log();
195
- result.results.forEach((memory, index) => {
198
+ result.data.forEach((memory, index) => {
196
199
  const score = (memory.relevance_score * 100).toFixed(1);
197
200
  console.log(chalk.green(`${index + 1}. ${memory.title}`) + chalk.gray(` (${score}% match)`));
198
201
  console.log(chalk.white(` ${truncateText(memory.content, 100)}`));
@@ -117,7 +117,6 @@ export function topicCommands(program) {
117
117
  topic.parent_topic_id ? 'āœ“' : ''
118
118
  ]);
119
119
  const tableConfig = {
120
- header: ['Name', 'Description', 'Color', 'Created', 'Child'],
121
120
  columnDefault: {
122
121
  width: 20,
123
122
  wrapWord: true
@@ -130,7 +129,8 @@ export function topicCommands(program) {
130
129
  { width: 8 }
131
130
  ]
132
131
  };
133
- console.log(table([tableConfig.header, ...tableData], tableConfig));
132
+ const tableHeaders = ['Name', 'Description', 'System', 'Created'];
133
+ console.log(table([tableHeaders, ...tableData], tableConfig));
134
134
  }
135
135
  }
136
136
  catch (error) {
File without changes
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ program
46
46
  }
47
47
  }
48
48
  }
49
- catch (error) {
49
+ catch {
50
50
  if (process.env.CLI_VERBOSE === 'true') {
51
51
  console.log(chalk.yellow('MCP auto-connect failed, using direct API'));
52
52
  }
@@ -198,8 +198,7 @@ program
198
198
  // Help customization
199
199
  program.configureHelp({
200
200
  formatHelp: (cmd, helper) => {
201
- const term = helper.termWidth || 80;
202
- const helpWidth = Math.min(term - 2, 80);
201
+ // Get terminal width for formatting (currently using default helper formatting)
203
202
  let help = chalk.blue.bold('🧠 Memory as a Service CLI\n\n');
204
203
  help += helper.commandUsage(cmd) + '\n\n';
205
204
  if (cmd.description()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Lanonasis Enterprise CLI - Memory as a Service and Infrastructure Management",
5
5
  "main": "dist/index-simple.js",
6
6
  "bin": {