domain-rag-mcp-server 3.0.0 → 3.1.0

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/index.mjs +139 -1
  2. package/package.json +2 -3
package/dist/index.mjs CHANGED
@@ -206,6 +206,10 @@ function buildConfig() {
206
206
  jira: getEnvFloat("WEIGHT_JIRA", 1),
207
207
  domainTerm: getEnvFloat("WEIGHT_DOMAIN_TERM", 1),
208
208
  confluence: getEnvFloat("WEIGHT_CONFLUENCE", 0.8)
209
+ },
210
+ codeSearchApi: {
211
+ enabled: getEnvBool("CODE_SEARCH_API_ENABLED", true),
212
+ url: getEnv("CODE_SEARCH_API_URL", "http://10.3.1.94:8085")
209
213
  }
210
214
  };
211
215
  }
@@ -837,6 +841,53 @@ async function initPostgres() {
837
841
  }
838
842
  }
839
843
  var tools = [
844
+ // ============================================
845
+ // Server Code Search Tools (HIGHEST PRIORITY)
846
+ // Direct search on server filesystem repositories
847
+ // ============================================
848
+ {
849
+ name: "search_server_code",
850
+ description: "HIGHEST PRIORITY - Search source code on the server. Searches across all indexed repositories. Use for finding implementations, classes, functions, or any code patterns. Much faster than vector search for exact matches.",
851
+ inputSchema: {
852
+ type: "object",
853
+ properties: {
854
+ query: {
855
+ type: "string",
856
+ description: "Search query - code pattern, class name, function, or text to find"
857
+ },
858
+ mode: {
859
+ type: "string",
860
+ enum: ["content", "filename"],
861
+ description: 'Search mode: "content" for grep-like search in file contents, "filename" for file name pattern matching',
862
+ default: "content"
863
+ },
864
+ repos: {
865
+ type: "array",
866
+ items: { type: "string" },
867
+ description: 'Filter by repository names (optional). Example: ["frontend", "backend"]'
868
+ },
869
+ extensions: {
870
+ type: "array",
871
+ items: { type: "string" },
872
+ description: 'File extensions to search (optional). Example: [".ts", ".cs"]'
873
+ },
874
+ limit: {
875
+ type: "number",
876
+ description: "Maximum results (default: 20)",
877
+ default: 20
878
+ }
879
+ },
880
+ required: ["query"]
881
+ }
882
+ },
883
+ {
884
+ name: "list_server_repos",
885
+ description: "List all source code repositories available on the server for code search.",
886
+ inputSchema: {
887
+ type: "object",
888
+ properties: {}
889
+ }
890
+ },
840
891
  // ============================================
841
892
  // PostgreSQL Structured Search Tools (High Priority)
842
893
  // These provide SQL-based search with structured data
@@ -1185,6 +1236,86 @@ var tools = [
1185
1236
  }
1186
1237
  }
1187
1238
  ];
1239
+ async function handleSearchServerCode(args) {
1240
+ if (!config.codeSearchApi.enabled) {
1241
+ return "Code Search API is disabled. Set CODE_SEARCH_API_ENABLED=true and CODE_SEARCH_API_URL to enable.";
1242
+ }
1243
+ try {
1244
+ const response = await fetch(`${config.codeSearchApi.url}/api/search`, {
1245
+ method: "POST",
1246
+ headers: { "Content-Type": "application/json" },
1247
+ body: JSON.stringify(args)
1248
+ });
1249
+ if (!response.ok) {
1250
+ const error = await response.text();
1251
+ return `Code Search API error: ${response.status} - ${error}`;
1252
+ }
1253
+ const data = await response.json();
1254
+ if (data.results.length === 0) {
1255
+ return `No code found matching "${args.query}".`;
1256
+ }
1257
+ let result = `## Server Code Search Results
1258
+
1259
+ `;
1260
+ result += `Found ${data.total} matches in ${data.searchTime}ms`;
1261
+ if (data.truncated) {
1262
+ result += ` (showing first ${data.results.length})`;
1263
+ }
1264
+ result += `
1265
+
1266
+ `;
1267
+ for (const r of data.results) {
1268
+ result += `### ${r.repo}/${r.relativePath}
1269
+ `;
1270
+ for (const match of r.matches) {
1271
+ if (match.line > 0) {
1272
+ result += `**Line ${match.line}:** \`${match.content.substring(0, 200)}${match.content.length > 200 ? "..." : ""}\`
1273
+ `;
1274
+ if (match.context.length > 0) {
1275
+ result += "```\n" + match.context.join("\n") + "\n```\n";
1276
+ }
1277
+ } else {
1278
+ result += `File: ${match.content}
1279
+ `;
1280
+ }
1281
+ }
1282
+ result += "\n---\n\n";
1283
+ }
1284
+ return result;
1285
+ } catch (error) {
1286
+ const message = error instanceof Error ? error.message : "Unknown error";
1287
+ return `Failed to connect to Code Search API at ${config.codeSearchApi.url}: ${message}`;
1288
+ }
1289
+ }
1290
+ async function handleListServerRepos() {
1291
+ if (!config.codeSearchApi.enabled) {
1292
+ return "Code Search API is disabled. Set CODE_SEARCH_API_ENABLED=true and CODE_SEARCH_API_URL to enable.";
1293
+ }
1294
+ try {
1295
+ const response = await fetch(`${config.codeSearchApi.url}/api/repos`);
1296
+ if (!response.ok) {
1297
+ const error = await response.text();
1298
+ return `Code Search API error: ${response.status} - ${error}`;
1299
+ }
1300
+ const data = await response.json();
1301
+ let result = `## Available Repositories
1302
+
1303
+ `;
1304
+ result += `Found ${data.count} repositories:
1305
+
1306
+ `;
1307
+ result += "| Repository | Path |\n";
1308
+ result += "|------------|------|\n";
1309
+ for (const repo of data.repos) {
1310
+ result += `| ${repo.name} | ${repo.path} |
1311
+ `;
1312
+ }
1313
+ return result;
1314
+ } catch (error) {
1315
+ const message = error instanceof Error ? error.message : "Unknown error";
1316
+ return `Failed to connect to Code Search API at ${config.codeSearchApi.url}: ${message}`;
1317
+ }
1318
+ }
1188
1319
  async function handleSearchStructured(args) {
1189
1320
  if (!pgAvailable) {
1190
1321
  return "PostgreSQL not available. Use vector search tools (search_as_analyst, search_knowledge) instead.";
@@ -1619,6 +1750,12 @@ async function main() {
1619
1750
  try {
1620
1751
  let result;
1621
1752
  switch (name) {
1753
+ case "search_server_code":
1754
+ result = await handleSearchServerCode(args);
1755
+ break;
1756
+ case "list_server_repos":
1757
+ result = await handleListServerRepos();
1758
+ break;
1622
1759
  case "search_structured":
1623
1760
  result = await handleSearchStructured(args);
1624
1761
  break;
@@ -1691,6 +1828,7 @@ async function main() {
1691
1828
  const transport = new StdioServerTransport();
1692
1829
  await server.connect(transport);
1693
1830
  const pgStatus = pgAvailable ? "connected" : "disabled";
1694
- console.error(`Domain RAG MCP Server v3.0 started (embedding: ${embeddingProvider.name}, qdrant: ${config.qdrant.url}, postgres: ${pgStatus})`);
1831
+ const codeSearchStatus = config.codeSearchApi.enabled ? config.codeSearchApi.url : "disabled";
1832
+ console.error(`Domain RAG MCP Server v3.1 started (embedding: ${embeddingProvider.name}, qdrant: ${config.qdrant.url}, postgres: ${pgStatus}, code-search: ${codeSearchStatus})`);
1695
1833
  }
1696
1834
  main().catch(console.error);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "domain-rag-mcp-server",
3
- "version": "3.0.0",
4
- "description": "MCP server for domain RAG search — connects to Qdrant + PostgreSQL for hybrid search across Jira, Confluence, Git commits, and code",
3
+ "version": "3.1.0",
4
+ "description": "MCP server for domain RAG search — connects to Qdrant + PostgreSQL + Code Search API for hybrid search across Jira, Confluence, Git commits, and server-side code repositories",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
7
7
  "bin": {
@@ -29,7 +29,6 @@
29
29
  "cursor"
30
30
  ],
31
31
  "dependencies": {
32
- "@domain-rag/shared": "file:../shared",
33
32
  "@modelcontextprotocol/sdk": "^1.0.0",
34
33
  "@qdrant/js-client-rest": "^1.7.0",
35
34
  "dotenv": "^16.3.1",