@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.
- package/dist-bundled/main.js +48 -40
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -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
|
-
|
|
34545
|
-
|
|
34546
|
-
|
|
34547
|
-
|
|
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
|
-
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
34553
|
-
|
|
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
|
|
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(
|
|
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}
|
|
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
|
|
34626
|
-
console.log('š
|
|
34627
|
-
console.log('š
|
|
34628
|
-
console.log('š Next: Restart
|
|
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