@ngao/search 1.0.0-alpha.10 ā 1.0.0-alpha.12
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 +28 -65
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -33481,7 +33481,6 @@ if (setupMode) {
|
|
|
33481
33481
|
process.env.MCP_TRANSPORT = 'stdio';
|
|
33482
33482
|
}
|
|
33483
33483
|
const transport = (process.env.MCP_TRANSPORT || 'http').toLowerCase();
|
|
33484
|
-
const httpPort = process.env.PORT ? parseInt(process.env.PORT, 10) : 0; // 0 = random available port
|
|
33485
33484
|
/**
|
|
33486
33485
|
* Main async function
|
|
33487
33486
|
*/
|
|
@@ -33490,11 +33489,9 @@ async function main() {
|
|
|
33490
33489
|
if (setupMode) {
|
|
33491
33490
|
try {
|
|
33492
33491
|
const { setupMCP } = await Promise.resolve().then(() => __importStar(__webpack_require__(5021)));
|
|
33493
|
-
const { projectDir
|
|
33492
|
+
const { projectDir } = await setupMCP();
|
|
33494
33493
|
// Set environment vars for server startup
|
|
33495
33494
|
process.env.NGAO_SEARCH_PROJECT = projectDir;
|
|
33496
|
-
if (port)
|
|
33497
|
-
process.env.NGAO_SEARCH_PORT = port;
|
|
33498
33495
|
console.log('\nš Starting NGAO Search MCP server...\n');
|
|
33499
33496
|
// Continue to server startup below
|
|
33500
33497
|
}
|
|
@@ -33521,7 +33518,7 @@ async function main() {
|
|
|
33521
33518
|
logger.info('Transport: HTTP REST API');
|
|
33522
33519
|
logger.info('Initializing NgaoSearchService');
|
|
33523
33520
|
const restTransport = new rest_transport_1.RestTransport(service, logger);
|
|
33524
|
-
restTransport.start(
|
|
33521
|
+
restTransport.start(0); // 0 = randomly assigned available port
|
|
33525
33522
|
logger.info('NGAO Search server started successfully');
|
|
33526
33523
|
break;
|
|
33527
33524
|
}
|
|
@@ -34527,6 +34524,7 @@ exports.setupMCP = void 0;
|
|
|
34527
34524
|
const fs = __importStar(__webpack_require__(9896));
|
|
34528
34525
|
const path = __importStar(__webpack_require__(6928));
|
|
34529
34526
|
const readline = __importStar(__webpack_require__(3785));
|
|
34527
|
+
const child_process_1 = __webpack_require__(5317);
|
|
34530
34528
|
const rl = readline.createInterface({
|
|
34531
34529
|
input: process.stdin,
|
|
34532
34530
|
output: process.stdout,
|
|
@@ -34539,68 +34537,14 @@ function question(prompt) {
|
|
|
34539
34537
|
});
|
|
34540
34538
|
}
|
|
34541
34539
|
async function setupMCP() {
|
|
34542
|
-
console.log('\nš§ NGAO Search - MCP Setup for Claude Code
|
|
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
|
-
}
|
|
34540
|
+
console.log('\nš§ NGAO Search - MCP Setup for Claude Code\n');
|
|
34569
34541
|
// Ask for project directory
|
|
34570
34542
|
const projectDir = await question('š Enter your project directory path (or press Enter for current): ');
|
|
34571
34543
|
const resolvedProjectDir = projectDir.trim() || process.cwd();
|
|
34572
|
-
// Ask for port
|
|
34573
|
-
const portAnswer = await question('š Enter port for MCP server (default: 3000): ');
|
|
34574
|
-
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
34544
|
// Create .ngao-search config in project
|
|
34600
34545
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34601
34546
|
if (!fs.existsSync(projectConfigPath)) {
|
|
34602
34547
|
const projectConfig = {
|
|
34603
|
-
port,
|
|
34604
34548
|
indexDir: path.join(resolvedProjectDir, '.ngao-search-index'),
|
|
34605
34549
|
includePaths: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.md'],
|
|
34606
34550
|
excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
|
|
@@ -34608,7 +34552,7 @@ async function setupMCP() {
|
|
|
34608
34552
|
fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
|
|
34609
34553
|
console.log(`ā
Project config created: ${projectConfigPath}`);
|
|
34610
34554
|
}
|
|
34611
|
-
// Create .mcp-config.json in project for
|
|
34555
|
+
// Create .mcp-config.json in project for reference
|
|
34612
34556
|
const mcpConfigPath = path.join(resolvedProjectDir, '.mcp-config.json');
|
|
34613
34557
|
const mcpConfig = {
|
|
34614
34558
|
mcpServers: {
|
|
@@ -34624,18 +34568,29 @@ async function setupMCP() {
|
|
|
34624
34568
|
};
|
|
34625
34569
|
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
34626
34570
|
console.log(`ā
MCP config created: ${mcpConfigPath}`);
|
|
34571
|
+
// Register with Claude Code CLI using `claude mcp add`
|
|
34572
|
+
try {
|
|
34573
|
+
console.log('\nš” Registering with Claude Code CLI...');
|
|
34574
|
+
(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' });
|
|
34575
|
+
console.log('ā
MCP server registered with Claude Code CLI');
|
|
34576
|
+
}
|
|
34577
|
+
catch (error) {
|
|
34578
|
+
console.log('ā ļø Could not auto-register with Claude Code CLI.');
|
|
34579
|
+
console.log(' Please run this command manually in your project directory:');
|
|
34580
|
+
console.log(`\n cd "${resolvedProjectDir}"`);
|
|
34581
|
+
console.log(' claude mcp add -e NGAO_SEARCH_PROJECT="' + resolvedProjectDir + '" -e MCP_TRANSPORT=stdio -- ngao-search npx @ngao/search\n');
|
|
34582
|
+
}
|
|
34627
34583
|
// Show setup instructions
|
|
34628
34584
|
console.log('\nš Setup Complete!\n');
|
|
34629
34585
|
console.log('⨠NGAO Search is now integrated with Claude Code');
|
|
34630
34586
|
console.log('\nā¹ļø Configuration Details:');
|
|
34631
34587
|
console.log('š Project directory: ' + resolvedProjectDir);
|
|
34632
|
-
console.log('š Server port: '
|
|
34633
|
-
console.log('š Claude Code global config: ' + vscodeSettingsPath);
|
|
34588
|
+
console.log('š Server port: Automatically assigned');
|
|
34634
34589
|
console.log('š Project config: ' + projectConfigPath);
|
|
34635
34590
|
console.log('š MCP config: ' + mcpConfigPath + '\n');
|
|
34636
|
-
console.log('š
|
|
34591
|
+
console.log('š You can now use NGAO Search in Claude Code!\n');
|
|
34637
34592
|
rl.close();
|
|
34638
|
-
return { projectDir: resolvedProjectDir
|
|
34593
|
+
return { projectDir: resolvedProjectDir };
|
|
34639
34594
|
}
|
|
34640
34595
|
exports.setupMCP = setupMCP;
|
|
34641
34596
|
|
|
@@ -36704,6 +36659,14 @@ class YAMLParser extends base_file_parser_1.BaseFileParser {
|
|
|
36704
36659
|
exports.YAMLParser = YAMLParser;
|
|
36705
36660
|
|
|
36706
36661
|
|
|
36662
|
+
/***/ },
|
|
36663
|
+
|
|
36664
|
+
/***/ 5317
|
|
36665
|
+
(module) {
|
|
36666
|
+
|
|
36667
|
+
"use strict";
|
|
36668
|
+
module.exports = require("child_process");
|
|
36669
|
+
|
|
36707
36670
|
/***/ },
|
|
36708
36671
|
|
|
36709
36672
|
/***/ 5333
|
package/package.json
CHANGED