assay-mcp-server 1.0.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 (67) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +421 -0
  3. package/dist/firebase.d.ts +53 -0
  4. package/dist/firebase.d.ts.map +1 -0
  5. package/dist/firebase.js +123 -0
  6. package/dist/firebase.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +380 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/tools/askQuestion.d.ts +9 -0
  12. package/dist/tools/askQuestion.d.ts.map +1 -0
  13. package/dist/tools/askQuestion.js +27 -0
  14. package/dist/tools/askQuestion.js.map +1 -0
  15. package/dist/tools/browseAllDocuments.d.ts +17 -0
  16. package/dist/tools/browseAllDocuments.d.ts.map +1 -0
  17. package/dist/tools/browseAllDocuments.js +44 -0
  18. package/dist/tools/browseAllDocuments.js.map +1 -0
  19. package/dist/tools/browseThemes.d.ts +19 -0
  20. package/dist/tools/browseThemes.d.ts.map +1 -0
  21. package/dist/tools/browseThemes.js +20 -0
  22. package/dist/tools/browseThemes.js.map +1 -0
  23. package/dist/tools/compareDocuments.d.ts +9 -0
  24. package/dist/tools/compareDocuments.d.ts.map +1 -0
  25. package/dist/tools/compareDocuments.js +52 -0
  26. package/dist/tools/compareDocuments.js.map +1 -0
  27. package/dist/tools/getDocumentSummary.d.ts +12 -0
  28. package/dist/tools/getDocumentSummary.d.ts.map +1 -0
  29. package/dist/tools/getDocumentSummary.js +29 -0
  30. package/dist/tools/getDocumentSummary.js.map +1 -0
  31. package/dist/tools/getLibraryInsight.d.ts +7 -0
  32. package/dist/tools/getLibraryInsight.d.ts.map +1 -0
  33. package/dist/tools/getLibraryInsight.js +14 -0
  34. package/dist/tools/getLibraryInsight.js.map +1 -0
  35. package/dist/tools/getSimilarDocuments.d.ts +25 -0
  36. package/dist/tools/getSimilarDocuments.d.ts.map +1 -0
  37. package/dist/tools/getSimilarDocuments.js +28 -0
  38. package/dist/tools/getSimilarDocuments.js.map +1 -0
  39. package/dist/tools/produceFaq.d.ts +50 -0
  40. package/dist/tools/produceFaq.d.ts.map +1 -0
  41. package/dist/tools/produceFaq.js +52 -0
  42. package/dist/tools/produceFaq.js.map +1 -0
  43. package/dist/tools/scoringUtils.d.ts +23 -0
  44. package/dist/tools/scoringUtils.d.ts.map +1 -0
  45. package/dist/tools/scoringUtils.js +61 -0
  46. package/dist/tools/scoringUtils.js.map +1 -0
  47. package/dist/tools/searchByAuthor.d.ts +15 -0
  48. package/dist/tools/searchByAuthor.d.ts.map +1 -0
  49. package/dist/tools/searchByAuthor.js +27 -0
  50. package/dist/tools/searchByAuthor.js.map +1 -0
  51. package/dist/tools/searchByKeywords.d.ts +16 -0
  52. package/dist/tools/searchByKeywords.d.ts.map +1 -0
  53. package/dist/tools/searchByKeywords.js +27 -0
  54. package/dist/tools/searchByKeywords.js.map +1 -0
  55. package/dist/tools/searchByTheme.d.ts +27 -0
  56. package/dist/tools/searchByTheme.d.ts.map +1 -0
  57. package/dist/tools/searchByTheme.js +27 -0
  58. package/dist/tools/searchByTheme.js.map +1 -0
  59. package/dist/tools/searchByTitle.d.ts +15 -0
  60. package/dist/tools/searchByTitle.d.ts.map +1 -0
  61. package/dist/tools/searchByTitle.js +27 -0
  62. package/dist/tools/searchByTitle.js.map +1 -0
  63. package/dist/tools/searchDocuments.d.ts +14 -0
  64. package/dist/tools/searchDocuments.d.ts.map +1 -0
  65. package/dist/tools/searchDocuments.js +28 -0
  66. package/dist/tools/searchDocuments.js.map +1 -0
  67. package/package.json +55 -0
package/dist/index.js ADDED
@@ -0,0 +1,380 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
+ import { initializeFirebase, verifyToken } from './firebase.js';
6
+ import { searchDocumentsTool, searchDocuments, } from './tools/searchDocuments.js';
7
+ import { getDocumentSummaryTool, getDocumentSummary, } from './tools/getDocumentSummary.js';
8
+ import { getSimilarDocumentsTool, getSimilarDocuments, } from './tools/getSimilarDocuments.js';
9
+ import { searchByAuthorTool, searchByAuthor, } from './tools/searchByAuthor.js';
10
+ import { searchByTitleTool, searchByTitle, } from './tools/searchByTitle.js';
11
+ import { searchByKeywordsTool, searchByKeywords, } from './tools/searchByKeywords.js';
12
+ import { getLibraryInsightTool, getLibraryInsight, } from './tools/getLibraryInsight.js';
13
+ import { browseThemesTool, browseThemes, } from './tools/browseThemes.js';
14
+ import { askQuestionTool, askQuestion, } from './tools/askQuestion.js';
15
+ import { compareDocumentsTool, compareDocuments, } from './tools/compareDocuments.js';
16
+ import { produceFaqTool, produceFaq, } from './tools/produceFaq.js';
17
+ import { browseAllDocumentsTool, browseAllDocuments, } from './tools/browseAllDocuments.js';
18
+ import { searchByThemeTool, searchByTheme, } from './tools/searchByTheme.js';
19
+ // Get token from command line args or environment
20
+ const token = process.argv.find((arg) => arg.startsWith('--token='))?.split('=')[1] ||
21
+ process.env.ASSAY_FIREBASE_TOKEN ||
22
+ process.argv[process.argv.indexOf('--token') + 1];
23
+ if (!token) {
24
+ console.error('Error: Firebase token required');
25
+ console.error('Usage: assay-mcp-server --token <firebase-token>');
26
+ console.error(' or: ASSAY_FIREBASE_TOKEN=<token> assay-mcp-server');
27
+ process.exit(1);
28
+ }
29
+ // Initialize Firebase
30
+ initializeFirebase();
31
+ // Verify token and get user ID
32
+ let userId;
33
+ let userEmail;
34
+ // Create MCP server
35
+ const server = new Server({
36
+ name: 'assay-mcp-server',
37
+ version: '0.1.0',
38
+ }, {
39
+ capabilities: {
40
+ tools: {},
41
+ },
42
+ });
43
+ // List available tools
44
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
45
+ return {
46
+ tools: [
47
+ searchDocumentsTool,
48
+ getDocumentSummaryTool,
49
+ getSimilarDocumentsTool,
50
+ getLibraryInsightTool,
51
+ browseAllDocumentsTool,
52
+ searchByAuthorTool,
53
+ searchByTitleTool,
54
+ searchByKeywordsTool,
55
+ browseThemesTool,
56
+ askQuestionTool,
57
+ compareDocumentsTool,
58
+ produceFaqTool,
59
+ searchByThemeTool,
60
+ ],
61
+ };
62
+ });
63
+ // Handle tool calls
64
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
65
+ const { name, arguments: args } = request.params;
66
+ console.error(`[MCP] Tool call received: ${name}`, JSON.stringify(args, null, 2));
67
+ try {
68
+ // Ensure user is authenticated
69
+ if (!userId) {
70
+ // Try to verify token
71
+ try {
72
+ const decoded = await verifyToken(token);
73
+ userId = decoded.uid;
74
+ userEmail = decoded.email;
75
+ }
76
+ catch (error) {
77
+ return {
78
+ content: [
79
+ {
80
+ type: 'text',
81
+ text: `Error: Token verification failed. Please get a new token from the Assay dashboard. Token expires after 1 hour. Error: ${error instanceof Error ? error.message : String(error)}`,
82
+ },
83
+ ],
84
+ isError: true,
85
+ };
86
+ }
87
+ }
88
+ switch (name) {
89
+ case 'search_documents': {
90
+ const query = args?.query;
91
+ const limit = args?.limit || 20;
92
+ const result = await searchDocuments(userId, query, token, limit);
93
+ return {
94
+ content: [
95
+ {
96
+ type: 'text',
97
+ text: JSON.stringify(result, null, 2),
98
+ },
99
+ ],
100
+ };
101
+ }
102
+ case 'get_document_summary': {
103
+ const documentId = args?.documentId;
104
+ const summaryType = args?.summaryType || 'comprehensive';
105
+ const result = await getDocumentSummary(userId, documentId, token, summaryType);
106
+ return {
107
+ content: [
108
+ {
109
+ type: 'text',
110
+ text: JSON.stringify(result, null, 2),
111
+ },
112
+ ],
113
+ };
114
+ }
115
+ case 'get_similar_documents': {
116
+ const documentId = args?.documentId;
117
+ const limit = args?.limit || 10;
118
+ const result = await getSimilarDocuments(userId, documentId, token, limit);
119
+ return {
120
+ content: [
121
+ {
122
+ type: 'text',
123
+ text: JSON.stringify(result, null, 2),
124
+ },
125
+ ],
126
+ };
127
+ }
128
+ case 'get_library_insight': {
129
+ const result = await getLibraryInsight(userId, token);
130
+ return {
131
+ content: [
132
+ {
133
+ type: 'text',
134
+ text: JSON.stringify(result, null, 2),
135
+ },
136
+ ],
137
+ };
138
+ }
139
+ case 'browse_all_documents': {
140
+ const limit = args?.limit || 50;
141
+ const offset = args?.offset || 0;
142
+ const themeFilter = args?.themeFilter;
143
+ const authorFilter = args?.authorFilter;
144
+ const visibilityFilter = args?.visibilityFilter || 'all';
145
+ const result = await browseAllDocuments(userId, token, limit, offset, themeFilter, authorFilter, visibilityFilter);
146
+ return {
147
+ content: [
148
+ {
149
+ type: 'text',
150
+ text: JSON.stringify(result, null, 2),
151
+ },
152
+ ],
153
+ };
154
+ }
155
+ case 'search_by_author': {
156
+ const authorName = args?.authorName;
157
+ const limit = args?.limit || 20;
158
+ const result = await searchByAuthor(userId, authorName, token, limit);
159
+ return {
160
+ content: [
161
+ {
162
+ type: 'text',
163
+ text: JSON.stringify(result, null, 2),
164
+ },
165
+ ],
166
+ };
167
+ }
168
+ case 'search_by_title': {
169
+ const titleQuery = args?.titleQuery;
170
+ const limit = args?.limit || 20;
171
+ const result = await searchByTitle(userId, titleQuery, token, limit);
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: JSON.stringify(result, null, 2),
177
+ },
178
+ ],
179
+ };
180
+ }
181
+ case 'search_by_keywords': {
182
+ const keywords = args?.keywords;
183
+ const limit = args?.limit || 20;
184
+ const result = await searchByKeywords(userId, keywords, token, limit);
185
+ return {
186
+ content: [
187
+ {
188
+ type: 'text',
189
+ text: JSON.stringify(result, null, 2),
190
+ },
191
+ ],
192
+ };
193
+ }
194
+ case 'browse_themes': {
195
+ const domain = args?.domain;
196
+ const result = await browseThemes(userId, token, domain);
197
+ return {
198
+ content: [
199
+ {
200
+ type: 'text',
201
+ text: JSON.stringify(result, null, 2),
202
+ },
203
+ ],
204
+ };
205
+ }
206
+ case 'ask_question': {
207
+ const question = args?.question;
208
+ const maxDocuments = args?.maxDocuments || 10;
209
+ const result = await askQuestion(userId, question, token, maxDocuments);
210
+ // Handle synthesized vs raw data response
211
+ if (result.synthesized && result.content) {
212
+ return {
213
+ content: [
214
+ {
215
+ type: 'text',
216
+ text: `**Answer (Server-side with Assay Skill):**\n\n${result.content}\n\n---\n\n*Based on ${result.rawData?.count || 0} documents from your collection. Raw data available for reference.*`,
217
+ },
218
+ ],
219
+ };
220
+ }
221
+ else {
222
+ return {
223
+ content: [
224
+ {
225
+ type: 'text',
226
+ text: JSON.stringify(result.rawData || result, null, 2),
227
+ },
228
+ ],
229
+ };
230
+ }
231
+ }
232
+ case 'compare_documents': {
233
+ const themes = args?.themes;
234
+ const keywords = args?.keywords;
235
+ const authors = args?.authors;
236
+ const result = await compareDocuments(userId, token, themes, keywords, authors);
237
+ // Handle synthesized vs raw data response
238
+ if (result.synthesized && result.content) {
239
+ return {
240
+ content: [
241
+ {
242
+ type: 'text',
243
+ text: `**Synthesized Comparison (Server-side with Assay Skill):**\n\n${result.content}\n\n---\n\n*Raw data available for reference if needed. Total: ${result.rawData?.count || 0} documents.*`,
244
+ },
245
+ ],
246
+ };
247
+ }
248
+ else {
249
+ return {
250
+ content: [
251
+ {
252
+ type: 'text',
253
+ text: JSON.stringify(result.rawData || result, null, 2),
254
+ },
255
+ ],
256
+ };
257
+ }
258
+ }
259
+ case 'produce_faq': {
260
+ const themes = args?.themes;
261
+ const keywords = args?.keywords;
262
+ const authors = args?.authors;
263
+ const result = await produceFaq(userId, token, themes, keywords, authors);
264
+ // Handle synthesized vs raw data response
265
+ if (result.synthesized && result.content) {
266
+ // Return synthesized content with raw data available
267
+ return {
268
+ content: [
269
+ {
270
+ type: 'text',
271
+ text: `**Synthesized FAQ (Server-side with Assay Skill):**\n\n${result.content}\n\n---\n\n*Raw data available for reference if needed. Total: ${result.rawData?.count || 0} documents, ${result.rawData?.summary?.total_faqs || 0} FAQs.*`,
272
+ },
273
+ ],
274
+ };
275
+ }
276
+ else {
277
+ // Return raw data (current behavior)
278
+ return {
279
+ content: [
280
+ {
281
+ type: 'text',
282
+ text: JSON.stringify(result.rawData || result, null, 2),
283
+ },
284
+ ],
285
+ };
286
+ }
287
+ }
288
+ case 'search_by_theme': {
289
+ const themeQuery = args?.themeQuery;
290
+ if (!themeQuery || typeof themeQuery !== 'string') {
291
+ return {
292
+ content: [
293
+ {
294
+ type: 'text',
295
+ text: JSON.stringify({
296
+ error: 'Invalid input: themeQuery must be a non-empty string',
297
+ received: themeQuery,
298
+ type: typeof themeQuery,
299
+ }, null, 2),
300
+ },
301
+ ],
302
+ isError: true,
303
+ };
304
+ }
305
+ const limit = args?.limit || 20;
306
+ const result = await searchByTheme(userId, themeQuery, token, limit);
307
+ return {
308
+ content: [
309
+ {
310
+ type: 'text',
311
+ text: JSON.stringify(result, null, 2),
312
+ },
313
+ ],
314
+ };
315
+ }
316
+ default:
317
+ throw new Error(`Unknown tool: ${name}`);
318
+ }
319
+ }
320
+ catch (error) {
321
+ return {
322
+ content: [
323
+ {
324
+ type: 'text',
325
+ text: `Error: ${error instanceof Error ? error.message : String(error)}`,
326
+ },
327
+ ],
328
+ isError: true,
329
+ };
330
+ }
331
+ });
332
+ // Start server
333
+ async function main() {
334
+ try {
335
+ // Verify token before starting server
336
+ try {
337
+ const decoded = await verifyToken(token);
338
+ userId = decoded.uid;
339
+ userEmail = decoded.email;
340
+ console.error(`Assay MCP Server: Authenticated as ${userEmail || userId}`);
341
+ }
342
+ catch (error) {
343
+ console.error('Error: Invalid Firebase token');
344
+ console.error('Token may be expired. Please get a new token from the Assay dashboard.');
345
+ console.error(error instanceof Error ? error.message : String(error));
346
+ process.exit(1);
347
+ }
348
+ // Start the server only after token is verified
349
+ const transport = new StdioServerTransport();
350
+ await server.connect(transport);
351
+ console.error('Assay MCP Server running on stdio');
352
+ // Keep the process alive
353
+ process.on('SIGINT', () => {
354
+ console.error('Shutting down...');
355
+ process.exit(0);
356
+ });
357
+ process.on('SIGTERM', () => {
358
+ console.error('Shutting down...');
359
+ process.exit(0);
360
+ });
361
+ }
362
+ catch (error) {
363
+ console.error('Fatal error starting server:', error);
364
+ process.exit(1);
365
+ }
366
+ }
367
+ // Handle unhandled promise rejections
368
+ process.on('unhandledRejection', (reason, promise) => {
369
+ console.error('Unhandled Rejection at:', promise, 'reason:', reason);
370
+ });
371
+ // Handle uncaught exceptions
372
+ process.on('uncaughtException', (error) => {
373
+ console.error('Uncaught Exception:', error);
374
+ process.exit(1);
375
+ });
376
+ main().catch((error) => {
377
+ console.error('Fatal error:', error);
378
+ process.exit(1);
379
+ });
380
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,YAAY,GACb,MAAM,yB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AC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,sCAAsC;AACtC,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC;AAEH,6BAA6B;AAC7B,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const askQuestionTool: Tool;
3
+ export declare function askQuestion(userId: string, question: string, token: string, maxDocuments?: number): Promise<{
4
+ synthesized?: boolean;
5
+ content?: string;
6
+ rawData?: any;
7
+ [key: string]: any;
8
+ }>;
9
+ //# sourceMappingURL=askQuestion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askQuestion.d.ts","sourceRoot":"","sources":["../../src/tools/askQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,eAAe,EAAE,IAkB7B,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,YAAY,GAAE,MAAW,GACxB,OAAO,CAAC;IACT,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC,CAKD"}
@@ -0,0 +1,27 @@
1
+ import { callCloudFunction } from '../firebase.js';
2
+ export const askQuestionTool = {
3
+ name: 'ask_question',
4
+ description: 'Ask a question about your document library. The tool searches your library (both private and public collections) for relevant documents and returns their summaries so Claude can synthesize an answer. This is perfect for exploratory questions like "What should I consider for automating Red Team exercises?"',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ question: {
9
+ type: 'string',
10
+ description: 'The question to ask about your document library (e.g., "If I wanted to automate Red Team exercises, what should I consider?")',
11
+ },
12
+ maxDocuments: {
13
+ type: 'number',
14
+ description: 'Maximum number of documents to retrieve (default: 10)',
15
+ default: 10,
16
+ },
17
+ },
18
+ required: ['question'],
19
+ },
20
+ };
21
+ export async function askQuestion(userId, question, token, maxDocuments = 10) {
22
+ return await callCloudFunction('mcpAskQuestion', {
23
+ question,
24
+ maxDocuments,
25
+ }, token);
26
+ }
27
+ //# sourceMappingURL=askQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askQuestion.js","sourceRoot":"","sources":["../../src/tools/askQuestion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,oTAAoT;IACjU,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+HAA+H;aAC7I;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uDAAuD;gBACpE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,CAAC;KACvB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,QAAgB,EAChB,KAAa,EACb,eAAuB,EAAE;IAQzB,OAAO,MAAM,iBAAiB,CAAC,gBAAgB,EAAE;QAC/C,QAAQ;QACR,YAAY;KACb,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const browseAllDocumentsTool: Tool;
3
+ export declare function browseAllDocuments(userId: string, token: string, limit?: number, offset?: number, themeFilter?: string, authorFilter?: string, visibilityFilter?: 'public' | 'private' | 'all'): Promise<{
4
+ documents: Array<{
5
+ documentId: string;
6
+ title: string;
7
+ authors: string[];
8
+ createdAt: string;
9
+ themes: string[];
10
+ visibility: 'public' | 'private';
11
+ }>;
12
+ total: number;
13
+ limit: number;
14
+ offset: number;
15
+ hasMore: boolean;
16
+ }>;
17
+ //# sourceMappingURL=browseAllDocuments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browseAllDocuments.d.ts","sourceRoot":"","sources":["../../src/tools/browseAllDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,sBAAsB,EAAE,IAgCpC,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,gBAAgB,GAAE,QAAQ,GAAG,SAAS,GAAG,KAAa,GACrD,OAAO,CAAC;IACT,SAAS,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;KAClC,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAQD"}
@@ -0,0 +1,44 @@
1
+ import { callCloudFunction } from '../firebase.js';
2
+ export const browseAllDocumentsTool = {
3
+ name: 'browse_all_documents',
4
+ description: 'Browse all documents in your Assay library (both private and public collections). Supports pagination and optional filtering by theme or author. Theme filter accepts theme ID (e.g., "CYBER_SECURITY.THREAT_MODELING"), theme label (e.g., "Threat Modeling"), or natural language (e.g., "threat modeling"). Use browse_themes first to discover available themes.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ limit: {
9
+ type: 'number',
10
+ description: 'Maximum number of results to return (default: 50)',
11
+ default: 50,
12
+ },
13
+ offset: {
14
+ type: 'number',
15
+ description: 'Number of results to skip for pagination (default: 0)',
16
+ default: 0,
17
+ },
18
+ themeFilter: {
19
+ type: 'string',
20
+ description: 'Optional theme filter - accepts theme ID (e.g., "CYBER_SECURITY.THREAT_MODELING"), theme label (e.g., "Threat Modeling"), or natural language. Uses fuzzy matching.',
21
+ },
22
+ authorFilter: {
23
+ type: 'string',
24
+ description: 'Optional author name to filter by',
25
+ },
26
+ visibilityFilter: {
27
+ type: 'string',
28
+ enum: ['public', 'private', 'all'],
29
+ description: 'Filter by visibility (default: all)',
30
+ default: 'all',
31
+ },
32
+ },
33
+ },
34
+ };
35
+ export async function browseAllDocuments(userId, token, limit = 50, offset = 0, themeFilter, authorFilter, visibilityFilter = 'all') {
36
+ return await callCloudFunction('mcpBrowseAllDocuments', {
37
+ limit,
38
+ offset,
39
+ themeFilter,
40
+ authorFilter,
41
+ visibilityFilter,
42
+ }, token);
43
+ }
44
+ //# sourceMappingURL=browseAllDocuments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browseAllDocuments.js","sourceRoot":"","sources":["../../src/tools/browseAllDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sWAAsW;IACnX,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;gBAChE,OAAO,EAAE,EAAE;aACZ;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uDAAuD;gBACpE,OAAO,EAAE,CAAC;aACX;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qKAAqK;aACnL;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mCAAmC;aACjD;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC;gBAClC,WAAW,EAAE,qCAAqC;gBAClD,OAAO,EAAE,KAAK;aACf;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,KAAa,EACb,QAAgB,EAAE,EAClB,SAAiB,CAAC,EAClB,WAAoB,EACpB,YAAqB,EACrB,mBAAiD,KAAK;IAetD,OAAO,MAAM,iBAAiB,CAAC,uBAAuB,EAAE;QACtD,KAAK;QACL,MAAM;QACN,WAAW;QACX,YAAY;QACZ,gBAAgB;KACjB,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const browseThemesTool: Tool;
3
+ export declare function browseThemes(userId: string, token: string, domain?: string): Promise<{
4
+ domains?: Array<{
5
+ id: string;
6
+ label: string;
7
+ count: number;
8
+ }>;
9
+ domain?: {
10
+ id: string;
11
+ label: string;
12
+ };
13
+ l1Themes?: Array<{
14
+ id: string;
15
+ label: string;
16
+ count: number;
17
+ }>;
18
+ }>;
19
+ //# sourceMappingURL=browseThemes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browseThemes.d.ts","sourceRoot":"","sources":["../../src/tools/browseThemes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,gBAAgB,EAAE,IAY9B,CAAC;AAEF,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC;IACT,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,MAAM,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ,CAAC,CAID"}
@@ -0,0 +1,20 @@
1
+ import { callCloudFunction } from '../firebase.js';
2
+ export const browseThemesTool = {
3
+ name: 'browse_themes',
4
+ description: 'Browse the canonical theme taxonomy. If no domain is specified, returns all L0 domains (e.g., "CYBER_SECURITY", "ARTIFICIAL_INTELLIGENCE") with document counts and match patterns. If a domain is specified, returns all L1 themes (e.g., "CYBER_SECURITY.THREAT_MODELING") within that domain with document counts and match patterns. Each theme includes its full ID, label, and suggested match patterns to help you use the correct format in other tools. Searches both private and public collections.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ domain: {
9
+ type: 'string',
10
+ description: 'Optional L0 domain ID to browse (e.g., "ARTIFICIAL_INTELLIGENCE", "CYBERSECURITY"). If not provided, returns all L0 domains.',
11
+ },
12
+ },
13
+ },
14
+ };
15
+ export async function browseThemes(userId, token, domain) {
16
+ return await callCloudFunction('mcpBrowseThemes', {
17
+ domain,
18
+ }, token);
19
+ }
20
+ //# sourceMappingURL=browseThemes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browseThemes.js","sourceRoot":"","sources":["../../src/tools/browseThemes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gfAAgf;IAC7f,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8HAA8H;aAC5I;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,KAAa,EACb,MAAe;IAiBf,OAAO,MAAM,iBAAiB,CAAC,iBAAiB,EAAE;QAChD,MAAM;KACP,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const compareDocumentsTool: Tool;
3
+ export declare function compareDocuments(userId: string, token: string, themes?: string[], keywords?: string[], authors?: string[]): Promise<{
4
+ synthesized?: boolean;
5
+ content?: string;
6
+ rawData?: any;
7
+ [key: string]: any;
8
+ }>;
9
+ //# sourceMappingURL=compareDocuments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareDocuments.d.ts","sourceRoot":"","sources":["../../src/tools/compareDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG1D,eAAO,MAAM,oBAAoB,EAAE,IA0ClC,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EAAE,EACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC;IACT,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC,CAMD"}
@@ -0,0 +1,52 @@
1
+ import { callCloudFunction } from '../firebase.js';
2
+ export const compareDocumentsTool = {
3
+ name: 'compare_documents',
4
+ description: `Compare up to 25 documents selected by themes, keywords, or authors. Returns documents with summaries, unique findings, and metadata sorted by relevance score. Includes a data summary and featured document to guide processing.
5
+
6
+ CRITICAL INSTRUCTION: The returned data contains ACTUAL content from the user's document collection.
7
+
8
+ BEFORE comparing documents, you MUST:
9
+ 1. Display the data summary showing total documents and key themes
10
+ 2. Review the featured document's summary preview and unique findings
11
+ 3. Extract and show key points from at least 3 different documents
12
+ 4. Identify common themes and unique perspectives from the ACTUAL summaries
13
+
14
+ FORBIDDEN:
15
+ - Synthesizing comparisons from your training knowledge instead of the returned data
16
+ - Proceeding to comparison without showing specific document details
17
+ - If you do this, you are FAILING the user's request
18
+
19
+ After verification, provide a comparison that:
20
+ - Draws from ALL returned document summaries
21
+ - Highlights similarities and differences from ACTUAL content
22
+ - Attributes specific findings to source documents
23
+ - Uses unique findings to identify what makes each document distinct`,
24
+ inputSchema: {
25
+ type: 'object',
26
+ properties: {
27
+ themes: {
28
+ type: 'array',
29
+ items: { type: 'string' },
30
+ description: 'Array of theme IDs to match (e.g., ["CYBERSECURITY", "ARTIFICIAL_INTELLIGENCE.AI_ARCHITECTURES"]). Use browse_themes to discover valid theme IDs.',
31
+ },
32
+ keywords: {
33
+ type: 'array',
34
+ items: { type: 'string' },
35
+ description: 'Array of keywords to match',
36
+ },
37
+ authors: {
38
+ type: 'array',
39
+ items: { type: 'string' },
40
+ description: 'Array of author names to match',
41
+ },
42
+ },
43
+ },
44
+ };
45
+ export async function compareDocuments(userId, token, themes, keywords, authors) {
46
+ return await callCloudFunction('mcpCompareDocuments', {
47
+ themes,
48
+ keywords,
49
+ authors,
50
+ }, token);
51
+ }
52
+ //# sourceMappingURL=compareDocuments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareDocuments.js","sourceRoot":"","sources":["../../src/tools/compareDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;qEAmBsD;IACnE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,mJAAmJ;aACjK;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,4BAA4B;aAC1C;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,gCAAgC;aAC9C;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,KAAa,EACb,MAAiB,EACjB,QAAmB,EACnB,OAAkB;IAQlB,OAAO,MAAM,iBAAiB,CAAC,qBAAqB,EAAE;QACpD,MAAM;QACN,QAAQ;QACR,OAAO;KACR,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ export declare const getDocumentSummaryTool: Tool;
3
+ export declare function getDocumentSummary(userId: string, documentId: string, token: string, summaryType?: 'comprehensive' | 'casual' | 'faq'): Promise<{
4
+ documentId: string;
5
+ title: string;
6
+ authors: string[];
7
+ summaryType: string;
8
+ summary: string;
9
+ themes: string[];
10
+ createdAt: string;
11
+ }>;
12
+ //# sourceMappingURL=getDocumentSummary.d.ts.map