@ngao/search 1.0.0-alpha.8 → 1.0.0-alpha.9

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.
@@ -34539,36 +34539,34 @@ function question(prompt) {
34539
34539
  });
34540
34540
  }
34541
34541
  async function setupMCP() {
34542
- console.log('\nšŸ”§ NGAO Search - MCP Setup for Claude\n');
34542
+ console.log('\nšŸ”§ NGAO Search - MCP Setup for Claude Code (VSCode)\n');
34543
34543
  const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
34544
- const claudeConfigPath = path.join(homeDir, '.claude');
34545
- const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
34546
- // Claude Code extension uses VS Code settings in the workspace
34547
- const vscodeSettingsPath = path.join(homeDir, '.vscode', 'settings.json');
34548
- // Check if already set up in BOTH configs
34549
- let claudeDesktopSetup = false;
34550
- let vscodeSetup = false;
34551
- if (fs.existsSync(claudeDesktopConfig)) {
34552
- const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
34553
- if (existingConfig.mcpServers?.['ngao-search']) {
34554
- claudeDesktopSetup = true;
34555
- }
34544
+ // VSCode user settings path (macOS/Linux)
34545
+ let vscodeSettingsPath;
34546
+ if (process.platform === 'darwin') {
34547
+ // macOS
34548
+ vscodeSettingsPath = path.join(homeDir, 'Library/Application Support/Code/User/settings.json');
34549
+ }
34550
+ else if (process.platform === 'win32') {
34551
+ // Windows
34552
+ vscodeSettingsPath = path.join(homeDir, 'AppData/Roaming/Code/User/settings.json');
34556
34553
  }
34554
+ else {
34555
+ // Linux
34556
+ vscodeSettingsPath = path.join(homeDir, '.config/Code/User/settings.json');
34557
+ }
34558
+ // Check if already set up
34557
34559
  if (fs.existsSync(vscodeSettingsPath)) {
34558
34560
  const existingSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
34559
34561
  if (existingSettings['claude.mcp']?.servers?.['ngao-search']) {
34560
- vscodeSetup = true;
34562
+ console.log('āœ… NGAO Search is already configured in Claude Code!');
34563
+ const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
34564
+ const port = '3000';
34565
+ rl.close();
34566
+ return { projectDir, port };
34561
34567
  }
34562
34568
  }
34563
- // If both are already setup, skip to server start
34564
- if (claudeDesktopSetup && vscodeSetup) {
34565
- console.log('āœ… NGAO Search is already configured in both Claude Desktop and Claude Code!');
34566
- const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
34567
- const port = '3000';
34568
- rl.close();
34569
- return { projectDir, port };
34570
- }
34571
- // Ask for project directory only if not fully set up
34569
+ // Ask for project directory
34572
34570
  const projectDir = await question('šŸ“ Enter your project directory path (or press Enter for current): ');
34573
34571
  const resolvedProjectDir = projectDir.trim() || process.cwd();
34574
34572
  // Ask for port
@@ -34584,42 +34582,20 @@ async function setupMCP() {
34584
34582
  MCP_TRANSPORT: 'stdio',
34585
34583
  },
34586
34584
  };
34587
- // Setup Claude Desktop (if not already done)
34588
- if (!claudeDesktopSetup) {
34589
- if (!fs.existsSync(claudeConfigPath)) {
34590
- fs.mkdirSync(claudeConfigPath, { recursive: true });
34591
- }
34592
- let claudeDesktopData = { mcpServers: {} };
34593
- if (fs.existsSync(claudeDesktopConfig)) {
34594
- claudeDesktopData = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
34595
- }
34596
- claudeDesktopData.mcpServers = claudeDesktopData.mcpServers || {};
34597
- claudeDesktopData.mcpServers['ngao-search'] = ngaoServerConfig;
34598
- fs.writeFileSync(claudeDesktopConfig, JSON.stringify(claudeDesktopData, null, 2));
34599
- console.log(`\nāœ… Claude Desktop config updated: ${claudeDesktopConfig}`);
34585
+ // Setup Claude Code (VSCode)
34586
+ const vscodeSettingsDir = path.dirname(vscodeSettingsPath);
34587
+ if (!fs.existsSync(vscodeSettingsDir)) {
34588
+ fs.mkdirSync(vscodeSettingsDir, { recursive: true });
34600
34589
  }
34601
- else {
34602
- console.log(`\nāœ… Claude Desktop already configured`);
34603
- }
34604
- // Setup for Claude Code (VS Code extension) - if not already done
34605
- if (!vscodeSetup) {
34606
- const vscodeSettingsDir = path.dirname(vscodeSettingsPath);
34607
- if (!fs.existsSync(vscodeSettingsDir)) {
34608
- fs.mkdirSync(vscodeSettingsDir, { recursive: true });
34609
- }
34610
- let vscodeSettings = {};
34611
- if (fs.existsSync(vscodeSettingsPath)) {
34612
- vscodeSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
34613
- }
34614
- vscodeSettings['claude.mcp'] = vscodeSettings['claude.mcp'] || {};
34615
- vscodeSettings['claude.mcp'].servers = vscodeSettings['claude.mcp'].servers || {};
34616
- vscodeSettings['claude.mcp'].servers['ngao-search'] = ngaoServerConfig;
34617
- fs.writeFileSync(vscodeSettingsPath, JSON.stringify(vscodeSettings, null, 2));
34618
- console.log(`āœ… Claude Code (VSCode) config updated: ${vscodeSettingsPath}`);
34619
- }
34620
- else {
34621
- console.log(`āœ… Claude Code already configured`);
34590
+ let vscodeSettings = {};
34591
+ if (fs.existsSync(vscodeSettingsPath)) {
34592
+ vscodeSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
34622
34593
  }
34594
+ vscodeSettings['claude.mcp'] = vscodeSettings['claude.mcp'] || {};
34595
+ vscodeSettings['claude.mcp'].servers = vscodeSettings['claude.mcp'].servers || {};
34596
+ vscodeSettings['claude.mcp'].servers['ngao-search'] = ngaoServerConfig;
34597
+ fs.writeFileSync(vscodeSettingsPath, JSON.stringify(vscodeSettings, null, 2));
34598
+ console.log(`\nāœ… Claude Code (VSCode) config updated: ${vscodeSettingsPath}`);
34623
34599
  // Create .ngao-search config in project
34624
34600
  const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
34625
34601
  if (!fs.existsSync(projectConfigPath)) {
@@ -34630,20 +34606,34 @@ async function setupMCP() {
34630
34606
  excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
34631
34607
  };
34632
34608
  fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
34633
- console.log(`āœ… Project config created: ${projectConfigPath}\n`);
34634
- }
34609
+ console.log(`āœ… Project config created: ${projectConfigPath}`);
34610
+ }
34611
+ // Create .mcp-config.json in project for Claude Code auto-detection
34612
+ const mcpConfigPath = path.join(resolvedProjectDir, '.mcp-config.json');
34613
+ const mcpConfig = {
34614
+ mcpServers: {
34615
+ 'ngao-search': {
34616
+ command: 'npx',
34617
+ args: ['@ngao/search'],
34618
+ env: {
34619
+ NGAO_SEARCH_PROJECT: resolvedProjectDir,
34620
+ MCP_TRANSPORT: 'stdio',
34621
+ },
34622
+ },
34623
+ },
34624
+ };
34625
+ fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
34626
+ console.log(`āœ… MCP config created: ${mcpConfigPath}`);
34635
34627
  // Show setup instructions
34636
34628
  console.log('\nšŸ“ Setup Complete!\n');
34637
- console.log('✨ NGAO Search is now integrated with:');
34638
- console.log(' • Claude Desktop');
34639
- console.log(' • Claude Code (VSCode extension)');
34629
+ console.log('✨ NGAO Search is now integrated with Claude Code');
34640
34630
  console.log('\nā„¹ļø Configuration Details:');
34641
34631
  console.log('šŸ“ Project directory: ' + resolvedProjectDir);
34642
34632
  console.log('šŸ”Œ Server port: ' + port);
34643
- console.log('šŸ“Œ Claude Desktop config: ' + claudeDesktopConfig);
34644
- console.log('šŸ“Œ Claude Code config: ' + vscodeSettingsPath);
34645
- console.log('šŸ“Œ Project config: ' + projectConfigPath + '\n');
34646
- console.log('šŸš€ Next: Restart Claude Desktop and Claude Code to start using NGAO Search!\n');
34633
+ console.log('šŸ“Œ Claude Code global config: ' + vscodeSettingsPath);
34634
+ console.log('šŸ“Œ Project config: ' + projectConfigPath);
34635
+ console.log('šŸ“Œ MCP config: ' + mcpConfigPath + '\n');
34636
+ console.log('šŸš€ Next: Restart VSCode to start using NGAO Search!\n');
34647
34637
  rl.close();
34648
34638
  return { projectDir: resolvedProjectDir, port };
34649
34639
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngao/search",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
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",