@ngao/search 1.0.0-alpha.7 → 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,27 +34539,33 @@ 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');
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');
34553
+ }
34554
+ else {
34555
+ // Linux
34556
+ vscodeSettingsPath = path.join(homeDir, '.config/Code/User/settings.json');
34557
+ }
34548
34558
  // Check if already set up
34549
- let isAlreadySetup = false;
34550
- if (fs.existsSync(claudeDesktopConfig)) {
34551
- const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
34552
- if (existingConfig.mcpServers?.['ngao-search']) {
34553
- isAlreadySetup = true;
34559
+ if (fs.existsSync(vscodeSettingsPath)) {
34560
+ const existingSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
34561
+ if (existingSettings['claude.mcp']?.servers?.['ngao-search']) {
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 };
34554
34567
  }
34555
34568
  }
34556
- if (isAlreadySetup) {
34557
- console.log('āœ… NGAO Search is already configured in Claude!');
34558
- const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
34559
- const port = '3000';
34560
- rl.close();
34561
- return { projectDir, port };
34562
- }
34563
34569
  // Ask for project directory
34564
34570
  const projectDir = await question('šŸ“ Enter your project directory path (or press Enter for current): ');
34565
34571
  const resolvedProjectDir = projectDir.trim() || process.cwd();
@@ -34576,19 +34582,7 @@ async function setupMCP() {
34576
34582
  MCP_TRANSPORT: 'stdio',
34577
34583
  },
34578
34584
  };
34579
- // Setup Claude Desktop
34580
- if (!fs.existsSync(claudeConfigPath)) {
34581
- fs.mkdirSync(claudeConfigPath, { recursive: true });
34582
- }
34583
- let claudeDesktopData = { mcpServers: {} };
34584
- if (fs.existsSync(claudeDesktopConfig)) {
34585
- claudeDesktopData = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
34586
- }
34587
- claudeDesktopData.mcpServers = claudeDesktopData.mcpServers || {};
34588
- claudeDesktopData.mcpServers['ngao-search'] = ngaoServerConfig;
34589
- fs.writeFileSync(claudeDesktopConfig, JSON.stringify(claudeDesktopData, null, 2));
34590
- console.log(`\nāœ… Claude Desktop config updated: ${claudeDesktopConfig}`);
34591
- // Setup for Claude Code (VS Code extension) - adds to workspace settings
34585
+ // Setup Claude Code (VSCode)
34592
34586
  const vscodeSettingsDir = path.dirname(vscodeSettingsPath);
34593
34587
  if (!fs.existsSync(vscodeSettingsDir)) {
34594
34588
  fs.mkdirSync(vscodeSettingsDir, { recursive: true });
@@ -34601,7 +34595,7 @@ async function setupMCP() {
34601
34595
  vscodeSettings['claude.mcp'].servers = vscodeSettings['claude.mcp'].servers || {};
34602
34596
  vscodeSettings['claude.mcp'].servers['ngao-search'] = ngaoServerConfig;
34603
34597
  fs.writeFileSync(vscodeSettingsPath, JSON.stringify(vscodeSettings, null, 2));
34604
- console.log(`āœ… Claude Code (VSCode) config updated: ${vscodeSettingsPath}`);
34598
+ console.log(`\nāœ… Claude Code (VSCode) config updated: ${vscodeSettingsPath}`);
34605
34599
  // Create .ngao-search config in project
34606
34600
  const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
34607
34601
  if (!fs.existsSync(projectConfigPath)) {
@@ -34612,20 +34606,34 @@ async function setupMCP() {
34612
34606
  excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
34613
34607
  };
34614
34608
  fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
34615
- console.log(`āœ… Project config created: ${projectConfigPath}\n`);
34616
- }
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}`);
34617
34627
  // Show setup instructions
34618
34628
  console.log('\nšŸ“ Setup Complete!\n');
34619
- console.log('✨ NGAO Search is now integrated with:');
34620
- console.log(' • Claude Desktop');
34621
- console.log(' • Claude Code (VSCode extension)');
34629
+ console.log('✨ NGAO Search is now integrated with Claude Code');
34622
34630
  console.log('\nā„¹ļø Configuration Details:');
34623
34631
  console.log('šŸ“ Project directory: ' + resolvedProjectDir);
34624
34632
  console.log('šŸ”Œ Server port: ' + port);
34625
- console.log('šŸ“Œ Claude Desktop config: ' + claudeDesktopConfig);
34626
- console.log('šŸ“Œ Claude Code config: ' + vscodeSettingsPath);
34627
- console.log('šŸ“Œ Project config: ' + projectConfigPath + '\n');
34628
- 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');
34629
34637
  rl.close();
34630
34638
  return { projectDir: resolvedProjectDir, port };
34631
34639
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngao/search",
3
- "version": "1.0.0-alpha.7",
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",