@lanonasis/cli 2.0.2 → 2.0.4

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/utils/api.js CHANGED
@@ -13,7 +13,11 @@ export class APIClient {
13
13
  await this.config.init();
14
14
  // Service Discovery
15
15
  await this.config.discoverServices();
16
- config.baseURL = this.config.getDiscoveredApiUrl();
16
+ // Use appropriate base URL based on endpoint
17
+ const isAuthEndpoint = config.url?.includes('/auth/') || config.url?.includes('/login') || config.url?.includes('/register');
18
+ config.baseURL = isAuthEndpoint ?
19
+ (this.config.get('discoveredServices')?.auth_base || 'https://api.lanonasis.com/auth') :
20
+ this.config.getApiUrl();
17
21
  // Enhanced Authentication Support
18
22
  const token = this.config.getToken();
19
23
  const vendorKey = this.config.getVendorKey();
@@ -3,6 +3,7 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
3
3
  import chalk from 'chalk';
4
4
  import { CLIConfig } from './config.js';
5
5
  import * as path from 'path';
6
+ import * as fs from 'fs';
6
7
  import { EventSource } from 'eventsource';
7
8
  import { fileURLToPath } from 'url';
8
9
  import WebSocket from 'ws';
@@ -23,11 +24,12 @@ export class MCPClient {
23
24
  async connect(options = {}) {
24
25
  try {
25
26
  // Determine connection mode with priority to explicit mode option
27
+ // Default to 'remote' for better user experience
26
28
  const connectionMode = options.connectionMode ??
27
29
  (options.useWebSocket ? 'websocket' :
28
30
  options.useRemote ? 'remote' :
29
31
  this.config.get('mcpConnectionMode') ??
30
- this.config.get('mcpUseRemote') ? 'remote' : 'local');
32
+ this.config.get('mcpUseRemote') ? 'remote' : 'remote');
31
33
  let wsUrl;
32
34
  let serverUrl;
33
35
  let serverPath;
@@ -55,10 +57,17 @@ export class MCPClient {
55
57
  case 'local':
56
58
  default:
57
59
  {
58
- // Local MCP server connection
60
+ // Local MCP server connection - check if server exists
59
61
  serverPath = options.serverPath ??
60
62
  this.config.get('mcpServerPath') ??
61
63
  path.join(__dirname, '../../../../onasis-gateway/mcp-server/server.js');
64
+ // Check if the server file exists
65
+ if (!fs.existsSync(serverPath)) {
66
+ console.log(chalk.yellow(`⚠️ Local MCP server not found at ${serverPath}`));
67
+ console.log(chalk.cyan('💡 For remote connection, use: onasis mcp connect --url wss://mcp.lanonasis.com/ws'));
68
+ console.log(chalk.cyan('💡 Or install local server: npm install -g @lanonasis/mcp-server'));
69
+ throw new Error(`MCP server not found at ${serverPath}`);
70
+ }
62
71
  console.log(chalk.cyan(`Connecting to local MCP server at ${serverPath}...`));
63
72
  const localTransport = new StdioClientTransport({
64
73
  command: 'node',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
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": {