@ngao/search 1.0.0-alpha.4 ā 1.0.0-alpha.6
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 +195 -37
- package/package.json +1 -1
package/dist-bundled/main.js
CHANGED
|
@@ -20114,7 +20114,7 @@ function _stringFormat(Class, format, fnOrRegex, _params = {}) {
|
|
|
20114
20114
|
* Used by the MCP SDK server to validate tool inputs
|
|
20115
20115
|
*/
|
|
20116
20116
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20117
|
-
exports.toolMetadata = exports.toolSchemas = exports.ListIndexedDirsInputSchema = exports.GetReindexStatusInputSchema = exports.StartReindexInputSchema = exports.GetSearchHistoryInputSchema = exports.GetFileStatisticsInputSchema = exports.GetIndexInfoInputSchema = exports.GetStatsInputSchema = exports.IndexInputSchema = exports.SearchInputSchema = void 0;
|
|
20117
|
+
exports.toolMetadata = exports.toolSchemas = exports.NGAO_DOCUMENTATION = exports.GetDocumentationInputSchema = exports.ListIndexedDirsInputSchema = exports.GetReindexStatusInputSchema = exports.StartReindexInputSchema = exports.GetSearchHistoryInputSchema = exports.GetFileStatisticsInputSchema = exports.GetIndexInfoInputSchema = exports.GetStatsInputSchema = exports.IndexInputSchema = exports.SearchInputSchema = void 0;
|
|
20118
20118
|
const zod_1 = __webpack_require__(7552);
|
|
20119
20119
|
/**
|
|
20120
20120
|
* Search tool input schema
|
|
@@ -20179,6 +20179,112 @@ exports.GetReindexStatusInputSchema = zod_1.z.object({
|
|
|
20179
20179
|
* List indexed dirs tool input schema (no parameters)
|
|
20180
20180
|
*/
|
|
20181
20181
|
exports.ListIndexedDirsInputSchema = zod_1.z.object({});
|
|
20182
|
+
/**
|
|
20183
|
+
* Get documentation tool input schema (no parameters)
|
|
20184
|
+
*/
|
|
20185
|
+
exports.GetDocumentationInputSchema = zod_1.z.object({});
|
|
20186
|
+
/**
|
|
20187
|
+
* NGAO Search Documentation
|
|
20188
|
+
*/
|
|
20189
|
+
exports.NGAO_DOCUMENTATION = `
|
|
20190
|
+
# NGAO Search - MCP Server Documentation
|
|
20191
|
+
|
|
20192
|
+
## Overview
|
|
20193
|
+
NGAO Search is a Model Context Protocol (MCP) server that provides Claude with the ability to search and understand your codebase.
|
|
20194
|
+
|
|
20195
|
+
## Available Tools
|
|
20196
|
+
|
|
20197
|
+
### 1. search
|
|
20198
|
+
Search through indexed code and documentation.
|
|
20199
|
+
- **query** (required): Search query (e.g., "authentication handler", "database connection")
|
|
20200
|
+
- **maxResults** (optional): Maximum results (default: 50)
|
|
20201
|
+
- **sessionId** (optional): Session ID for tracking search history
|
|
20202
|
+
|
|
20203
|
+
Example: Search for "user authentication" in your codebase
|
|
20204
|
+
|
|
20205
|
+
### 2. index
|
|
20206
|
+
Index a directory for searching.
|
|
20207
|
+
- **dirPath** (required): Directory path to index
|
|
20208
|
+
|
|
20209
|
+
Example: Index your project directory to make it searchable
|
|
20210
|
+
|
|
20211
|
+
### 3. get_stats
|
|
20212
|
+
Get indexing statistics about the current index.
|
|
20213
|
+
|
|
20214
|
+
### 4. get_index_info
|
|
20215
|
+
Get detailed information about the index including file breakdown by language and type.
|
|
20216
|
+
|
|
20217
|
+
### 5. get_file_statistics
|
|
20218
|
+
Get per-file statistics.
|
|
20219
|
+
- **filePath** (optional): Specific file path for detailed stats
|
|
20220
|
+
|
|
20221
|
+
### 6. list_indexed_dirs
|
|
20222
|
+
List all directories that are currently indexed.
|
|
20223
|
+
|
|
20224
|
+
### 7. get_search_history
|
|
20225
|
+
Get search history for a session.
|
|
20226
|
+
- **sessionId** (required): Session ID to retrieve history for
|
|
20227
|
+
|
|
20228
|
+
### 8. start_reindex
|
|
20229
|
+
Start a reindex operation to update the index.
|
|
20230
|
+
- **dirPath** (required): Directory to reindex
|
|
20231
|
+
- **mode** (optional): 'full', 'incremental', or 'smart' (default: incremental)
|
|
20232
|
+
|
|
20233
|
+
### 9. get_reindex_status
|
|
20234
|
+
Check the status of a reindex operation.
|
|
20235
|
+
- **reindexId** (required): Reindex operation ID
|
|
20236
|
+
|
|
20237
|
+
### 10. get_documentation
|
|
20238
|
+
Get this documentation about NGAO Search capabilities.
|
|
20239
|
+
|
|
20240
|
+
## Supported Languages
|
|
20241
|
+
- TypeScript/JavaScript
|
|
20242
|
+
- Python
|
|
20243
|
+
- JSON
|
|
20244
|
+
- YAML
|
|
20245
|
+
- Markdown
|
|
20246
|
+
|
|
20247
|
+
## How to Use
|
|
20248
|
+
|
|
20249
|
+
1. **Setup**: Run \`npx @ngao/search@alpha --setup\` to configure Claude Desktop integration
|
|
20250
|
+
|
|
20251
|
+
2. **Ask Claude**: Once setup, you can ask Claude questions about your code:
|
|
20252
|
+
- "How does authentication work in this project?"
|
|
20253
|
+
- "Find all database queries"
|
|
20254
|
+
- "Show me the error handling pattern"
|
|
20255
|
+
- "What's the structure of the config system?"
|
|
20256
|
+
|
|
20257
|
+
3. **Claude uses NGAO Search**: Behind the scenes, Claude uses the search tools to:
|
|
20258
|
+
- Search your codebase for relevant files
|
|
20259
|
+
- Extract code blocks and documentation
|
|
20260
|
+
- Understand the project structure
|
|
20261
|
+
- Provide accurate, context-aware answers
|
|
20262
|
+
|
|
20263
|
+
## Configuration
|
|
20264
|
+
|
|
20265
|
+
Project configuration is stored in \`.ngao-search.json\`:
|
|
20266
|
+
\`\`\`json
|
|
20267
|
+
{
|
|
20268
|
+
"port": 3000,
|
|
20269
|
+
"indexDir": ".ngao-search-index",
|
|
20270
|
+
"includePaths": ["**/*.ts", "**/*.js", "**/*.py", "**/*.md"],
|
|
20271
|
+
"excludePaths": ["node_modules/**", "dist/**", ".git/**"]
|
|
20272
|
+
}
|
|
20273
|
+
\`\`\`
|
|
20274
|
+
|
|
20275
|
+
## Tips for Best Results
|
|
20276
|
+
|
|
20277
|
+
1. **Index the right directories**: Make sure your project root is indexed
|
|
20278
|
+
2. **Use specific queries**: "Find authentication handlers" works better than "auth"
|
|
20279
|
+
3. **Provide context**: Tell Claude what you're working on
|
|
20280
|
+
4. **Ask follow-ups**: Claude remembers the search context
|
|
20281
|
+
|
|
20282
|
+
## Troubleshooting
|
|
20283
|
+
|
|
20284
|
+
- **No results**: Try simpler search terms
|
|
20285
|
+
- **Slow searches**: Large projects may take longer initially
|
|
20286
|
+
- **Need to reindex**: Run \`start_reindex\` with your project directory
|
|
20287
|
+
`;
|
|
20182
20288
|
/**
|
|
20183
20289
|
* All tool schemas as an object map
|
|
20184
20290
|
*/
|
|
@@ -20192,6 +20298,7 @@ exports.toolSchemas = {
|
|
|
20192
20298
|
start_reindex: exports.StartReindexInputSchema,
|
|
20193
20299
|
get_reindex_status: exports.GetReindexStatusInputSchema,
|
|
20194
20300
|
list_indexed_dirs: exports.ListIndexedDirsInputSchema,
|
|
20301
|
+
get_documentation: exports.GetDocumentationInputSchema,
|
|
20195
20302
|
};
|
|
20196
20303
|
/**
|
|
20197
20304
|
* Tool metadata mapping tool names to descriptions
|
|
@@ -20234,6 +20341,10 @@ exports.toolMetadata = {
|
|
|
20234
20341
|
description: 'List all indexed directories',
|
|
20235
20342
|
schema: exports.ListIndexedDirsInputSchema,
|
|
20236
20343
|
},
|
|
20344
|
+
get_documentation: {
|
|
20345
|
+
description: 'Get NGAO Search documentation and capabilities',
|
|
20346
|
+
schema: exports.GetDocumentationInputSchema,
|
|
20347
|
+
},
|
|
20237
20348
|
};
|
|
20238
20349
|
|
|
20239
20350
|
|
|
@@ -33365,18 +33476,27 @@ const logger_1 = __webpack_require__(1789);
|
|
|
33365
33476
|
// Check for --setup flag for interactive setup
|
|
33366
33477
|
const args = process.argv.slice(2);
|
|
33367
33478
|
const setupMode = args.includes('--setup') || process.env.NGAO_SETUP === 'true';
|
|
33479
|
+
// When setup completes, auto-start in MCP stdio mode for Claude
|
|
33480
|
+
if (setupMode) {
|
|
33481
|
+
process.env.MCP_TRANSPORT = 'stdio';
|
|
33482
|
+
}
|
|
33368
33483
|
const transport = (process.env.MCP_TRANSPORT || 'http').toLowerCase();
|
|
33369
33484
|
const httpPort = process.env.PORT ? parseInt(process.env.PORT, 10) : 0; // 0 = random available port
|
|
33370
33485
|
/**
|
|
33371
33486
|
* Main async function
|
|
33372
33487
|
*/
|
|
33373
33488
|
async function main() {
|
|
33374
|
-
// Run setup first if requested
|
|
33489
|
+
// Run setup first if requested, then continue to start server
|
|
33375
33490
|
if (setupMode) {
|
|
33376
33491
|
try {
|
|
33377
33492
|
const { setupMCP } = await Promise.resolve().then(() => __importStar(__webpack_require__(5021)));
|
|
33378
|
-
await setupMCP();
|
|
33379
|
-
|
|
33493
|
+
const { projectDir, port } = await setupMCP();
|
|
33494
|
+
// Set environment vars for server startup
|
|
33495
|
+
process.env.NGAO_SEARCH_PROJECT = projectDir;
|
|
33496
|
+
if (port)
|
|
33497
|
+
process.env.NGAO_SEARCH_PORT = port;
|
|
33498
|
+
console.log('\nš Starting NGAO Search MCP server...\n');
|
|
33499
|
+
// Continue to server startup below
|
|
33380
33500
|
}
|
|
33381
33501
|
catch (error) {
|
|
33382
33502
|
console.error('Setup failed:', error);
|
|
@@ -34422,44 +34542,70 @@ async function setupMCP() {
|
|
|
34422
34542
|
console.log('\nš§ NGAO Search - MCP Setup for Claude\n');
|
|
34423
34543
|
const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
|
|
34424
34544
|
const claudeConfigPath = path.join(homeDir, '.claude');
|
|
34425
|
-
const
|
|
34545
|
+
const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
|
|
34546
|
+
const claudeCodeConfig = path.join(homeDir, '.claude-code', 'config.json');
|
|
34426
34547
|
// Check if already set up
|
|
34427
|
-
|
|
34428
|
-
|
|
34548
|
+
let isAlreadySetup = false;
|
|
34549
|
+
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34550
|
+
const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34429
34551
|
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34430
|
-
|
|
34431
|
-
rl.close();
|
|
34432
|
-
return;
|
|
34552
|
+
isAlreadySetup = true;
|
|
34433
34553
|
}
|
|
34434
34554
|
}
|
|
34555
|
+
if (!isAlreadySetup && fs.existsSync(claudeCodeConfig)) {
|
|
34556
|
+
const existingConfig = JSON.parse(fs.readFileSync(claudeCodeConfig, 'utf8'));
|
|
34557
|
+
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34558
|
+
isAlreadySetup = true;
|
|
34559
|
+
}
|
|
34560
|
+
}
|
|
34561
|
+
if (isAlreadySetup) {
|
|
34562
|
+
console.log('ā
NGAO Search is already configured in Claude!');
|
|
34563
|
+
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34564
|
+
const port = '3000';
|
|
34565
|
+
rl.close();
|
|
34566
|
+
return { projectDir, port };
|
|
34567
|
+
}
|
|
34435
34568
|
// Ask for project directory
|
|
34436
34569
|
const projectDir = await question('š Enter your project directory path (or press Enter for current): ');
|
|
34437
34570
|
const resolvedProjectDir = projectDir.trim() || process.cwd();
|
|
34438
34571
|
// Ask for port
|
|
34439
34572
|
const portAnswer = await question('š Enter port for MCP server (default: 3000): ');
|
|
34440
34573
|
const port = portAnswer.trim() || '3000';
|
|
34441
|
-
//
|
|
34442
|
-
|
|
34443
|
-
fs.mkdirSync(claudeConfigPath, { recursive: true });
|
|
34444
|
-
}
|
|
34445
|
-
// Read existing config or create new
|
|
34446
|
-
let mcpConfig = { mcpServers: {} };
|
|
34447
|
-
if (fs.existsSync(mcpConfigFile)) {
|
|
34448
|
-
mcpConfig = JSON.parse(fs.readFileSync(mcpConfigFile, 'utf8'));
|
|
34449
|
-
}
|
|
34450
|
-
// Add ngao-search server config
|
|
34451
|
-
mcpConfig.mcpServers = mcpConfig.mcpServers || {};
|
|
34452
|
-
mcpConfig.mcpServers['ngao-search'] = {
|
|
34574
|
+
// Server config to add
|
|
34575
|
+
const ngaoServerConfig = {
|
|
34453
34576
|
command: 'npx',
|
|
34454
34577
|
args: ['@ngao/search@alpha'],
|
|
34455
34578
|
env: {
|
|
34456
34579
|
NGAO_SEARCH_PORT: port,
|
|
34457
34580
|
NGAO_SEARCH_PROJECT: resolvedProjectDir,
|
|
34581
|
+
MCP_TRANSPORT: 'stdio',
|
|
34458
34582
|
},
|
|
34459
34583
|
};
|
|
34460
|
-
//
|
|
34461
|
-
fs.
|
|
34462
|
-
|
|
34584
|
+
// Setup Claude Desktop
|
|
34585
|
+
if (!fs.existsSync(claudeConfigPath)) {
|
|
34586
|
+
fs.mkdirSync(claudeConfigPath, { recursive: true });
|
|
34587
|
+
}
|
|
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}`);
|
|
34463
34609
|
// Create .ngao-search config in project
|
|
34464
34610
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34465
34611
|
if (!fs.existsSync(projectConfigPath)) {
|
|
@@ -34467,26 +34613,27 @@ async function setupMCP() {
|
|
|
34467
34613
|
port,
|
|
34468
34614
|
indexDir: path.join(resolvedProjectDir, '.ngao-search-index'),
|
|
34469
34615
|
includePaths: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.md'],
|
|
34470
|
-
excludePaths: ['node_modules/**', 'dist/**', '.git/**'],
|
|
34616
|
+
excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
|
|
34471
34617
|
};
|
|
34472
34618
|
fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
|
|
34473
34619
|
console.log(`ā
Project config created: ${projectConfigPath}\n`);
|
|
34474
34620
|
}
|
|
34475
34621
|
// Show setup instructions
|
|
34476
|
-
console.log('š Setup
|
|
34477
|
-
console.log('
|
|
34478
|
-
console.log('
|
|
34479
|
-
console.log('
|
|
34480
|
-
console.log('
|
|
34481
|
-
console.log('
|
|
34482
|
-
console.log('
|
|
34483
|
-
console.log(
|
|
34484
|
-
console.log(
|
|
34622
|
+
console.log('\nš Setup Complete!\n');
|
|
34623
|
+
console.log('⨠NGAO Search is now integrated with:');
|
|
34624
|
+
console.log(' ⢠Claude Desktop');
|
|
34625
|
+
console.log(' ⢠Claude Code (VSCode extension)');
|
|
34626
|
+
console.log('\nā¹ļø Configuration Details:');
|
|
34627
|
+
console.log('š Project directory: ' + resolvedProjectDir);
|
|
34628
|
+
console.log('š Server port: ' + port);
|
|
34629
|
+
console.log('š Claude Desktop config: ' + claudeDesktopConfig);
|
|
34630
|
+
console.log('š Claude Code config: ' + claudeCodeConfig);
|
|
34631
|
+
console.log('š Project config: ' + projectConfigPath + '\n');
|
|
34632
|
+
console.log('š Next: Restart Claude Desktop and Claude Code to start using NGAO Search!\n');
|
|
34485
34633
|
rl.close();
|
|
34634
|
+
return { projectDir: resolvedProjectDir, port };
|
|
34486
34635
|
}
|
|
34487
34636
|
exports.setupMCP = setupMCP;
|
|
34488
|
-
// Run setup
|
|
34489
|
-
setupMCP().catch(console.error);
|
|
34490
34637
|
|
|
34491
34638
|
|
|
34492
34639
|
/***/ },
|
|
@@ -43862,6 +44009,7 @@ const mcp_js_1 = __webpack_require__(7011);
|
|
|
43862
44009
|
const stdio_js_1 = __webpack_require__(6166);
|
|
43863
44010
|
const zod_1 = __webpack_require__(7552);
|
|
43864
44011
|
const tool_registry_1 = __webpack_require__(8223);
|
|
44012
|
+
const tool_schemas_1 = __webpack_require__(2439);
|
|
43865
44013
|
/**
|
|
43866
44014
|
* MCP Transport - Handles MCP protocol over stdio
|
|
43867
44015
|
*/
|
|
@@ -44004,6 +44152,16 @@ class McpTransport {
|
|
|
44004
44152
|
],
|
|
44005
44153
|
};
|
|
44006
44154
|
});
|
|
44155
|
+
this.server.tool('get_documentation', 'Get NGAO Search documentation and capabilities', {}, async () => {
|
|
44156
|
+
return {
|
|
44157
|
+
content: [
|
|
44158
|
+
{
|
|
44159
|
+
type: 'text',
|
|
44160
|
+
text: tool_schemas_1.NGAO_DOCUMENTATION,
|
|
44161
|
+
},
|
|
44162
|
+
],
|
|
44163
|
+
};
|
|
44164
|
+
});
|
|
44007
44165
|
}
|
|
44008
44166
|
/**
|
|
44009
44167
|
* Route tool calls to service methods
|
package/package.json
CHANGED