@ngao/search 1.0.0-alpha.4 → 1.0.0-alpha.5

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.
@@ -33365,18 +33365,27 @@ const logger_1 = __webpack_require__(1789);
33365
33365
  // Check for --setup flag for interactive setup
33366
33366
  const args = process.argv.slice(2);
33367
33367
  const setupMode = args.includes('--setup') || process.env.NGAO_SETUP === 'true';
33368
+ // When setup completes, auto-start in MCP stdio mode for Claude
33369
+ if (setupMode) {
33370
+ process.env.MCP_TRANSPORT = 'stdio';
33371
+ }
33368
33372
  const transport = (process.env.MCP_TRANSPORT || 'http').toLowerCase();
33369
33373
  const httpPort = process.env.PORT ? parseInt(process.env.PORT, 10) : 0; // 0 = random available port
33370
33374
  /**
33371
33375
  * Main async function
33372
33376
  */
33373
33377
  async function main() {
33374
- // Run setup first if requested
33378
+ // Run setup first if requested, then continue to start server
33375
33379
  if (setupMode) {
33376
33380
  try {
33377
33381
  const { setupMCP } = await Promise.resolve().then(() => __importStar(__webpack_require__(5021)));
33378
- await setupMCP();
33379
- process.exit(0);
33382
+ const { projectDir, port } = await setupMCP();
33383
+ // Set environment vars for server startup
33384
+ process.env.NGAO_SEARCH_PROJECT = projectDir;
33385
+ if (port)
33386
+ process.env.NGAO_SEARCH_PORT = port;
33387
+ console.log('\nšŸš€ Starting NGAO Search MCP server...\n');
33388
+ // Continue to server startup below
33380
33389
  }
33381
33390
  catch (error) {
33382
33391
  console.error('Setup failed:', error);
@@ -34422,14 +34431,16 @@ async function setupMCP() {
34422
34431
  console.log('\nšŸ”§ NGAO Search - MCP Setup for Claude\n');
34423
34432
  const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
34424
34433
  const claudeConfigPath = path.join(homeDir, '.claude');
34425
- const mcpConfigFile = path.join(claudeConfigPath, 'mcp.json');
34434
+ const claudeConfigFile = path.join(claudeConfigPath, 'claude_desktop_config.json');
34426
34435
  // Check if already set up
34427
- if (fs.existsSync(mcpConfigFile)) {
34428
- const existingConfig = JSON.parse(fs.readFileSync(mcpConfigFile, 'utf8'));
34436
+ if (fs.existsSync(claudeConfigFile)) {
34437
+ const existingConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
34429
34438
  if (existingConfig.mcpServers?.['ngao-search']) {
34430
- console.log('āœ… NGAO Search is already configured in Claude MCP!');
34439
+ console.log('āœ… NGAO Search is already configured in Claude Desktop!');
34440
+ const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
34441
+ const port = existingConfig.mcpServers['ngao-search'].env?.NGAO_SEARCH_PORT || '3000';
34431
34442
  rl.close();
34432
- return;
34443
+ return { projectDir, port };
34433
34444
  }
34434
34445
  }
34435
34446
  // Ask for project directory
@@ -34443,23 +34454,24 @@ async function setupMCP() {
34443
34454
  fs.mkdirSync(claudeConfigPath, { recursive: true });
34444
34455
  }
34445
34456
  // Read existing config or create new
34446
- let mcpConfig = { mcpServers: {} };
34447
- if (fs.existsSync(mcpConfigFile)) {
34448
- mcpConfig = JSON.parse(fs.readFileSync(mcpConfigFile, 'utf8'));
34457
+ let claudeConfig = { mcpServers: {} };
34458
+ if (fs.existsSync(claudeConfigFile)) {
34459
+ claudeConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
34449
34460
  }
34450
34461
  // Add ngao-search server config
34451
- mcpConfig.mcpServers = mcpConfig.mcpServers || {};
34452
- mcpConfig.mcpServers['ngao-search'] = {
34462
+ claudeConfig.mcpServers = claudeConfig.mcpServers || {};
34463
+ claudeConfig.mcpServers['ngao-search'] = {
34453
34464
  command: 'npx',
34454
34465
  args: ['@ngao/search@alpha'],
34455
34466
  env: {
34456
34467
  NGAO_SEARCH_PORT: port,
34457
34468
  NGAO_SEARCH_PROJECT: resolvedProjectDir,
34469
+ MCP_TRANSPORT: 'stdio',
34458
34470
  },
34459
34471
  };
34460
- // Write config file
34461
- fs.writeFileSync(mcpConfigFile, JSON.stringify(mcpConfig, null, 2));
34462
- console.log(`\nāœ… MCP configuration saved to: ${mcpConfigFile}\n`);
34472
+ // Write to Claude Desktop config
34473
+ fs.writeFileSync(claudeConfigFile, JSON.stringify(claudeConfig, null, 2));
34474
+ console.log(`\nāœ… Claude Desktop config updated: ${claudeConfigFile}\n`);
34463
34475
  // Create .ngao-search config in project
34464
34476
  const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
34465
34477
  if (!fs.existsSync(projectConfigPath)) {
@@ -34467,26 +34479,24 @@ async function setupMCP() {
34467
34479
  port,
34468
34480
  indexDir: path.join(resolvedProjectDir, '.ngao-search-index'),
34469
34481
  includePaths: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.md'],
34470
- excludePaths: ['node_modules/**', 'dist/**', '.git/**'],
34482
+ excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
34471
34483
  };
34472
34484
  fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
34473
34485
  console.log(`āœ… Project config created: ${projectConfigPath}\n`);
34474
34486
  }
34475
34487
  // Show setup instructions
34476
- console.log('šŸ“ Setup Instructions:\n');
34477
- console.log('1. Claude now has access to NGAO Search MCP server');
34478
- console.log('2. When you ask Claude about your code, it can:');
34479
- console.log(' - Search through your project files');
34480
- console.log(' - Index and understand your codebase');
34481
- console.log(' - Provide context-aware code suggestions\n');
34482
- console.log('3. Restart Claude Desktop for changes to take effect\n');
34483
- console.log(`šŸ“ Project directory: ${resolvedProjectDir}`);
34484
- console.log(`šŸ”Œ Server port: ${port}\n`);
34488
+ console.log('šŸ“ Setup Complete!\n');
34489
+ console.log('✨ NGAO Search is now integrated with Claude Desktop');
34490
+ console.log('Starting server on port ' + port + '...\n');
34491
+ console.log('ā„¹ļø Configuration Details:');
34492
+ console.log('šŸ“ Project directory: ' + resolvedProjectDir);
34493
+ console.log('šŸ”Œ Server port: ' + port);
34494
+ console.log('šŸ“Œ Claude config: ' + claudeConfigFile);
34495
+ console.log('šŸ“Œ Project config: ' + projectConfigPath + '\n');
34485
34496
  rl.close();
34497
+ return { projectDir: resolvedProjectDir, port };
34486
34498
  }
34487
34499
  exports.setupMCP = setupMCP;
34488
- // Run setup
34489
- setupMCP().catch(console.error);
34490
34500
 
34491
34501
 
34492
34502
  /***/ },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngao/search",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "NGAO Search - Model Context Protocol Server for Local Code/Document Search with LLM-Friendly Output",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/index.d.ts",