@lanonasis/cli 3.0.9 → 3.0.11
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/dist/commands/config.js +1 -1
- package/dist/commands/mcp.js +4 -4
- package/dist/index-simple.js +2 -2
- package/dist/index.js +2 -2
- package/dist/mcp/server/lanonasis-server.js +10 -8
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.js +24 -5
- package/dist/utils/mcp-client.js +8 -4
- package/package.json +1 -1
package/dist/commands/config.js
CHANGED
|
@@ -99,7 +99,7 @@ export function configCommands(program) {
|
|
|
99
99
|
{ key: 'ai-integration', description: 'AI integration mode', current: config.get('aiIntegration') || 'none' },
|
|
100
100
|
{ key: 'mcp-use-remote', description: 'Use remote MCP server', current: config.get('mcpUseRemote') || false },
|
|
101
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://
|
|
102
|
+
{ key: 'mcp-server-url', description: 'Remote MCP server URL', current: config.get('mcpServerUrl') || 'https://mcp.lanonasis.com' },
|
|
103
103
|
{ key: 'mcpEnabled', description: 'MCP integration enabled', current: config.get('mcpEnabled') || false }
|
|
104
104
|
];
|
|
105
105
|
configOptions.forEach(opt => {
|
package/dist/commands/mcp.js
CHANGED
|
@@ -21,7 +21,7 @@ export function mcpCommands(program) {
|
|
|
21
21
|
const isAuthenticated = !!config.get('token');
|
|
22
22
|
if (isAuthenticated) {
|
|
23
23
|
console.log(chalk.green('✓ Authenticated - Using remote MCP mode'));
|
|
24
|
-
console.log(' Your memory operations will use
|
|
24
|
+
console.log(' Your memory operations will use mcp.lanonasis.com');
|
|
25
25
|
console.log(' with real-time SSE updates enabled');
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -57,7 +57,7 @@ export function mcpCommands(program) {
|
|
|
57
57
|
mcp.command('connect')
|
|
58
58
|
.description('Connect to MCP server (local, remote, or WebSocket)')
|
|
59
59
|
.option('-l, --local', 'Connect to local MCP server')
|
|
60
|
-
.option('-r, --remote', 'Connect to remote MCP server (
|
|
60
|
+
.option('-r, --remote', 'Connect to remote MCP server (mcp.lanonasis.com)')
|
|
61
61
|
.option('-w, --websocket', 'Connect using WebSocket mode for enterprise users')
|
|
62
62
|
.option('-s, --server <path>', 'Local MCP server path')
|
|
63
63
|
.option('-u, --url <url>', 'Remote/WebSocket server URL')
|
|
@@ -122,7 +122,7 @@ export function mcpCommands(program) {
|
|
|
122
122
|
if (connected) {
|
|
123
123
|
spinner.succeed(chalk.green(`Connected to MCP server in ${connectionMode} mode`));
|
|
124
124
|
if (connectionMode === 'remote') {
|
|
125
|
-
console.log(chalk.cyan('ℹ️ Using remote MCP via
|
|
125
|
+
console.log(chalk.cyan('ℹ️ Using remote MCP via mcp.lanonasis.com'));
|
|
126
126
|
console.log(chalk.cyan('📡 SSE endpoint active for real-time updates'));
|
|
127
127
|
}
|
|
128
128
|
else if (connectionMode === 'websocket') {
|
|
@@ -350,7 +350,7 @@ export function mcpCommands(program) {
|
|
|
350
350
|
const current = config.get('mcpPreference') || 'auto';
|
|
351
351
|
console.log(`Current MCP preference: ${chalk.cyan(current)}`);
|
|
352
352
|
console.log('\nOptions:');
|
|
353
|
-
console.log(' --prefer-remote : Use remote MCP server (
|
|
353
|
+
console.log(' --prefer-remote : Use remote MCP server (mcp.lanonasis.com)');
|
|
354
354
|
console.log(' --prefer-local : Use local MCP server');
|
|
355
355
|
console.log(' --auto : Auto-detect based on authentication');
|
|
356
356
|
}
|
package/dist/index-simple.js
CHANGED
|
@@ -418,7 +418,7 @@ deployCmd
|
|
|
418
418
|
console.log();
|
|
419
419
|
console.log(colors.highlight('🔧 API Services:'));
|
|
420
420
|
console.log(` Memory Service: ${colors.success('✅ https://api.lanonasis.com')}`);
|
|
421
|
-
console.log(` MCP Server: ${colors.success('✅
|
|
421
|
+
console.log(` MCP Server: ${colors.success('✅ mcp.lanonasis.com')}`);
|
|
422
422
|
console.log(` REST API: ${colors.success('✅ All endpoints active')}`);
|
|
423
423
|
console.log();
|
|
424
424
|
console.log(colors.highlight('📦 Package Distribution:'));
|
|
@@ -443,7 +443,7 @@ deployCmd
|
|
|
443
443
|
{ name: 'Dashboard', url: 'https://api.lanonasis.com/dashboard', status: 'healthy' },
|
|
444
444
|
{ name: 'Documentation', url: 'https://docs.lanonasis.com/memory-services', status: 'healthy' },
|
|
445
445
|
{ name: 'Memory API', url: 'https://api.lanonasis.com/memories', status: 'healthy' },
|
|
446
|
-
{ name: 'MCP Server', url: 'https://
|
|
446
|
+
{ name: 'MCP Server', url: 'https://mcp.lanonasis.com/api/v1/events', status: 'healthy' },
|
|
447
447
|
{ name: 'Authentication', url: 'https://api.lanonasis.com/auth', status: 'healthy' }
|
|
448
448
|
];
|
|
449
449
|
for (const service of services) {
|
package/dist/index.js
CHANGED
|
@@ -382,7 +382,7 @@ deployCmd
|
|
|
382
382
|
console.log();
|
|
383
383
|
console.log(colors.highlight('🔧 API Services:'));
|
|
384
384
|
console.log(` Memory Service: ${colors.success('✅ https://api.lanonasis.com')}`);
|
|
385
|
-
console.log(` MCP Server: ${colors.success('✅
|
|
385
|
+
console.log(` MCP Server: ${colors.success('✅ mcp.lanonasis.com')}`);
|
|
386
386
|
console.log(` REST API: ${colors.success('✅ All endpoints active')}`);
|
|
387
387
|
console.log();
|
|
388
388
|
console.log(colors.highlight('📦 Package Distribution:'));
|
|
@@ -407,7 +407,7 @@ deployCmd
|
|
|
407
407
|
{ name: 'Dashboard', url: 'https://api.lanonasis.com/dashboard', status: 'healthy' },
|
|
408
408
|
{ name: 'Documentation', url: 'https://api.lanonasis.com/docs', status: 'healthy' },
|
|
409
409
|
{ name: 'Memory API', url: 'https://api.lanonasis.com/memories', status: 'healthy' },
|
|
410
|
-
{ name: 'MCP Server', url: 'https://
|
|
410
|
+
{ name: 'MCP Server', url: 'https://mcp.lanonasis.com/api/v1/events', status: 'healthy' },
|
|
411
411
|
{ name: 'Authentication', url: 'https://api.lanonasis.com/auth', status: 'healthy' }
|
|
412
412
|
];
|
|
413
413
|
for (const service of services) {
|
|
@@ -55,8 +55,8 @@ export class LanonasisMCPServer {
|
|
|
55
55
|
}
|
|
56
56
|
// Register tools, resources, and prompts after config is loaded
|
|
57
57
|
await this.registerTools();
|
|
58
|
-
this.registerResources();
|
|
59
|
-
this.registerPrompts();
|
|
58
|
+
await this.registerResources();
|
|
59
|
+
await this.registerPrompts();
|
|
60
60
|
if (this.options.verbose) {
|
|
61
61
|
console.log(chalk.cyan('🚀 Lanonasis MCP Server initialized'));
|
|
62
62
|
console.log(chalk.gray(`API URL: ${apiUrl}`));
|
|
@@ -338,8 +338,9 @@ export class LanonasisMCPServer {
|
|
|
338
338
|
/**
|
|
339
339
|
* Register MCP resources
|
|
340
340
|
*/
|
|
341
|
-
registerResources() {
|
|
342
|
-
|
|
341
|
+
async registerResources() {
|
|
342
|
+
const { ListResourcesRequestSchema, ReadResourceRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
|
|
343
|
+
this.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
343
344
|
resources: [
|
|
344
345
|
{
|
|
345
346
|
uri: 'memory://recent',
|
|
@@ -367,7 +368,7 @@ export class LanonasisMCPServer {
|
|
|
367
368
|
}
|
|
368
369
|
]
|
|
369
370
|
}));
|
|
370
|
-
this.server.setRequestHandler(
|
|
371
|
+
this.server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
371
372
|
const { uri } = request.params;
|
|
372
373
|
try {
|
|
373
374
|
const content = await this.handleResourceRead(uri);
|
|
@@ -389,8 +390,9 @@ export class LanonasisMCPServer {
|
|
|
389
390
|
/**
|
|
390
391
|
* Register MCP prompts
|
|
391
392
|
*/
|
|
392
|
-
registerPrompts() {
|
|
393
|
-
|
|
393
|
+
async registerPrompts() {
|
|
394
|
+
const { ListPromptsRequestSchema, GetPromptRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
|
|
395
|
+
this.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
394
396
|
prompts: [
|
|
395
397
|
{
|
|
396
398
|
name: 'create_memory',
|
|
@@ -421,7 +423,7 @@ export class LanonasisMCPServer {
|
|
|
421
423
|
}
|
|
422
424
|
]
|
|
423
425
|
}));
|
|
424
|
-
this.server.setRequestHandler(
|
|
426
|
+
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
425
427
|
const { name, arguments: args } = request.params;
|
|
426
428
|
const prompts = {
|
|
427
429
|
create_memory: {
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare class CLIConfig {
|
|
|
32
32
|
setAndSave(key: string, value: unknown): Promise<void>;
|
|
33
33
|
getMCPServerPath(): string;
|
|
34
34
|
getMCPServerUrl(): string;
|
|
35
|
+
getMCPRestUrl(): string;
|
|
36
|
+
getMCPSSEUrl(): string;
|
|
35
37
|
shouldUseRemoteMCP(): boolean;
|
|
36
38
|
}
|
|
37
39
|
export {};
|
package/dist/utils/config.js
CHANGED
|
@@ -46,9 +46,18 @@ export class CLIConfig {
|
|
|
46
46
|
try {
|
|
47
47
|
// Use axios instead of fetch for consistency
|
|
48
48
|
const axios = (await import('axios')).default;
|
|
49
|
-
const discoveryUrl = 'https://
|
|
49
|
+
const discoveryUrl = 'https://mcp.lanonasis.com/.well-known/onasis.json';
|
|
50
50
|
const response = await axios.get(discoveryUrl);
|
|
51
|
-
|
|
51
|
+
// Map discovery response to our config format
|
|
52
|
+
const discovered = response.data;
|
|
53
|
+
this.config.discoveredServices = {
|
|
54
|
+
auth_base: discovered.auth?.login?.replace('/auth/login', '') || 'https://api.lanonasis.com',
|
|
55
|
+
memory_base: 'https://api.lanonasis.com/api/v1',
|
|
56
|
+
mcp_base: discovered.endpoints?.http || 'https://mcp.lanonasis.com/api/v1',
|
|
57
|
+
mcp_ws_base: discovered.endpoints?.websocket || 'wss://mcp.lanonasis.com/ws',
|
|
58
|
+
mcp_sse_base: discovered.endpoints?.sse || 'https://mcp.lanonasis.com/api/v1/events',
|
|
59
|
+
project_scope: 'lanonasis-maas'
|
|
60
|
+
};
|
|
52
61
|
await this.save();
|
|
53
62
|
}
|
|
54
63
|
catch {
|
|
@@ -57,11 +66,13 @@ export class CLIConfig {
|
|
|
57
66
|
console.log('Service discovery failed, using fallback defaults');
|
|
58
67
|
}
|
|
59
68
|
// Set fallback service endpoints to prevent double slash issues
|
|
60
|
-
//
|
|
69
|
+
// Use mcp.lanonasis.com for MCP services (proxied to port 3001)
|
|
61
70
|
this.config.discoveredServices = {
|
|
62
71
|
auth_base: 'https://api.lanonasis.com', // CLI auth goes to central auth system
|
|
63
72
|
memory_base: 'https://api.lanonasis.com/api/v1', // Memory via onasis-core
|
|
64
|
-
|
|
73
|
+
mcp_base: 'https://mcp.lanonasis.com/api/v1', // MCP HTTP/REST
|
|
74
|
+
mcp_ws_base: 'wss://mcp.lanonasis.com/ws', // MCP WebSocket
|
|
75
|
+
mcp_sse_base: 'https://mcp.lanonasis.com/api/v1/events', // MCP SSE
|
|
65
76
|
project_scope: 'lanonasis-maas' // Correct project scope
|
|
66
77
|
};
|
|
67
78
|
await this.save();
|
|
@@ -182,7 +193,15 @@ export class CLIConfig {
|
|
|
182
193
|
getMCPServerUrl() {
|
|
183
194
|
return this.config.discoveredServices?.mcp_ws_base ||
|
|
184
195
|
this.config.mcpServerUrl ||
|
|
185
|
-
'
|
|
196
|
+
'wss://mcp.lanonasis.com/ws';
|
|
197
|
+
}
|
|
198
|
+
getMCPRestUrl() {
|
|
199
|
+
return this.config.discoveredServices?.mcp_base ||
|
|
200
|
+
'https://mcp.lanonasis.com/api/v1';
|
|
201
|
+
}
|
|
202
|
+
getMCPSSEUrl() {
|
|
203
|
+
return this.config.discoveredServices?.mcp_sse_base ||
|
|
204
|
+
'https://mcp.lanonasis.com/api/v1/events';
|
|
186
205
|
}
|
|
187
206
|
shouldUseRemoteMCP() {
|
|
188
207
|
const preference = this.config.mcpPreference || 'auto';
|
package/dist/utils/mcp-client.js
CHANGED
|
@@ -46,7 +46,8 @@ export class MCPClient {
|
|
|
46
46
|
// WebSocket connection mode for enterprise users
|
|
47
47
|
const wsUrlValue = options.serverUrl ??
|
|
48
48
|
this.config.get('mcpWebSocketUrl') ??
|
|
49
|
-
|
|
49
|
+
this.config.getMCPServerUrl() ??
|
|
50
|
+
'wss://mcp.lanonasis.com/ws';
|
|
50
51
|
wsUrl = wsUrlValue;
|
|
51
52
|
console.log(chalk.cyan(`Connecting to WebSocket MCP server at ${wsUrl}...`));
|
|
52
53
|
// Initialize WebSocket connection
|
|
@@ -58,7 +59,8 @@ export class MCPClient {
|
|
|
58
59
|
// For remote MCP, we'll use the REST API with MCP-style interface
|
|
59
60
|
const serverUrlValue = options.serverUrl ??
|
|
60
61
|
this.config.get('mcpServerUrl') ??
|
|
61
|
-
|
|
62
|
+
this.config.getMCPRestUrl() ??
|
|
63
|
+
'https://mcp.lanonasis.com/api/v1';
|
|
62
64
|
serverUrl = serverUrlValue;
|
|
63
65
|
console.log(chalk.cyan(`Connecting to remote MCP server at ${serverUrl}...`));
|
|
64
66
|
// Initialize SSE connection for real-time updates
|
|
@@ -105,7 +107,8 @@ export class MCPClient {
|
|
|
105
107
|
* Initialize SSE connection for real-time updates
|
|
106
108
|
*/
|
|
107
109
|
async initializeSSE(serverUrl) {
|
|
108
|
-
|
|
110
|
+
// Use the proper SSE endpoint from config
|
|
111
|
+
const sseUrl = this.config.getMCPSSEUrl() ?? `${serverUrl}/events`;
|
|
109
112
|
const token = this.config.get('token');
|
|
110
113
|
if (token) {
|
|
111
114
|
// EventSource doesn't support headers directly, append token to URL
|
|
@@ -257,7 +260,7 @@ export class MCPClient {
|
|
|
257
260
|
* Call remote tool via REST API with MCP interface
|
|
258
261
|
*/
|
|
259
262
|
async callRemoteTool(toolName, args) {
|
|
260
|
-
const apiUrl = this.config.
|
|
263
|
+
const apiUrl = this.config.getMCPRestUrl() ?? 'https://mcp.lanonasis.com/api/v1';
|
|
261
264
|
const token = this.config.get('token');
|
|
262
265
|
if (!token) {
|
|
263
266
|
throw new Error('Authentication required. Run "lanonasis auth login" first.');
|
|
@@ -316,6 +319,7 @@ export class MCPClient {
|
|
|
316
319
|
url: `${apiUrl}${endpoint}`,
|
|
317
320
|
headers: {
|
|
318
321
|
'Authorization': `Bearer ${token}`,
|
|
322
|
+
'x-api-key': String(token),
|
|
319
323
|
'Content-Type': 'application/json'
|
|
320
324
|
},
|
|
321
325
|
data: mapping.transform ? mapping.transform(args) : undefined,
|
package/package.json
CHANGED