@ngao/search 1.0.0-alpha.10 → 1.0.0-alpha.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.
@@ -34527,6 +34527,7 @@ exports.setupMCP = void 0;
34527
34527
  const fs = __importStar(__webpack_require__(9896));
34528
34528
  const path = __importStar(__webpack_require__(6928));
34529
34529
  const readline = __importStar(__webpack_require__(3785));
34530
+ const child_process_1 = __webpack_require__(5317);
34530
34531
  const rl = readline.createInterface({
34531
34532
  input: process.stdin,
34532
34533
  output: process.stdout,
@@ -34539,63 +34540,13 @@ function question(prompt) {
34539
34540
  });
34540
34541
  }
34541
34542
  async function setupMCP() {
34542
- console.log('\nšŸ”§ NGAO Search - MCP Setup for Claude Code (VSCode)\n');
34543
- const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
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
- }
34558
- // Check if already set up
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 };
34567
- }
34568
- }
34543
+ console.log('\nšŸ”§ NGAO Search - MCP Setup for Claude Code\n');
34569
34544
  // Ask for project directory
34570
34545
  const projectDir = await question('šŸ“ Enter your project directory path (or press Enter for current): ');
34571
34546
  const resolvedProjectDir = projectDir.trim() || process.cwd();
34572
34547
  // Ask for port
34573
34548
  const portAnswer = await question('šŸ”Œ Enter port for MCP server (default: 3000): ');
34574
34549
  const port = portAnswer.trim() || '3000';
34575
- // Server config to add
34576
- const ngaoServerConfig = {
34577
- command: 'npx',
34578
- args: ['@ngao/search'],
34579
- env: {
34580
- NGAO_SEARCH_PORT: port,
34581
- NGAO_SEARCH_PROJECT: resolvedProjectDir,
34582
- MCP_TRANSPORT: 'stdio',
34583
- },
34584
- };
34585
- // Setup Claude Code (VSCode)
34586
- const vscodeSettingsDir = path.dirname(vscodeSettingsPath);
34587
- if (!fs.existsSync(vscodeSettingsDir)) {
34588
- fs.mkdirSync(vscodeSettingsDir, { recursive: true });
34589
- }
34590
- let vscodeSettings = {};
34591
- if (fs.existsSync(vscodeSettingsPath)) {
34592
- vscodeSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
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}`);
34599
34550
  // Create .ngao-search config in project
34600
34551
  const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
34601
34552
  if (!fs.existsSync(projectConfigPath)) {
@@ -34608,7 +34559,7 @@ async function setupMCP() {
34608
34559
  fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
34609
34560
  console.log(`āœ… Project config created: ${projectConfigPath}`);
34610
34561
  }
34611
- // Create .mcp-config.json in project for Claude Code auto-detection
34562
+ // Create .mcp-config.json in project for reference
34612
34563
  const mcpConfigPath = path.join(resolvedProjectDir, '.mcp-config.json');
34613
34564
  const mcpConfig = {
34614
34565
  mcpServers: {
@@ -34624,16 +34575,27 @@ async function setupMCP() {
34624
34575
  };
34625
34576
  fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
34626
34577
  console.log(`āœ… MCP config created: ${mcpConfigPath}`);
34578
+ // Register with Claude Code CLI using `claude mcp add`
34579
+ try {
34580
+ console.log('\nšŸ“” Registering with Claude Code CLI...');
34581
+ (0, child_process_1.execSync)(`cd "${resolvedProjectDir}" && claude mcp add -e NGAO_SEARCH_PROJECT="${resolvedProjectDir}" -e MCP_TRANSPORT=stdio -- ngao-search npx @ngao/search`, { stdio: 'pipe' });
34582
+ console.log('āœ… MCP server registered with Claude Code CLI');
34583
+ }
34584
+ catch (error) {
34585
+ console.log('āš ļø Could not auto-register with Claude Code CLI.');
34586
+ console.log(' Please run this command manually in your project directory:');
34587
+ console.log(`\n cd "${resolvedProjectDir}"`);
34588
+ console.log(' claude mcp add -e NGAO_SEARCH_PROJECT="' + resolvedProjectDir + '" -e MCP_TRANSPORT=stdio -- ngao-search npx @ngao/search\n');
34589
+ }
34627
34590
  // Show setup instructions
34628
34591
  console.log('\nšŸ“ Setup Complete!\n');
34629
34592
  console.log('✨ NGAO Search is now integrated with Claude Code');
34630
34593
  console.log('\nā„¹ļø Configuration Details:');
34631
34594
  console.log('šŸ“ Project directory: ' + resolvedProjectDir);
34632
34595
  console.log('šŸ”Œ Server port: ' + port);
34633
- console.log('šŸ“Œ Claude Code global config: ' + vscodeSettingsPath);
34634
34596
  console.log('šŸ“Œ Project config: ' + projectConfigPath);
34635
34597
  console.log('šŸ“Œ MCP config: ' + mcpConfigPath + '\n');
34636
- console.log('šŸš€ Next: Restart VSCode to start using NGAO Search!\n');
34598
+ console.log('šŸš€ You can now use NGAO Search in Claude Code!\n');
34637
34599
  rl.close();
34638
34600
  return { projectDir: resolvedProjectDir, port };
34639
34601
  }
@@ -36704,6 +36666,14 @@ class YAMLParser extends base_file_parser_1.BaseFileParser {
36704
36666
  exports.YAMLParser = YAMLParser;
36705
36667
 
36706
36668
 
36669
+ /***/ },
36670
+
36671
+ /***/ 5317
36672
+ (module) {
36673
+
36674
+ "use strict";
36675
+ module.exports = require("child_process");
36676
+
36707
36677
  /***/ },
36708
36678
 
36709
36679
  /***/ 5333
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngao/search",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
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",