@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.
- package/dist-bundled/main.js +56 -66
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -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
|
-
|
|
34545
|
-
|
|
34546
|
-
|
|
34547
|
-
|
|
34548
|
-
|
|
34549
|
-
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
|
34588
|
-
|
|
34589
|
-
|
|
34590
|
-
|
|
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
|
-
|
|
34602
|
-
|
|
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}
|
|
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
|
|
34644
|
-
console.log('š
|
|
34645
|
-
console.log('š
|
|
34646
|
-
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');
|
|
34647
34637
|
rl.close();
|
|
34648
34638
|
return { projectDir: resolvedProjectDir, port };
|
|
34649
34639
|
}
|
package/package.json
CHANGED