@ngao/search 1.0.0-alpha.6 → 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 +50 -36
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -34543,29 +34543,32 @@ async function setupMCP() {
|
|
|
34543
34543
|
const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
|
|
34544
34544
|
const claudeConfigPath = path.join(homeDir, '.claude');
|
|
34545
34545
|
const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
|
|
34546
|
-
|
|
34547
|
-
|
|
34548
|
-
|
|
34546
|
+
// Claude Code extension uses VS Code settings in the workspace
|
|
34547
|
+
const vscodeSettingsPath = path.join(homeDir, '.vscode', 'settings.json');
|
|
34548
|
+
// Check if already set up in BOTH configs
|
|
34549
|
+
let claudeDesktopSetup = false;
|
|
34550
|
+
let vscodeSetup = false;
|
|
34549
34551
|
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34550
34552
|
const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34551
34553
|
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34552
|
-
|
|
34554
|
+
claudeDesktopSetup = true;
|
|
34553
34555
|
}
|
|
34554
34556
|
}
|
|
34555
|
-
if (
|
|
34556
|
-
const
|
|
34557
|
-
if (
|
|
34558
|
-
|
|
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;
|
|
34559
34561
|
}
|
|
34560
34562
|
}
|
|
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!');
|
|
34563
34566
|
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34564
34567
|
const port = '3000';
|
|
34565
34568
|
rl.close();
|
|
34566
34569
|
return { projectDir, port };
|
|
34567
34570
|
}
|
|
34568
|
-
// Ask for project directory
|
|
34571
|
+
// Ask for project directory only if not fully set up
|
|
34569
34572
|
const projectDir = await question('📁 Enter your project directory path (or press Enter for current): ');
|
|
34570
34573
|
const resolvedProjectDir = projectDir.trim() || process.cwd();
|
|
34571
34574
|
// Ask for port
|
|
@@ -34581,31 +34584,42 @@ async function setupMCP() {
|
|
|
34581
34584
|
MCP_TRANSPORT: 'stdio',
|
|
34582
34585
|
},
|
|
34583
34586
|
};
|
|
34584
|
-
// Setup Claude Desktop
|
|
34585
|
-
if (!
|
|
34586
|
-
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}`);
|
|
34600
|
+
}
|
|
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`);
|
|
34587
34622
|
}
|
|
34588
|
-
let claudeDesktopData = { mcpServers: {} };
|
|
34589
|
-
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34590
|
-
claudeDesktopData = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34591
|
-
}
|
|
34592
|
-
claudeDesktopData.mcpServers = claudeDesktopData.mcpServers || {};
|
|
34593
|
-
claudeDesktopData.mcpServers['ngao-search'] = ngaoServerConfig;
|
|
34594
|
-
fs.writeFileSync(claudeDesktopConfig, JSON.stringify(claudeDesktopData, null, 2));
|
|
34595
|
-
console.log(`\n✅ Claude Desktop config updated: ${claudeDesktopConfig}`);
|
|
34596
|
-
// Setup Claude Code (VSCode extension)
|
|
34597
|
-
const claudeCodePath = path.dirname(claudeCodeConfig);
|
|
34598
|
-
if (!fs.existsSync(claudeCodePath)) {
|
|
34599
|
-
fs.mkdirSync(claudeCodePath, { recursive: true });
|
|
34600
|
-
}
|
|
34601
|
-
let claudeCodeData = { mcpServers: {} };
|
|
34602
|
-
if (fs.existsSync(claudeCodeConfig)) {
|
|
34603
|
-
claudeCodeData = JSON.parse(fs.readFileSync(claudeCodeConfig, 'utf8'));
|
|
34604
|
-
}
|
|
34605
|
-
claudeCodeData.mcpServers = claudeCodeData.mcpServers || {};
|
|
34606
|
-
claudeCodeData.mcpServers['ngao-search'] = ngaoServerConfig;
|
|
34607
|
-
fs.writeFileSync(claudeCodeConfig, JSON.stringify(claudeCodeData, null, 2));
|
|
34608
|
-
console.log(`✅ Claude Code config updated: ${claudeCodeConfig}`);
|
|
34609
34623
|
// Create .ngao-search config in project
|
|
34610
34624
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34611
34625
|
if (!fs.existsSync(projectConfigPath)) {
|
|
@@ -34627,7 +34641,7 @@ async function setupMCP() {
|
|
|
34627
34641
|
console.log('📍 Project directory: ' + resolvedProjectDir);
|
|
34628
34642
|
console.log('🔌 Server port: ' + port);
|
|
34629
34643
|
console.log('📌 Claude Desktop config: ' + claudeDesktopConfig);
|
|
34630
|
-
console.log('📌 Claude Code config: ' +
|
|
34644
|
+
console.log('📌 Claude Code config: ' + vscodeSettingsPath);
|
|
34631
34645
|
console.log('📌 Project config: ' + projectConfigPath + '\n');
|
|
34632
34646
|
console.log('🚀 Next: Restart Claude Desktop and Claude Code to start using NGAO Search!\n');
|
|
34633
34647
|
rl.close();
|
package/package.json
CHANGED