@ngao/search 1.0.0-alpha.1 ā 1.0.0-alpha.10
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 +402 -69
- package/package.json +6 -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
|
|
|
@@ -20113,7 +20114,7 @@ function _stringFormat(Class, format, fnOrRegex, _params = {}) {
|
|
|
20113
20114
|
* Used by the MCP SDK server to validate tool inputs
|
|
20114
20115
|
*/
|
|
20115
20116
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20116
|
-
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;
|
|
20117
20118
|
const zod_1 = __webpack_require__(7552);
|
|
20118
20119
|
/**
|
|
20119
20120
|
* Search tool input schema
|
|
@@ -20178,6 +20179,112 @@ exports.GetReindexStatusInputSchema = zod_1.z.object({
|
|
|
20178
20179
|
* List indexed dirs tool input schema (no parameters)
|
|
20179
20180
|
*/
|
|
20180
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
|
+
`;
|
|
20181
20288
|
/**
|
|
20182
20289
|
* All tool schemas as an object map
|
|
20183
20290
|
*/
|
|
@@ -20191,6 +20298,7 @@ exports.toolSchemas = {
|
|
|
20191
20298
|
start_reindex: exports.StartReindexInputSchema,
|
|
20192
20299
|
get_reindex_status: exports.GetReindexStatusInputSchema,
|
|
20193
20300
|
list_indexed_dirs: exports.ListIndexedDirsInputSchema,
|
|
20301
|
+
get_documentation: exports.GetDocumentationInputSchema,
|
|
20194
20302
|
};
|
|
20195
20303
|
/**
|
|
20196
20304
|
* Tool metadata mapping tool names to descriptions
|
|
@@ -20233,6 +20341,10 @@ exports.toolMetadata = {
|
|
|
20233
20341
|
description: 'List all indexed directories',
|
|
20234
20342
|
schema: exports.ListIndexedDirsInputSchema,
|
|
20235
20343
|
},
|
|
20344
|
+
get_documentation: {
|
|
20345
|
+
description: 'Get NGAO Search documentation and capabilities',
|
|
20346
|
+
schema: exports.GetDocumentationInputSchema,
|
|
20347
|
+
},
|
|
20236
20348
|
};
|
|
20237
20349
|
|
|
20238
20350
|
|
|
@@ -28821,6 +28933,14 @@ function fromJSONSchema(schema, params) {
|
|
|
28821
28933
|
}
|
|
28822
28934
|
|
|
28823
28935
|
|
|
28936
|
+
/***/ },
|
|
28937
|
+
|
|
28938
|
+
/***/ 3785
|
|
28939
|
+
(module) {
|
|
28940
|
+
|
|
28941
|
+
"use strict";
|
|
28942
|
+
module.exports = require("readline");
|
|
28943
|
+
|
|
28824
28944
|
/***/ },
|
|
28825
28945
|
|
|
28826
28946
|
/***/ 3835
|
|
@@ -33307,6 +33427,121 @@ exports.BlockImpl = BlockImpl;
|
|
|
33307
33427
|
"use strict";
|
|
33308
33428
|
module.exports = require("node:buffer");
|
|
33309
33429
|
|
|
33430
|
+
/***/ },
|
|
33431
|
+
|
|
33432
|
+
/***/ 4600
|
|
33433
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
33434
|
+
|
|
33435
|
+
"use strict";
|
|
33436
|
+
|
|
33437
|
+
/**
|
|
33438
|
+
* Unified Entry Point for NGAO Search
|
|
33439
|
+
* Supports multiple transport modes: stdio (MCP) or http (REST)
|
|
33440
|
+
*
|
|
33441
|
+
* Transport selection via environment variable:
|
|
33442
|
+
* - MCP_TRANSPORT=stdio - Start MCP stdio server only (for Claude Desktop)
|
|
33443
|
+
* - MCP_TRANSPORT=http - Start REST HTTP server only (default)
|
|
33444
|
+
* - --setup - Run interactive MCP setup for Claude
|
|
33445
|
+
*
|
|
33446
|
+
* All transports share the same NgaoSearchService instance
|
|
33447
|
+
*/
|
|
33448
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
33449
|
+
if (k2 === undefined) k2 = k;
|
|
33450
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
33451
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33452
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33453
|
+
}
|
|
33454
|
+
Object.defineProperty(o, k2, desc);
|
|
33455
|
+
}) : (function(o, m, k, k2) {
|
|
33456
|
+
if (k2 === undefined) k2 = k;
|
|
33457
|
+
o[k2] = m[k];
|
|
33458
|
+
}));
|
|
33459
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33460
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33461
|
+
}) : function(o, v) {
|
|
33462
|
+
o["default"] = v;
|
|
33463
|
+
});
|
|
33464
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33465
|
+
if (mod && mod.__esModule) return mod;
|
|
33466
|
+
var result = {};
|
|
33467
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33468
|
+
__setModuleDefault(result, mod);
|
|
33469
|
+
return result;
|
|
33470
|
+
};
|
|
33471
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
33472
|
+
const ngao_search_service_1 = __webpack_require__(9055);
|
|
33473
|
+
const mcp_transport_1 = __webpack_require__(6716);
|
|
33474
|
+
const rest_transport_1 = __webpack_require__(1256);
|
|
33475
|
+
const logger_1 = __webpack_require__(1789);
|
|
33476
|
+
// Check for --setup flag for interactive setup
|
|
33477
|
+
const args = process.argv.slice(2);
|
|
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
|
+
}
|
|
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
|
+
/**
|
|
33486
|
+
* Main async function
|
|
33487
|
+
*/
|
|
33488
|
+
async function main() {
|
|
33489
|
+
// Run setup first if requested, then continue to start server
|
|
33490
|
+
if (setupMode) {
|
|
33491
|
+
try {
|
|
33492
|
+
const { setupMCP } = await Promise.resolve().then(() => __importStar(__webpack_require__(5021)));
|
|
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
|
|
33500
|
+
}
|
|
33501
|
+
catch (error) {
|
|
33502
|
+
console.error('Setup failed:', error);
|
|
33503
|
+
process.exit(1);
|
|
33504
|
+
}
|
|
33505
|
+
}
|
|
33506
|
+
try {
|
|
33507
|
+
// Create shared service instance
|
|
33508
|
+
const service = new ngao_search_service_1.NgaoSearchService();
|
|
33509
|
+
switch (transport) {
|
|
33510
|
+
case 'stdio': {
|
|
33511
|
+
const logger = (0, logger_1.createLogger)('stdio');
|
|
33512
|
+
logger.info('Transport: MCP stdio (Claude Desktop)');
|
|
33513
|
+
logger.info('Initializing NgaoSearchService');
|
|
33514
|
+
const mcpTransport = new mcp_transport_1.McpTransport(service, logger);
|
|
33515
|
+
await mcpTransport.start();
|
|
33516
|
+
logger.info('NGAO Search server started successfully');
|
|
33517
|
+
break;
|
|
33518
|
+
}
|
|
33519
|
+
case 'http': {
|
|
33520
|
+
const logger = (0, logger_1.createLogger)('http');
|
|
33521
|
+
logger.info('Transport: HTTP REST API');
|
|
33522
|
+
logger.info('Initializing NgaoSearchService');
|
|
33523
|
+
const restTransport = new rest_transport_1.RestTransport(service, logger);
|
|
33524
|
+
restTransport.start(httpPort);
|
|
33525
|
+
logger.info('NGAO Search server started successfully');
|
|
33526
|
+
break;
|
|
33527
|
+
}
|
|
33528
|
+
default:
|
|
33529
|
+
console.error(`ā Unknown transport: ${transport}`);
|
|
33530
|
+
console.error(' Valid options: stdio, http');
|
|
33531
|
+
console.error(' Default: http');
|
|
33532
|
+
process.exit(1);
|
|
33533
|
+
}
|
|
33534
|
+
}
|
|
33535
|
+
catch (error) {
|
|
33536
|
+
console.error('ā Failed to start NGAO Search server:');
|
|
33537
|
+
console.error(error);
|
|
33538
|
+
process.exit(1);
|
|
33539
|
+
}
|
|
33540
|
+
}
|
|
33541
|
+
// Start the server
|
|
33542
|
+
main();
|
|
33543
|
+
|
|
33544
|
+
|
|
33310
33545
|
/***/ },
|
|
33311
33546
|
|
|
33312
33547
|
/***/ 4633
|
|
@@ -34257,6 +34492,154 @@ function parseLiteralDef(def, refs) {
|
|
|
34257
34492
|
exports.parseLiteralDef = parseLiteralDef;
|
|
34258
34493
|
|
|
34259
34494
|
|
|
34495
|
+
/***/ },
|
|
34496
|
+
|
|
34497
|
+
/***/ 5021
|
|
34498
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
34499
|
+
|
|
34500
|
+
"use strict";
|
|
34501
|
+
|
|
34502
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
34503
|
+
if (k2 === undefined) k2 = k;
|
|
34504
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
34505
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
34506
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34507
|
+
}
|
|
34508
|
+
Object.defineProperty(o, k2, desc);
|
|
34509
|
+
}) : (function(o, m, k, k2) {
|
|
34510
|
+
if (k2 === undefined) k2 = k;
|
|
34511
|
+
o[k2] = m[k];
|
|
34512
|
+
}));
|
|
34513
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34514
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34515
|
+
}) : function(o, v) {
|
|
34516
|
+
o["default"] = v;
|
|
34517
|
+
});
|
|
34518
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34519
|
+
if (mod && mod.__esModule) return mod;
|
|
34520
|
+
var result = {};
|
|
34521
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
34522
|
+
__setModuleDefault(result, mod);
|
|
34523
|
+
return result;
|
|
34524
|
+
};
|
|
34525
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
34526
|
+
exports.setupMCP = void 0;
|
|
34527
|
+
const fs = __importStar(__webpack_require__(9896));
|
|
34528
|
+
const path = __importStar(__webpack_require__(6928));
|
|
34529
|
+
const readline = __importStar(__webpack_require__(3785));
|
|
34530
|
+
const rl = readline.createInterface({
|
|
34531
|
+
input: process.stdin,
|
|
34532
|
+
output: process.stdout,
|
|
34533
|
+
});
|
|
34534
|
+
function question(prompt) {
|
|
34535
|
+
return new Promise((resolve) => {
|
|
34536
|
+
rl.question(prompt, (answer) => {
|
|
34537
|
+
resolve(answer);
|
|
34538
|
+
});
|
|
34539
|
+
});
|
|
34540
|
+
}
|
|
34541
|
+
async function setupMCP() {
|
|
34542
|
+
console.log('\nš§ NGAO Search - MCP Setup for Claude Code (VSCode)\n');
|
|
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
|
+
}
|
|
34569
|
+
// Ask for project directory
|
|
34570
|
+
const projectDir = await question('š Enter your project directory path (or press Enter for current): ');
|
|
34571
|
+
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
|
+
// Create .ngao-search config in project
|
|
34600
|
+
const projectConfigPath = path.join(resolvedProjectDir, '.ngao-search.json');
|
|
34601
|
+
if (!fs.existsSync(projectConfigPath)) {
|
|
34602
|
+
const projectConfig = {
|
|
34603
|
+
port,
|
|
34604
|
+
indexDir: path.join(resolvedProjectDir, '.ngao-search-index'),
|
|
34605
|
+
includePaths: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.py', '**/*.md'],
|
|
34606
|
+
excludePaths: ['node_modules/**', 'dist/**', '.git/**', '.ngao-search-index/**'],
|
|
34607
|
+
};
|
|
34608
|
+
fs.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2));
|
|
34609
|
+
console.log(`ā
Project config created: ${projectConfigPath}`);
|
|
34610
|
+
}
|
|
34611
|
+
// Create .mcp-config.json in project for Claude Code auto-detection
|
|
34612
|
+
const mcpConfigPath = path.join(resolvedProjectDir, '.mcp-config.json');
|
|
34613
|
+
const mcpConfig = {
|
|
34614
|
+
mcpServers: {
|
|
34615
|
+
'ngao-search': {
|
|
34616
|
+
command: 'npx',
|
|
34617
|
+
args: ['@ngao/search'],
|
|
34618
|
+
env: {
|
|
34619
|
+
NGAO_SEARCH_PROJECT: resolvedProjectDir,
|
|
34620
|
+
MCP_TRANSPORT: 'stdio',
|
|
34621
|
+
},
|
|
34622
|
+
},
|
|
34623
|
+
},
|
|
34624
|
+
};
|
|
34625
|
+
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
|
|
34626
|
+
console.log(`ā
MCP config created: ${mcpConfigPath}`);
|
|
34627
|
+
// Show setup instructions
|
|
34628
|
+
console.log('\nš Setup Complete!\n');
|
|
34629
|
+
console.log('⨠NGAO Search is now integrated with Claude Code');
|
|
34630
|
+
console.log('\nā¹ļø Configuration Details:');
|
|
34631
|
+
console.log('š Project directory: ' + resolvedProjectDir);
|
|
34632
|
+
console.log('š Server port: ' + port);
|
|
34633
|
+
console.log('š Claude Code global config: ' + vscodeSettingsPath);
|
|
34634
|
+
console.log('š Project config: ' + projectConfigPath);
|
|
34635
|
+
console.log('š MCP config: ' + mcpConfigPath + '\n');
|
|
34636
|
+
console.log('š Next: Restart VSCode to start using NGAO Search!\n');
|
|
34637
|
+
rl.close();
|
|
34638
|
+
return { projectDir: resolvedProjectDir, port };
|
|
34639
|
+
}
|
|
34640
|
+
exports.setupMCP = setupMCP;
|
|
34641
|
+
|
|
34642
|
+
|
|
34260
34643
|
/***/ },
|
|
34261
34644
|
|
|
34262
34645
|
/***/ 5039
|
|
@@ -43630,6 +44013,7 @@ const mcp_js_1 = __webpack_require__(7011);
|
|
|
43630
44013
|
const stdio_js_1 = __webpack_require__(6166);
|
|
43631
44014
|
const zod_1 = __webpack_require__(7552);
|
|
43632
44015
|
const tool_registry_1 = __webpack_require__(8223);
|
|
44016
|
+
const tool_schemas_1 = __webpack_require__(2439);
|
|
43633
44017
|
/**
|
|
43634
44018
|
* MCP Transport - Handles MCP protocol over stdio
|
|
43635
44019
|
*/
|
|
@@ -43772,6 +44156,16 @@ class McpTransport {
|
|
|
43772
44156
|
],
|
|
43773
44157
|
};
|
|
43774
44158
|
});
|
|
44159
|
+
this.server.tool('get_documentation', 'Get NGAO Search documentation and capabilities', {}, async () => {
|
|
44160
|
+
return {
|
|
44161
|
+
content: [
|
|
44162
|
+
{
|
|
44163
|
+
type: 'text',
|
|
44164
|
+
text: tool_schemas_1.NGAO_DOCUMENTATION,
|
|
44165
|
+
},
|
|
44166
|
+
],
|
|
44167
|
+
};
|
|
44168
|
+
});
|
|
43775
44169
|
}
|
|
43776
44170
|
/**
|
|
43777
44171
|
* Route tool calls to service methods
|
|
@@ -65974,74 +66368,13 @@ exports.PythonParser = PythonParser;
|
|
|
65974
66368
|
/******/ })();
|
|
65975
66369
|
/******/
|
|
65976
66370
|
/************************************************************************/
|
|
65977
|
-
|
|
65978
|
-
//
|
|
65979
|
-
|
|
65980
|
-
|
|
65981
|
-
var
|
|
65982
|
-
|
|
65983
|
-
|
|
65984
|
-
* Unified Entry Point for NGAO Search
|
|
65985
|
-
* Supports multiple transport modes: stdio (MCP) or http (REST)
|
|
65986
|
-
*
|
|
65987
|
-
* Transport selection via environment variable:
|
|
65988
|
-
* - MCP_TRANSPORT=stdio - Start MCP stdio server only (for Claude Desktop)
|
|
65989
|
-
* - MCP_TRANSPORT=http - Start REST HTTP server only (default)
|
|
65990
|
-
*
|
|
65991
|
-
* All transports share the same NgaoSearchService instance
|
|
65992
|
-
*/
|
|
65993
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
65994
|
-
const ngao_search_service_1 = __webpack_require__(9055);
|
|
65995
|
-
const mcp_transport_1 = __webpack_require__(6716);
|
|
65996
|
-
const rest_transport_1 = __webpack_require__(1256);
|
|
65997
|
-
const logger_1 = __webpack_require__(1789);
|
|
65998
|
-
const transport = (process.env.MCP_TRANSPORT || 'http').toLowerCase();
|
|
65999
|
-
const httpPort = process.env.PORT ? parseInt(process.env.PORT, 10) : 0; // 0 = random available port
|
|
66000
|
-
/**
|
|
66001
|
-
* Main async function
|
|
66002
|
-
*/
|
|
66003
|
-
async function main() {
|
|
66004
|
-
try {
|
|
66005
|
-
// Create shared service instance
|
|
66006
|
-
const service = new ngao_search_service_1.NgaoSearchService();
|
|
66007
|
-
switch (transport) {
|
|
66008
|
-
case 'stdio': {
|
|
66009
|
-
const logger = (0, logger_1.createLogger)('stdio');
|
|
66010
|
-
logger.info('Transport: MCP stdio (Claude Desktop)');
|
|
66011
|
-
logger.info('Initializing NgaoSearchService');
|
|
66012
|
-
const mcpTransport = new mcp_transport_1.McpTransport(service, logger);
|
|
66013
|
-
await mcpTransport.start();
|
|
66014
|
-
logger.info('NGAO Search server started successfully');
|
|
66015
|
-
break;
|
|
66016
|
-
}
|
|
66017
|
-
case 'http': {
|
|
66018
|
-
const logger = (0, logger_1.createLogger)('http');
|
|
66019
|
-
logger.info('Transport: HTTP REST API');
|
|
66020
|
-
logger.info('Initializing NgaoSearchService');
|
|
66021
|
-
const restTransport = new rest_transport_1.RestTransport(service, logger);
|
|
66022
|
-
restTransport.start(httpPort);
|
|
66023
|
-
logger.info('NGAO Search server started successfully');
|
|
66024
|
-
break;
|
|
66025
|
-
}
|
|
66026
|
-
default:
|
|
66027
|
-
console.error(`ā Unknown transport: ${transport}`);
|
|
66028
|
-
console.error(' Valid options: stdio, http');
|
|
66029
|
-
console.error(' Default: http');
|
|
66030
|
-
process.exit(1);
|
|
66031
|
-
}
|
|
66032
|
-
}
|
|
66033
|
-
catch (error) {
|
|
66034
|
-
console.error('ā Failed to start NGAO Search server:');
|
|
66035
|
-
console.error(error);
|
|
66036
|
-
process.exit(1);
|
|
66037
|
-
}
|
|
66038
|
-
}
|
|
66039
|
-
// Start the server
|
|
66040
|
-
main();
|
|
66041
|
-
|
|
66042
|
-
})();
|
|
66043
|
-
|
|
66044
|
-
module.exports = __webpack_exports__;
|
|
66371
|
+
/******/
|
|
66372
|
+
/******/ // startup
|
|
66373
|
+
/******/ // Load entry module and return exports
|
|
66374
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
66375
|
+
/******/ var __webpack_exports__ = __webpack_require__(4600);
|
|
66376
|
+
/******/ module.exports = __webpack_exports__;
|
|
66377
|
+
/******/
|
|
66045
66378
|
/******/ })()
|
|
66046
66379
|
;
|
|
66047
66380
|
//# sourceMappingURL=main.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngao/search",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
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",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"bin": {
|
|
8
11
|
"ngao-search": "dist-bundled/main.js"
|
|
9
12
|
},
|
|
@@ -14,7 +17,8 @@
|
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "npm run build:backend && npm run clean:dist",
|
|
16
19
|
"build:backend": "webpack --config webpack.backend.config.js --mode production && tsc --emitDeclarationOnly",
|
|
17
|
-
"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');}\"",
|
|
18
22
|
"clean:dist": "rm -rf dist/backend dist/cli dist/mcp dist/shared dist/index.* dist/**/*.map dist/*.map 2>/dev/null; true",
|
|
19
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",
|
|
20
24
|
"start": "npm run build && node dist/main.js",
|