@ngao/search 1.0.0-alpha.3 ā 1.0.0-alpha.5
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 +39 -28
- package/package.json +3 -2
package/dist-bundled/main.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
/******/ (() => { // webpackBootstrap
|
|
2
3
|
/******/ var __webpack_modules__ = ({
|
|
3
4
|
|
|
@@ -33364,18 +33365,27 @@ const logger_1 = __webpack_require__(1789);
|
|
|
33364
33365
|
// Check for --setup flag for interactive setup
|
|
33365
33366
|
const args = process.argv.slice(2);
|
|
33366
33367
|
const setupMode = args.includes('--setup') || process.env.NGAO_SETUP === 'true';
|
|
33368
|
+
// When setup completes, auto-start in MCP stdio mode for Claude
|
|
33369
|
+
if (setupMode) {
|
|
33370
|
+
process.env.MCP_TRANSPORT = 'stdio';
|
|
33371
|
+
}
|
|
33367
33372
|
const transport = (process.env.MCP_TRANSPORT || 'http').toLowerCase();
|
|
33368
33373
|
const httpPort = process.env.PORT ? parseInt(process.env.PORT, 10) : 0; // 0 = random available port
|
|
33369
33374
|
/**
|
|
33370
33375
|
* Main async function
|
|
33371
33376
|
*/
|
|
33372
33377
|
async function main() {
|
|
33373
|
-
// Run setup first if requested
|
|
33378
|
+
// Run setup first if requested, then continue to start server
|
|
33374
33379
|
if (setupMode) {
|
|
33375
33380
|
try {
|
|
33376
33381
|
const { setupMCP } = await Promise.resolve().then(() => __importStar(__webpack_require__(5021)));
|
|
33377
|
-
await setupMCP();
|
|
33378
|
-
|
|
33382
|
+
const { projectDir, port } = await setupMCP();
|
|
33383
|
+
// Set environment vars for server startup
|
|
33384
|
+
process.env.NGAO_SEARCH_PROJECT = projectDir;
|
|
33385
|
+
if (port)
|
|
33386
|
+
process.env.NGAO_SEARCH_PORT = port;
|
|
33387
|
+
console.log('\nš Starting NGAO Search MCP server...\n');
|
|
33388
|
+
// Continue to server startup below
|
|
33379
33389
|
}
|
|
33380
33390
|
catch (error) {
|
|
33381
33391
|
console.error('Setup failed:', error);
|
|
@@ -34421,14 +34431,16 @@ async function setupMCP() {
|
|
|
34421
34431
|
console.log('\nš§ NGAO Search - MCP Setup for Claude\n');
|
|
34422
34432
|
const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
|
|
34423
34433
|
const claudeConfigPath = path.join(homeDir, '.claude');
|
|
34424
|
-
const
|
|
34434
|
+
const claudeConfigFile = path.join(claudeConfigPath, 'claude_desktop_config.json');
|
|
34425
34435
|
// Check if already set up
|
|
34426
|
-
if (fs.existsSync(
|
|
34427
|
-
const existingConfig = JSON.parse(fs.readFileSync(
|
|
34436
|
+
if (fs.existsSync(claudeConfigFile)) {
|
|
34437
|
+
const existingConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
|
|
34428
34438
|
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34429
|
-
console.log('ā
NGAO Search is already configured in Claude
|
|
34439
|
+
console.log('ā
NGAO Search is already configured in Claude Desktop!');
|
|
34440
|
+
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34441
|
+
const port = existingConfig.mcpServers['ngao-search'].env?.NGAO_SEARCH_PORT || '3000';
|
|
34430
34442
|
rl.close();
|
|
34431
|
-
return;
|
|
34443
|
+
return { projectDir, port };
|
|
34432
34444
|
}
|
|
34433
34445
|
}
|
|
34434
34446
|
// Ask for project directory
|
|
@@ -34442,23 +34454,24 @@ async function setupMCP() {
|
|
|
34442
34454
|
fs.mkdirSync(claudeConfigPath, { recursive: true });
|
|
34443
34455
|
}
|
|
34444
34456
|
// Read existing config or create new
|
|
34445
|
-
let
|
|
34446
|
-
if (fs.existsSync(
|
|
34447
|
-
|
|
34457
|
+
let claudeConfig = { mcpServers: {} };
|
|
34458
|
+
if (fs.existsSync(claudeConfigFile)) {
|
|
34459
|
+
claudeConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
|
|
34448
34460
|
}
|
|
34449
34461
|
// Add ngao-search server config
|
|
34450
|
-
|
|
34451
|
-
|
|
34462
|
+
claudeConfig.mcpServers = claudeConfig.mcpServers || {};
|
|
34463
|
+
claudeConfig.mcpServers['ngao-search'] = {
|
|
34452
34464
|
command: 'npx',
|
|
34453
34465
|
args: ['@ngao/search@alpha'],
|
|
34454
34466
|
env: {
|
|
34455
34467
|
NGAO_SEARCH_PORT: port,
|
|
34456
34468
|
NGAO_SEARCH_PROJECT: resolvedProjectDir,
|
|
34469
|
+
MCP_TRANSPORT: 'stdio',
|
|
34457
34470
|
},
|
|
34458
34471
|
};
|
|
34459
|
-
// Write config
|
|
34460
|
-
fs.writeFileSync(
|
|
34461
|
-
console.log(`\nā
|
|
34472
|
+
// Write to Claude Desktop config
|
|
34473
|
+
fs.writeFileSync(claudeConfigFile, JSON.stringify(claudeConfig, null, 2));
|
|
34474
|
+
console.log(`\nā
Claude Desktop config updated: ${claudeConfigFile}\n`);
|
|
34462
34475
|
// Create .ngao-search config in project
|
|
34463
34476
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34464
34477
|
if (!fs.existsSync(projectConfigPath)) {
|
|
@@ -34466,26 +34479,24 @@ async function setupMCP() {
|
|
|
34466
34479
|
port,
|
|
34467
34480
|
indexDir: path.join(resolvedProjectDir, '.ngao-search-index'),
|
|
34468
34481
|
includePaths: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.md'],
|
|
34469
|
-
excludePaths: ['node_modules/**', 'dist/**', '.git/**'],
|
|
34482
|
+
excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
|
|
34470
34483
|
};
|
|
34471
34484
|
fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
|
|
34472
34485
|
console.log(`ā
Project config created: ${projectConfigPath}\n`);
|
|
34473
34486
|
}
|
|
34474
34487
|
// Show setup instructions
|
|
34475
|
-
console.log('š Setup
|
|
34476
|
-
console.log('
|
|
34477
|
-
console.log('
|
|
34478
|
-
console.log('
|
|
34479
|
-
console.log('
|
|
34480
|
-
console.log('
|
|
34481
|
-
console.log('
|
|
34482
|
-
console.log(
|
|
34483
|
-
console.log(`š Server port: ${port}\n`);
|
|
34488
|
+
console.log('š Setup Complete!\n');
|
|
34489
|
+
console.log('⨠NGAO Search is now integrated with Claude Desktop');
|
|
34490
|
+
console.log('Starting server on port ' + port + '...\n');
|
|
34491
|
+
console.log('ā¹ļø Configuration Details:');
|
|
34492
|
+
console.log('š Project directory: ' + resolvedProjectDir);
|
|
34493
|
+
console.log('š Server port: ' + port);
|
|
34494
|
+
console.log('š Claude config: ' + claudeConfigFile);
|
|
34495
|
+
console.log('š Project config: ' + projectConfigPath + '\n');
|
|
34484
34496
|
rl.close();
|
|
34497
|
+
return { projectDir: resolvedProjectDir, port };
|
|
34485
34498
|
}
|
|
34486
34499
|
exports.setupMCP = setupMCP;
|
|
34487
|
-
// Run setup
|
|
34488
|
-
setupMCP().catch(console.error);
|
|
34489
34500
|
|
|
34490
34501
|
|
|
34491
34502
|
/***/ },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngao/search",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "NGAO Search - Model Context Protocol Server for Local Code/Document Search with LLM-Friendly Output",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "npm run build:backend && npm run clean:dist",
|
|
19
19
|
"build:backend": "webpack --config webpack.backend.config.js --mode production && tsc --emitDeclarationOnly",
|
|
20
|
-
"build:bundled": "BUNDLE=true webpack --config webpack.backend.config.js && npm run clean:dist:bundled",
|
|
20
|
+
"build:bundled": "BUNDLE=true webpack --config webpack.backend.config.js && npm run add:shebang && npm run clean:dist:bundled",
|
|
21
|
+
"add:shebang": "node -e \"const fs=require('fs');const f='dist-bundled/main.js';const c=fs.readFileSync(f,'utf8');if(!c.startsWith('#!')){fs.writeFileSync(f,'#!/usr/bin/env node\\n'+c);console.log('ā Shebang added');}\"",
|
|
21
22
|
"clean:dist": "rm -rf dist/backend dist/cli dist/mcp dist/shared dist/index.* dist/**/*.map dist/*.map 2>/dev/null; true",
|
|
22
23
|
"clean:dist:bundled": "rm -rf dist-bundled/backend dist-bundled/cli dist-bundled/mcp dist-bundled/shared dist-bundled/*.map 2>/dev/null; true",
|
|
23
24
|
"start": "npm run build && node dist/main.js",
|