@ngao/search 1.0.0-alpha.5 ā 1.0.0-alpha.7
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 +173 -29
- 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
|
|
|
@@ -34431,36 +34542,32 @@ async function setupMCP() {
|
|
|
34431
34542
|
console.log('\nš§ NGAO Search - MCP Setup for Claude\n');
|
|
34432
34543
|
const homeDir = process.env.HOME || process.env.USERPROFILE || '.';
|
|
34433
34544
|
const claudeConfigPath = path.join(homeDir, '.claude');
|
|
34434
|
-
const
|
|
34545
|
+
const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
|
|
34546
|
+
// Claude Code extension uses VS Code settings in the workspace
|
|
34547
|
+
const vscodeSettingsPath = path.join(homeDir, '.vscode', 'settings.json');
|
|
34435
34548
|
// Check if already set up
|
|
34436
|
-
|
|
34437
|
-
|
|
34549
|
+
let isAlreadySetup = false;
|
|
34550
|
+
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34551
|
+
const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34438
34552
|
if (existingConfig.mcpServers?.['ngao-search']) {
|
|
34439
|
-
|
|
34440
|
-
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34441
|
-
const port = existingConfig.mcpServers['ngao-search'].env?.NGAO_SEARCH_PORT || '3000';
|
|
34442
|
-
rl.close();
|
|
34443
|
-
return { projectDir, port };
|
|
34553
|
+
isAlreadySetup = true;
|
|
34444
34554
|
}
|
|
34445
34555
|
}
|
|
34556
|
+
if (isAlreadySetup) {
|
|
34557
|
+
console.log('ā
NGAO Search is already configured in Claude!');
|
|
34558
|
+
const projectDir = process.env.NGAO_SEARCH_PROJECT || process.cwd();
|
|
34559
|
+
const port = '3000';
|
|
34560
|
+
rl.close();
|
|
34561
|
+
return { projectDir, port };
|
|
34562
|
+
}
|
|
34446
34563
|
// Ask for project directory
|
|
34447
34564
|
const projectDir = await question('š Enter your project directory path (or press Enter for current): ');
|
|
34448
34565
|
const resolvedProjectDir = projectDir.trim() || process.cwd();
|
|
34449
34566
|
// Ask for port
|
|
34450
34567
|
const portAnswer = await question('š Enter port for MCP server (default: 3000): ');
|
|
34451
34568
|
const port = portAnswer.trim() || '3000';
|
|
34452
|
-
//
|
|
34453
|
-
|
|
34454
|
-
fs.mkdirSync(claudeConfigPath, { recursive: true });
|
|
34455
|
-
}
|
|
34456
|
-
// Read existing config or create new
|
|
34457
|
-
let claudeConfig = { mcpServers: {} };
|
|
34458
|
-
if (fs.existsSync(claudeConfigFile)) {
|
|
34459
|
-
claudeConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
|
|
34460
|
-
}
|
|
34461
|
-
// Add ngao-search server config
|
|
34462
|
-
claudeConfig.mcpServers = claudeConfig.mcpServers || {};
|
|
34463
|
-
claudeConfig.mcpServers['ngao-search'] = {
|
|
34569
|
+
// Server config to add
|
|
34570
|
+
const ngaoServerConfig = {
|
|
34464
34571
|
command: 'npx',
|
|
34465
34572
|
args: ['@ngao/search@alpha'],
|
|
34466
34573
|
env: {
|
|
@@ -34469,9 +34576,32 @@ async function setupMCP() {
|
|
|
34469
34576
|
MCP_TRANSPORT: 'stdio',
|
|
34470
34577
|
},
|
|
34471
34578
|
};
|
|
34472
|
-
//
|
|
34473
|
-
fs.
|
|
34474
|
-
|
|
34579
|
+
// Setup Claude Desktop
|
|
34580
|
+
if (!fs.existsSync(claudeConfigPath)) {
|
|
34581
|
+
fs.mkdirSync(claudeConfigPath, { recursive: true });
|
|
34582
|
+
}
|
|
34583
|
+
let claudeDesktopData = { mcpServers: {} };
|
|
34584
|
+
if (fs.existsSync(claudeDesktopConfig)) {
|
|
34585
|
+
claudeDesktopData = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
|
|
34586
|
+
}
|
|
34587
|
+
claudeDesktopData.mcpServers = claudeDesktopData.mcpServers || {};
|
|
34588
|
+
claudeDesktopData.mcpServers['ngao-search'] = ngaoServerConfig;
|
|
34589
|
+
fs.writeFileSync(claudeDesktopConfig, JSON.stringify(claudeDesktopData, null, 2));
|
|
34590
|
+
console.log(`\nā
Claude Desktop config updated: ${claudeDesktopConfig}`);
|
|
34591
|
+
// Setup for Claude Code (VS Code extension) - adds to workspace settings
|
|
34592
|
+
const vscodeSettingsDir = path.dirname(vscodeSettingsPath);
|
|
34593
|
+
if (!fs.existsSync(vscodeSettingsDir)) {
|
|
34594
|
+
fs.mkdirSync(vscodeSettingsDir, { recursive: true });
|
|
34595
|
+
}
|
|
34596
|
+
let vscodeSettings = {};
|
|
34597
|
+
if (fs.existsSync(vscodeSettingsPath)) {
|
|
34598
|
+
vscodeSettings = JSON.parse(fs.readFileSync(vscodeSettingsPath, 'utf8'));
|
|
34599
|
+
}
|
|
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}`);
|
|
34475
34605
|
// Create .ngao-search config in project
|
|
34476
34606
|
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34477
34607
|
if (!fs.existsSync(projectConfigPath)) {
|
|
@@ -34485,14 +34615,17 @@ async function setupMCP() {
|
|
|
34485
34615
|
console.log(`ā
Project config created: ${projectConfigPath}\n`);
|
|
34486
34616
|
}
|
|
34487
34617
|
// Show setup instructions
|
|
34488
|
-
console.log('š Setup Complete!\n');
|
|
34489
|
-
console.log('⨠NGAO Search is now integrated with
|
|
34490
|
-
console.log('
|
|
34491
|
-
console.log('
|
|
34618
|
+
console.log('\nš Setup Complete!\n');
|
|
34619
|
+
console.log('⨠NGAO Search is now integrated with:');
|
|
34620
|
+
console.log(' ⢠Claude Desktop');
|
|
34621
|
+
console.log(' ⢠Claude Code (VSCode extension)');
|
|
34622
|
+
console.log('\nā¹ļø Configuration Details:');
|
|
34492
34623
|
console.log('š Project directory: ' + resolvedProjectDir);
|
|
34493
34624
|
console.log('š Server port: ' + port);
|
|
34494
|
-
console.log('š Claude config: ' +
|
|
34625
|
+
console.log('š Claude Desktop config: ' + claudeDesktopConfig);
|
|
34626
|
+
console.log('š Claude Code config: ' + vscodeSettingsPath);
|
|
34495
34627
|
console.log('š Project config: ' + projectConfigPath + '\n');
|
|
34628
|
+
console.log('š Next: Restart Claude Desktop and Claude Code to start using NGAO Search!\n');
|
|
34496
34629
|
rl.close();
|
|
34497
34630
|
return { projectDir: resolvedProjectDir, port };
|
|
34498
34631
|
}
|
|
@@ -43872,6 +44005,7 @@ const mcp_js_1 = __webpack_require__(7011);
|
|
|
43872
44005
|
const stdio_js_1 = __webpack_require__(6166);
|
|
43873
44006
|
const zod_1 = __webpack_require__(7552);
|
|
43874
44007
|
const tool_registry_1 = __webpack_require__(8223);
|
|
44008
|
+
const tool_schemas_1 = __webpack_require__(2439);
|
|
43875
44009
|
/**
|
|
43876
44010
|
* MCP Transport - Handles MCP protocol over stdio
|
|
43877
44011
|
*/
|
|
@@ -44014,6 +44148,16 @@ class McpTransport {
|
|
|
44014
44148
|
],
|
|
44015
44149
|
};
|
|
44016
44150
|
});
|
|
44151
|
+
this.server.tool('get_documentation', 'Get NGAO Search documentation and capabilities', {}, async () => {
|
|
44152
|
+
return {
|
|
44153
|
+
content: [
|
|
44154
|
+
{
|
|
44155
|
+
type: 'text',
|
|
44156
|
+
text: tool_schemas_1.NGAO_DOCUMENTATION,
|
|
44157
|
+
},
|
|
44158
|
+
],
|
|
44159
|
+
};
|
|
44160
|
+
});
|
|
44017
44161
|
}
|
|
44018
44162
|
/**
|
|
44019
44163
|
* Route tool calls to service methods
|
package/package.json
CHANGED