domain-rag-mcp-server 3.0.1 → 3.1.1
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/index.mjs +145 -3
- package/package.json +2 -2
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
|
}
|
|
@@ -838,12 +842,13 @@ async function initPostgres() {
|
|
|
838
842
|
}
|
|
839
843
|
var tools = [
|
|
840
844
|
// ============================================
|
|
841
|
-
// PostgreSQL Structured Search Tools (
|
|
845
|
+
// PostgreSQL Structured Search Tools (HIGHEST PRIORITY)
|
|
842
846
|
// These provide SQL-based search with structured data
|
|
847
|
+
// Lightweight, fast, and context-friendly
|
|
843
848
|
// ============================================
|
|
844
849
|
{
|
|
845
850
|
name: "search_structured",
|
|
846
|
-
description: "HIGHEST PRIORITY - Search structured Jira/Confluence data in PostgreSQL. Returns well-organized results with full metadata. Use this
|
|
851
|
+
description: "HIGHEST PRIORITY - Search structured Jira/Confluence data in PostgreSQL. Returns well-organized results with full metadata. Use this FIRST for any business or documentation queries. Lightweight and context-friendly.",
|
|
847
852
|
inputSchema: {
|
|
848
853
|
type: "object",
|
|
849
854
|
properties: {
|
|
@@ -1183,8 +1188,138 @@ var tools = [
|
|
|
1183
1188
|
type: "object",
|
|
1184
1189
|
properties: {}
|
|
1185
1190
|
}
|
|
1191
|
+
},
|
|
1192
|
+
// ============================================
|
|
1193
|
+
// Server Code Search Tools (LOW PRIORITY - use last)
|
|
1194
|
+
// Direct grep on server filesystem repositories
|
|
1195
|
+
// WARNING: Returns large responses that consume context window.
|
|
1196
|
+
// Prefer search_as_architect, search_structured, or search_knowledge first.
|
|
1197
|
+
// Only use this for targeted lookups (exact class name, specific file).
|
|
1198
|
+
// ============================================
|
|
1199
|
+
{
|
|
1200
|
+
name: "search_server_code",
|
|
1201
|
+
description: "LOW PRIORITY - Direct grep search on server source code repositories. WARNING: returns large responses that consume AI context window quickly. Use search_as_architect or search_structured FIRST. Only use this tool as a LAST RESORT for targeted lookups when you need exact code matches (specific class name, function signature, or file) and other tools did not return enough detail. Always specify repos[] filter and keep limit low (5-10).",
|
|
1202
|
+
inputSchema: {
|
|
1203
|
+
type: "object",
|
|
1204
|
+
properties: {
|
|
1205
|
+
query: {
|
|
1206
|
+
type: "string",
|
|
1207
|
+
description: "Search query - code pattern, class name, function, or text to find"
|
|
1208
|
+
},
|
|
1209
|
+
mode: {
|
|
1210
|
+
type: "string",
|
|
1211
|
+
enum: ["content", "filename"],
|
|
1212
|
+
description: 'Search mode: "content" for grep-like search in file contents, "filename" for file name pattern matching',
|
|
1213
|
+
default: "content"
|
|
1214
|
+
},
|
|
1215
|
+
repos: {
|
|
1216
|
+
type: "array",
|
|
1217
|
+
items: { type: "string" },
|
|
1218
|
+
description: 'Filter by repository names (RECOMMENDED to reduce response size). Example: ["frontend", "backend"]'
|
|
1219
|
+
},
|
|
1220
|
+
extensions: {
|
|
1221
|
+
type: "array",
|
|
1222
|
+
items: { type: "string" },
|
|
1223
|
+
description: 'File extensions to search (optional). Example: [".ts", ".cs"]'
|
|
1224
|
+
},
|
|
1225
|
+
limit: {
|
|
1226
|
+
type: "number",
|
|
1227
|
+
description: "Maximum results (default: 10, keep low to avoid context overflow)",
|
|
1228
|
+
default: 10
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
required: ["query"]
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
name: "list_server_repos",
|
|
1236
|
+
description: "List all source code repositories available on the server for code search.",
|
|
1237
|
+
inputSchema: {
|
|
1238
|
+
type: "object",
|
|
1239
|
+
properties: {}
|
|
1240
|
+
}
|
|
1186
1241
|
}
|
|
1187
1242
|
];
|
|
1243
|
+
async function handleSearchServerCode(args) {
|
|
1244
|
+
if (!config.codeSearchApi.enabled) {
|
|
1245
|
+
return "Code Search API is disabled. Set CODE_SEARCH_API_ENABLED=true and CODE_SEARCH_API_URL to enable.";
|
|
1246
|
+
}
|
|
1247
|
+
try {
|
|
1248
|
+
const response = await fetch(`${config.codeSearchApi.url}/api/search`, {
|
|
1249
|
+
method: "POST",
|
|
1250
|
+
headers: { "Content-Type": "application/json" },
|
|
1251
|
+
body: JSON.stringify(args)
|
|
1252
|
+
});
|
|
1253
|
+
if (!response.ok) {
|
|
1254
|
+
const error = await response.text();
|
|
1255
|
+
return `Code Search API error: ${response.status} - ${error}`;
|
|
1256
|
+
}
|
|
1257
|
+
const data = await response.json();
|
|
1258
|
+
if (data.results.length === 0) {
|
|
1259
|
+
return `No code found matching "${args.query}".`;
|
|
1260
|
+
}
|
|
1261
|
+
let result = `## Server Code Search Results
|
|
1262
|
+
|
|
1263
|
+
`;
|
|
1264
|
+
result += `Found ${data.total} matches in ${data.searchTime}ms`;
|
|
1265
|
+
if (data.truncated) {
|
|
1266
|
+
result += ` (showing first ${data.results.length})`;
|
|
1267
|
+
}
|
|
1268
|
+
result += `
|
|
1269
|
+
|
|
1270
|
+
`;
|
|
1271
|
+
for (const r of data.results) {
|
|
1272
|
+
result += `### ${r.repo}/${r.relativePath}
|
|
1273
|
+
`;
|
|
1274
|
+
for (const match of r.matches) {
|
|
1275
|
+
if (match.line > 0) {
|
|
1276
|
+
result += `**Line ${match.line}:** \`${match.content.substring(0, 200)}${match.content.length > 200 ? "..." : ""}\`
|
|
1277
|
+
`;
|
|
1278
|
+
if (match.context.length > 0) {
|
|
1279
|
+
result += "```\n" + match.context.join("\n") + "\n```\n";
|
|
1280
|
+
}
|
|
1281
|
+
} else {
|
|
1282
|
+
result += `File: ${match.content}
|
|
1283
|
+
`;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
result += "\n---\n\n";
|
|
1287
|
+
}
|
|
1288
|
+
return result;
|
|
1289
|
+
} catch (error) {
|
|
1290
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1291
|
+
return `Failed to connect to Code Search API at ${config.codeSearchApi.url}: ${message}`;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
async function handleListServerRepos() {
|
|
1295
|
+
if (!config.codeSearchApi.enabled) {
|
|
1296
|
+
return "Code Search API is disabled. Set CODE_SEARCH_API_ENABLED=true and CODE_SEARCH_API_URL to enable.";
|
|
1297
|
+
}
|
|
1298
|
+
try {
|
|
1299
|
+
const response = await fetch(`${config.codeSearchApi.url}/api/repos`);
|
|
1300
|
+
if (!response.ok) {
|
|
1301
|
+
const error = await response.text();
|
|
1302
|
+
return `Code Search API error: ${response.status} - ${error}`;
|
|
1303
|
+
}
|
|
1304
|
+
const data = await response.json();
|
|
1305
|
+
let result = `## Available Repositories
|
|
1306
|
+
|
|
1307
|
+
`;
|
|
1308
|
+
result += `Found ${data.count} repositories:
|
|
1309
|
+
|
|
1310
|
+
`;
|
|
1311
|
+
result += "| Repository | Path |\n";
|
|
1312
|
+
result += "|------------|------|\n";
|
|
1313
|
+
for (const repo of data.repos) {
|
|
1314
|
+
result += `| ${repo.name} | ${repo.path} |
|
|
1315
|
+
`;
|
|
1316
|
+
}
|
|
1317
|
+
return result;
|
|
1318
|
+
} catch (error) {
|
|
1319
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1320
|
+
return `Failed to connect to Code Search API at ${config.codeSearchApi.url}: ${message}`;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1188
1323
|
async function handleSearchStructured(args) {
|
|
1189
1324
|
if (!pgAvailable) {
|
|
1190
1325
|
return "PostgreSQL not available. Use vector search tools (search_as_analyst, search_knowledge) instead.";
|
|
@@ -1619,6 +1754,12 @@ async function main() {
|
|
|
1619
1754
|
try {
|
|
1620
1755
|
let result;
|
|
1621
1756
|
switch (name) {
|
|
1757
|
+
case "search_server_code":
|
|
1758
|
+
result = await handleSearchServerCode(args);
|
|
1759
|
+
break;
|
|
1760
|
+
case "list_server_repos":
|
|
1761
|
+
result = await handleListServerRepos();
|
|
1762
|
+
break;
|
|
1622
1763
|
case "search_structured":
|
|
1623
1764
|
result = await handleSearchStructured(args);
|
|
1624
1765
|
break;
|
|
@@ -1691,6 +1832,7 @@ async function main() {
|
|
|
1691
1832
|
const transport = new StdioServerTransport();
|
|
1692
1833
|
await server.connect(transport);
|
|
1693
1834
|
const pgStatus = pgAvailable ? "connected" : "disabled";
|
|
1694
|
-
|
|
1835
|
+
const codeSearchStatus = config.codeSearchApi.enabled ? config.codeSearchApi.url : "disabled";
|
|
1836
|
+
console.error(`Domain RAG MCP Server v3.1 started (embedding: ${embeddingProvider.name}, qdrant: ${config.qdrant.url}, postgres: ${pgStatus}, code-search: ${codeSearchStatus})`);
|
|
1695
1837
|
}
|
|
1696
1838
|
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domain-rag-mcp-server",
|
|
3
|
-
"version": "3.
|
|
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.1",
|
|
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": {
|