@crowley/rag-mcp 1.0.5 → 1.0.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.
- package/dist/annotations.d.ts +16 -0
- package/dist/annotations.js +158 -0
- package/dist/context-enrichment.js +7 -0
- package/dist/formatters.d.ts +2 -0
- package/dist/formatters.js +12 -0
- package/dist/index.js +46 -47
- package/dist/schemas.d.ts +97 -0
- package/dist/schemas.js +128 -0
- package/dist/tool-middleware.d.ts +40 -0
- package/dist/tool-middleware.js +216 -0
- package/dist/tool-registry.js +2 -1
- package/dist/tools/advanced.d.ts +2 -2
- package/dist/tools/advanced.js +200 -275
- package/dist/tools/agents.d.ts +2 -2
- package/dist/tools/agents.js +59 -78
- package/dist/tools/analytics.d.ts +2 -2
- package/dist/tools/analytics.js +170 -210
- package/dist/tools/architecture.d.ts +2 -2
- package/dist/tools/architecture.js +506 -669
- package/dist/tools/ask.d.ts +2 -2
- package/dist/tools/ask.js +164 -219
- package/dist/tools/cache.d.ts +2 -2
- package/dist/tools/cache.js +63 -82
- package/dist/tools/clustering.d.ts +2 -2
- package/dist/tools/clustering.js +154 -215
- package/dist/tools/confluence.d.ts +2 -2
- package/dist/tools/confluence.js +80 -116
- package/dist/tools/database.d.ts +2 -2
- package/dist/tools/database.js +303 -380
- package/dist/tools/feedback.d.ts +2 -2
- package/dist/tools/feedback.js +143 -184
- package/dist/tools/guidelines.d.ts +2 -2
- package/dist/tools/guidelines.js +123 -135
- package/dist/tools/indexing.d.ts +2 -2
- package/dist/tools/indexing.js +100 -108
- package/dist/tools/memory.d.ts +2 -2
- package/dist/tools/memory.js +299 -485
- package/dist/tools/pm.d.ts +2 -2
- package/dist/tools/pm.js +367 -615
- package/dist/tools/review.d.ts +2 -2
- package/dist/tools/review.js +142 -189
- package/dist/tools/search.d.ts +2 -2
- package/dist/tools/search.js +230 -305
- package/dist/tools/session.d.ts +2 -2
- package/dist/tools/session.js +288 -345
- package/dist/tools/suggestions.d.ts +2 -2
- package/dist/tools/suggestions.js +425 -512
- package/dist/types.d.ts +19 -2
- package/package.json +4 -2
package/dist/tools/indexing.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* them to the RAG API in batches via POST /api/index/upload. This allows
|
|
7
7
|
* remote MCP clients to index codebases that aren't on the server filesystem.
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { ToolSpec } from "../types.js";
|
|
10
10
|
/**
|
|
11
11
|
* Create the indexing tools module with project-specific descriptions.
|
|
12
12
|
*/
|
|
13
|
-
export declare function createIndexingTools(projectName: string):
|
|
13
|
+
export declare function createIndexingTools(projectName: string): ToolSpec[];
|
package/dist/tools/indexing.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
import * as fs from "fs";
|
|
10
10
|
import * as path from "path";
|
|
11
11
|
import { glob } from "glob";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { TOOL_ANNOTATIONS } from "../annotations.js";
|
|
12
14
|
const DEFAULT_PATTERNS = [
|
|
13
15
|
"**/*.ts",
|
|
14
16
|
"**/*.tsx",
|
|
@@ -107,133 +109,123 @@ const STATUS_CACHE_TTL = 30 * 60 * 1000; // 30 minutes
|
|
|
107
109
|
* Create the indexing tools module with project-specific descriptions.
|
|
108
110
|
*/
|
|
109
111
|
export function createIndexingTools(projectName) {
|
|
110
|
-
|
|
112
|
+
return [
|
|
111
113
|
{
|
|
112
114
|
name: "index_codebase",
|
|
113
115
|
description: `Index or re-index the ${projectName} codebase for RAG search.`,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
116
|
+
schema: z.object({
|
|
117
|
+
path: z.string().optional().describe("Path to index (default: entire project)"),
|
|
118
|
+
force: z.boolean().optional().describe("Force re-index even if already indexed"),
|
|
119
|
+
}),
|
|
120
|
+
annotations: TOOL_ANNOTATIONS["index_codebase"],
|
|
121
|
+
handler: async (args, ctx) => {
|
|
122
|
+
const { path: indexPath, force = false } = args;
|
|
123
|
+
const projectPath = indexPath || ctx.projectPath;
|
|
124
|
+
const stats = await uploadFiles(ctx, projectPath, { force });
|
|
125
|
+
_statusCache = null; // Invalidate status cache after indexing
|
|
126
|
+
let result = `## Indexing ${projectName}\n\n`;
|
|
127
|
+
result += `- **Total files found:** ${stats.totalFiles}\n`;
|
|
128
|
+
result += `- **Files indexed:** ${stats.indexedFiles}\n`;
|
|
129
|
+
result += `- **Chunks created:** ${stats.totalChunks}\n`;
|
|
130
|
+
result += `- **Errors:** ${stats.errors}\n`;
|
|
131
|
+
result += `- **Duration:** ${stats.duration}ms\n`;
|
|
132
|
+
return result;
|
|
127
133
|
},
|
|
128
134
|
},
|
|
129
135
|
{
|
|
130
136
|
name: "get_index_status",
|
|
131
137
|
description: `Get the indexing status for ${projectName} codebase. Results cached for 30 minutes.`,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
schema: z.object({}),
|
|
139
|
+
outputSchema: z.object({
|
|
140
|
+
status: z.string(),
|
|
141
|
+
totalFiles: z.number().optional(),
|
|
142
|
+
indexedFiles: z.number().optional(),
|
|
143
|
+
lastUpdated: z.string().optional(),
|
|
144
|
+
vectorCount: z.number().optional(),
|
|
145
|
+
cached: z.boolean(),
|
|
146
|
+
}),
|
|
147
|
+
annotations: TOOL_ANNOTATIONS["get_index_status"],
|
|
148
|
+
handler: async (_args, ctx) => {
|
|
149
|
+
// Return cached result if still valid
|
|
150
|
+
if (_statusCache && Date.now() < _statusCache.expiresAt) {
|
|
151
|
+
const remainingMin = Math.round((_statusCache.expiresAt - Date.now()) / 60000);
|
|
152
|
+
return {
|
|
153
|
+
text: _statusCache.data + `\n_Cached (expires in ${remainingMin}min)_`,
|
|
154
|
+
structured: { ..._statusCache.structured, cached: true },
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const response = await ctx.api.get(`/api/index/status/${ctx.collectionPrefix}codebase`);
|
|
158
|
+
const data = response.data;
|
|
159
|
+
let text = `## Index Status: ${projectName}\n\n`;
|
|
160
|
+
text += `- **Status:** ${data.status || "unknown"}\n`;
|
|
161
|
+
text += `- **Total Files:** ${data.totalFiles ?? "N/A"}\n`;
|
|
162
|
+
text += `- **Indexed Files:** ${data.indexedFiles ?? "N/A"}\n`;
|
|
163
|
+
text += `- **Last Updated:** ${data.lastUpdated ? new Date(data.lastUpdated).toLocaleString() : "Never"}\n`;
|
|
164
|
+
text += `- **Vector Count:** ${data.vectorCount ?? "N/A"}\n`;
|
|
165
|
+
const structured = {
|
|
166
|
+
status: data.status || "unknown",
|
|
167
|
+
totalFiles: data.totalFiles,
|
|
168
|
+
indexedFiles: data.indexedFiles,
|
|
169
|
+
lastUpdated: data.lastUpdated,
|
|
170
|
+
vectorCount: data.vectorCount,
|
|
171
|
+
cached: false,
|
|
172
|
+
};
|
|
173
|
+
// Cache for 30 minutes
|
|
174
|
+
_statusCache = { data: text, expiresAt: Date.now() + STATUS_CACHE_TTL, structured };
|
|
175
|
+
return { text, structured };
|
|
135
176
|
},
|
|
136
177
|
},
|
|
137
178
|
{
|
|
138
179
|
name: "reindex_zero_downtime",
|
|
139
180
|
description: `Reindex ${projectName} codebase with zero downtime using alias swap.`,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
181
|
+
schema: z.object({
|
|
182
|
+
path: z.string().optional().describe("Path to index (default: entire project)"),
|
|
183
|
+
patterns: z.array(z.string()).optional().describe("File patterns to include (e.g., ['**/*.ts', '**/*.py'])"),
|
|
184
|
+
excludePatterns: z.array(z.string()).optional().describe("File patterns to exclude (e.g., ['node_modules/**'])"),
|
|
185
|
+
}),
|
|
186
|
+
annotations: TOOL_ANNOTATIONS["reindex_zero_downtime"],
|
|
187
|
+
handler: async (args, ctx) => {
|
|
188
|
+
const { path: indexPath, patterns, excludePatterns } = args;
|
|
189
|
+
const projectPath = indexPath || ctx.projectPath;
|
|
190
|
+
const stats = await uploadFiles(ctx, projectPath, {
|
|
191
|
+
patterns,
|
|
192
|
+
excludePatterns,
|
|
193
|
+
force: true,
|
|
194
|
+
});
|
|
195
|
+
_statusCache = null; // Invalidate status cache after reindex
|
|
196
|
+
let result = `## Reindex: ${projectName}\n\n`;
|
|
197
|
+
result += `- **Total files found:** ${stats.totalFiles}\n`;
|
|
198
|
+
result += `- **Files indexed:** ${stats.indexedFiles}\n`;
|
|
199
|
+
result += `- **Chunks created:** ${stats.totalChunks}\n`;
|
|
200
|
+
result += `- **Errors:** ${stats.errors}\n`;
|
|
201
|
+
result += `- **Duration:** ${stats.duration}ms\n`;
|
|
202
|
+
return result;
|
|
158
203
|
},
|
|
159
204
|
},
|
|
160
205
|
{
|
|
161
206
|
name: "list_aliases",
|
|
162
207
|
description: "List all collection aliases and their mappings.",
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
index_codebase: async (args, ctx) => {
|
|
171
|
-
const { path: indexPath, force = false } = args;
|
|
172
|
-
const projectPath = indexPath || ctx.projectPath;
|
|
173
|
-
const stats = await uploadFiles(ctx, projectPath, { force });
|
|
174
|
-
_statusCache = null; // Invalidate status cache after indexing
|
|
175
|
-
let result = `## Indexing ${projectName}\n\n`;
|
|
176
|
-
result += `- **Total files found:** ${stats.totalFiles}\n`;
|
|
177
|
-
result += `- **Files indexed:** ${stats.indexedFiles}\n`;
|
|
178
|
-
result += `- **Chunks created:** ${stats.totalChunks}\n`;
|
|
179
|
-
result += `- **Errors:** ${stats.errors}\n`;
|
|
180
|
-
result += `- **Duration:** ${stats.duration}ms\n`;
|
|
181
|
-
return result;
|
|
182
|
-
},
|
|
183
|
-
get_index_status: async (_args, ctx) => {
|
|
184
|
-
// Return cached result if still valid
|
|
185
|
-
if (_statusCache && Date.now() < _statusCache.expiresAt) {
|
|
186
|
-
const remainingMin = Math.round((_statusCache.expiresAt - Date.now()) / 60000);
|
|
187
|
-
return _statusCache.data + `\n_Cached (expires in ${remainingMin}min)_`;
|
|
188
|
-
}
|
|
189
|
-
const response = await ctx.api.get(`/api/index/status/${ctx.collectionPrefix}codebase`);
|
|
190
|
-
const data = response.data;
|
|
191
|
-
let result = `## Index Status: ${projectName}\n\n`;
|
|
192
|
-
result += `- **Status:** ${data.status || "unknown"}\n`;
|
|
193
|
-
result += `- **Total Files:** ${data.totalFiles ?? "N/A"}\n`;
|
|
194
|
-
result += `- **Indexed Files:** ${data.indexedFiles ?? "N/A"}\n`;
|
|
195
|
-
result += `- **Last Updated:** ${data.lastUpdated ? new Date(data.lastUpdated).toLocaleString() : "Never"}\n`;
|
|
196
|
-
result += `- **Vector Count:** ${data.vectorCount ?? "N/A"}\n`;
|
|
197
|
-
// Cache for 30 minutes
|
|
198
|
-
_statusCache = { data: result, expiresAt: Date.now() + STATUS_CACHE_TTL };
|
|
199
|
-
return result;
|
|
200
|
-
},
|
|
201
|
-
reindex_zero_downtime: async (args, ctx) => {
|
|
202
|
-
const { path: indexPath, patterns, excludePatterns } = args;
|
|
203
|
-
const projectPath = indexPath || ctx.projectPath;
|
|
204
|
-
const stats = await uploadFiles(ctx, projectPath, {
|
|
205
|
-
patterns,
|
|
206
|
-
excludePatterns,
|
|
207
|
-
force: true,
|
|
208
|
-
});
|
|
209
|
-
_statusCache = null; // Invalidate status cache after reindex
|
|
210
|
-
let result = `## Reindex: ${projectName}\n\n`;
|
|
211
|
-
result += `- **Total files found:** ${stats.totalFiles}\n`;
|
|
212
|
-
result += `- **Files indexed:** ${stats.indexedFiles}\n`;
|
|
213
|
-
result += `- **Chunks created:** ${stats.totalChunks}\n`;
|
|
214
|
-
result += `- **Errors:** ${stats.errors}\n`;
|
|
215
|
-
result += `- **Duration:** ${stats.duration}ms\n`;
|
|
216
|
-
return result;
|
|
217
|
-
},
|
|
218
|
-
list_aliases: async (_args, ctx) => {
|
|
219
|
-
const response = await ctx.api.get("/api/aliases");
|
|
220
|
-
const aliases = response.data.aliases || response.data;
|
|
221
|
-
if (!aliases || (Array.isArray(aliases) && aliases.length === 0)) {
|
|
222
|
-
return "No aliases configured.";
|
|
223
|
-
}
|
|
224
|
-
let result = `## Collection Aliases\n\n`;
|
|
225
|
-
if (Array.isArray(aliases)) {
|
|
226
|
-
for (const a of aliases) {
|
|
227
|
-
result += `- **${a.alias}** -> ${a.collection}\n`;
|
|
208
|
+
schema: z.object({}),
|
|
209
|
+
annotations: TOOL_ANNOTATIONS["list_aliases"],
|
|
210
|
+
handler: async (_args, ctx) => {
|
|
211
|
+
const response = await ctx.api.get("/api/aliases");
|
|
212
|
+
const aliases = response.data.aliases || response.data;
|
|
213
|
+
if (!aliases || (Array.isArray(aliases) && aliases.length === 0)) {
|
|
214
|
+
return "No aliases configured.";
|
|
228
215
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
216
|
+
let result = `## Collection Aliases\n\n`;
|
|
217
|
+
if (Array.isArray(aliases)) {
|
|
218
|
+
for (const a of aliases) {
|
|
219
|
+
result += `- **${a.alias}** -> ${a.collection}\n`;
|
|
220
|
+
}
|
|
233
221
|
}
|
|
234
|
-
|
|
235
|
-
|
|
222
|
+
else {
|
|
223
|
+
for (const [alias, collection] of Object.entries(aliases)) {
|
|
224
|
+
result += `- **${alias}** -> ${collection}\n`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
},
|
|
236
229
|
},
|
|
237
|
-
|
|
238
|
-
return { tools, handlers };
|
|
230
|
+
];
|
|
239
231
|
}
|
package/dist/tools/memory.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* batch_remember, validate_memory, review_memories,
|
|
6
6
|
* promote_memory, run_quality_gates, memory_maintenance
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
export declare function createMemoryTools(projectName: string):
|
|
8
|
+
import type { ToolSpec } from "../types.js";
|
|
9
|
+
export declare function createMemoryTools(projectName: string): ToolSpec[];
|