@ngao/search 1.0.0-alpha.5 → 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.
Files changed (2) hide show
  1. package/dist-bundled/main.js +177 -29
  2. package/package.json +1 -1
@@ -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,37 @@ 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 claudeConfigFile = path.join(claudeConfigPath, 'claude_desktop_config.json');
34545
+ const claudeDesktopConfig = path.join(claudeConfigPath, 'claude_desktop_config.json');
34546
+ const claudeCodeConfig = path.join(homeDir, '.claude-code', 'config.json');
34435
34547
  // Check if already set up
34436
- if (fs.existsSync(claudeConfigFile)) {
34437
- const existingConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
34548
+ let isAlreadySetup = false;
34549
+ if (fs.existsSync(claudeDesktopConfig)) {
34550
+ const existingConfig = JSON.parse(fs.readFileSync(claudeDesktopConfig, 'utf8'));
34438
34551
  if (existingConfig.mcpServers?.['ngao-search']) {
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';
34442
- rl.close();
34443
- return { projectDir, port };
34552
+ isAlreadySetup = true;
34444
34553
  }
34445
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
+ }
34446
34568
  // Ask for project directory
34447
34569
  const projectDir = await question('šŸ“ Enter your project directory path (or press Enter for current): ');
34448
34570
  const resolvedProjectDir = projectDir.trim() || process.cwd();
34449
34571
  // Ask for port
34450
34572
  const portAnswer = await question('šŸ”Œ Enter port for MCP server (default: 3000): ');
34451
34573
  const port = portAnswer.trim() || '3000';
34452
- // Create .claude directory if needed
34453
- if (!fs.existsSync(claudeConfigPath)) {
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'] = {
34574
+ // Server config to add
34575
+ const ngaoServerConfig = {
34464
34576
  command: 'npx',
34465
34577
  args: ['@ngao/search@alpha'],
34466
34578
  env: {
@@ -34469,9 +34581,31 @@ async function setupMCP() {
34469
34581
  MCP_TRANSPORT: 'stdio',
34470
34582
  },
34471
34583
  };
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`);
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}`);
34475
34609
  // Create .ngao-search config in project
34476
34610
  const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
34477
34611
  if (!fs.existsSync(projectConfigPath)) {
@@ -34485,14 +34619,17 @@ async function setupMCP() {
34485
34619
  console.log(`āœ… Project config created: ${projectConfigPath}\n`);
34486
34620
  }
34487
34621
  // Show setup instructions
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:');
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:');
34492
34627
  console.log('šŸ“ Project directory: ' + resolvedProjectDir);
34493
34628
  console.log('šŸ”Œ Server port: ' + port);
34494
- console.log('šŸ“Œ Claude config: ' + claudeConfigFile);
34629
+ console.log('šŸ“Œ Claude Desktop config: ' + claudeDesktopConfig);
34630
+ console.log('šŸ“Œ Claude Code config: ' + claudeCodeConfig);
34495
34631
  console.log('šŸ“Œ Project config: ' + projectConfigPath + '\n');
34632
+ console.log('šŸš€ Next: Restart Claude Desktop and Claude Code to start using NGAO Search!\n');
34496
34633
  rl.close();
34497
34634
  return { projectDir: resolvedProjectDir, port };
34498
34635
  }
@@ -43872,6 +44009,7 @@ const mcp_js_1 = __webpack_require__(7011);
43872
44009
  const stdio_js_1 = __webpack_require__(6166);
43873
44010
  const zod_1 = __webpack_require__(7552);
43874
44011
  const tool_registry_1 = __webpack_require__(8223);
44012
+ const tool_schemas_1 = __webpack_require__(2439);
43875
44013
  /**
43876
44014
  * MCP Transport - Handles MCP protocol over stdio
43877
44015
  */
@@ -44014,6 +44152,16 @@ class McpTransport {
44014
44152
  ],
44015
44153
  };
44016
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
+ });
44017
44165
  }
44018
44166
  /**
44019
44167
  * Route tool calls to service methods
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngao/search",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
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",