@ngao/search 1.0.0-alpha.7 → 1.0.0-alpha.8
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 -30
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -34545,22 +34545,30 @@ async function setupMCP() {
|
|
|
34545
34545
|
const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
|
|
34546
34546
|
// Claude Code extension uses VS Code settings in the workspace
|
|
34547
34547
|
const vscodeSettingsPath = path.join(homeDir, '.vscode', 'settings.json');
|
|
34548
|
-
// Check if already set up
|
|
34549
|
-
let
|
|
34548
|
+
// Check if already set up in BOTH configs
|
|
34549
|
+
let claudeDesktopSetup = false;
|
|
34550
|
+
let vscodeSetup = false;
|
|
34550
34551
|
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34551
34552
|
const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34552
34553
|
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34553
|
-
|
|
34554
|
+
claudeDesktopSetup = true;
|
|
34554
34555
|
}
|
|
34555
34556
|
}
|
|
34556
|
-
if (
|
|
34557
|
-
|
|
34557
|
+
if (fs.existsSync(vscodeSettingsPath)) {
|
|
34558
|
+
const existingSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
|
|
34559
|
+
if (existingSettings['claude.mcp']?.servers?.['ngao-search']) {
|
|
34560
|
+
vscodeSetup = true;
|
|
34561
|
+
}
|
|
34562
|
+
}
|
|
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!');
|
|
34558
34566
|
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34559
34567
|
const port = '3000';
|
|
34560
34568
|
rl.close();
|
|
34561
34569
|
return { projectDir, port };
|
|
34562
34570
|
}
|
|
34563
|
-
// Ask for project directory
|
|
34571
|
+
// Ask for project directory only if not fully set up
|
|
34564
34572
|
const projectDir = await question('📁 Enter your project directory path (or press Enter for current): ');
|
|
34565
34573
|
const resolvedProjectDir = projectDir.trim() || process.cwd();
|
|
34566
34574
|
// Ask for port
|
|
@@ -34576,32 +34584,42 @@ async function setupMCP() {
|
|
|
34576
34584
|
MCP_TRANSPORT: 'stdio',
|
|
34577
34585
|
},
|
|
34578
34586
|
};
|
|
34579
|
-
// Setup Claude Desktop
|
|
34580
|
-
if (!
|
|
34581
|
-
fs.
|
|
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}`);
|
|
34582
34600
|
}
|
|
34583
|
-
|
|
34584
|
-
|
|
34585
|
-
|
|
34586
|
-
|
|
34587
|
-
|
|
34588
|
-
|
|
34589
|
-
|
|
34590
|
-
|
|
34591
|
-
|
|
34592
|
-
|
|
34593
|
-
|
|
34594
|
-
|
|
34595
|
-
|
|
34596
|
-
|
|
34597
|
-
|
|
34598
|
-
vscodeSettings
|
|
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`);
|
|
34599
34622
|
}
|
|
34600
|
-
vscodeSettings['claude.mcp'] = vscodeSettings['claude.mcp'] || {};
|
|
34601
|
-
vscodeSettings['claude.mcp'].servers = vscodeSettings['claude.mcp'].servers || {};
|
|
34602
|
-
vscodeSettings['claude.mcp'].servers['ngao-search'] = ngaoServerConfig;
|
|
34603
|
-
fs.writeFileSync(vscodeSettingsPath, JSON.stringify(vscodeSettings, null, 2));
|
|
34604
|
-
console.log(`✅ Claude Code (VSCode) config updated: ${vscodeSettingsPath}`);
|
|
34605
34623
|
// Create .ngao-search config in project
|
|
34606
34624
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34607
34625
|
if (!fs.existsSync(projectConfigPath)) {
|
package/package.json
CHANGED