@verygoodplugins/mcp-freescout 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.
@@ -0,0 +1,257 @@
1
+ export class TicketAnalyzer {
2
+ analyzeConversation(conversation) {
3
+ const threads = conversation._embedded?.threads || [];
4
+ const customer = conversation._embedded?.customer;
5
+ const customerMessages = threads.filter(t => t.type === 'customer');
6
+ const teamNotes = threads.filter(t => t.type === 'note');
7
+ // Extract issue description from customer messages
8
+ const issueDescription = this.extractIssueDescription(customerMessages);
9
+ // Extract code snippets and error messages
10
+ const codeSnippets = this.extractCodeSnippets(threads);
11
+ const errorMessages = this.extractErrorMessages(threads);
12
+ // Check if tested by team
13
+ const testedByTeam = this.checkTestedByTeam(teamNotes);
14
+ // Extract attachments
15
+ const attachments = this.extractAttachments(threads);
16
+ // Analyze if it's a bug or third-party issue
17
+ const analysis = this.analyzeIssueType(issueDescription, threads);
18
+ return {
19
+ ticketId: conversation.id.toString(),
20
+ customerName: customer ? `${customer.first_name || ''} ${customer.last_name || ''}`.trim() : 'Unknown',
21
+ customerEmail: customer?.email || 'unknown@example.com',
22
+ issueDescription,
23
+ hasAttachments: attachments.length > 0,
24
+ attachments,
25
+ codeSnippets,
26
+ errorMessages,
27
+ isReproducible: testedByTeam || this.checkReproducible(threads),
28
+ testedByTeam,
29
+ isBug: analysis.isBug,
30
+ isThirdPartyIssue: analysis.isThirdParty,
31
+ rootCause: analysis.rootCause,
32
+ suggestedSolution: analysis.suggestedSolution,
33
+ };
34
+ }
35
+ extractIssueDescription(customerMessages) {
36
+ if (customerMessages.length === 0) {
37
+ return 'No customer messages found';
38
+ }
39
+ // Get the first customer message as the primary description
40
+ const firstMessage = customerMessages[0];
41
+ const description = this.stripHtml(firstMessage.body);
42
+ // Add any additional context from follow-up messages
43
+ const additionalContext = customerMessages
44
+ .slice(1)
45
+ .map(m => this.stripHtml(m.body))
46
+ .filter(text => text.length > 50) // Only include substantial messages
47
+ .join('\n\nAdditional context:\n');
48
+ return additionalContext ? `${description}\n\n${additionalContext}` : description;
49
+ }
50
+ extractCodeSnippets(threads) {
51
+ const snippets = [];
52
+ for (const thread of threads) {
53
+ const body = thread.body;
54
+ // Look for code blocks
55
+ const codeBlockMatches = body.matchAll(/<pre[^>]*>.*?<\/pre>/gs);
56
+ for (const match of codeBlockMatches) {
57
+ snippets.push(this.stripHtml(match[0]));
58
+ }
59
+ // Look for inline code
60
+ const inlineCodeMatches = body.matchAll(/<code[^>]*>.*?<\/code>/gs);
61
+ for (const match of inlineCodeMatches) {
62
+ const code = this.stripHtml(match[0]);
63
+ if (code.length > 20) { // Only include substantial code snippets
64
+ snippets.push(code);
65
+ }
66
+ }
67
+ // Look for common code patterns in plain text
68
+ const lines = this.stripHtml(body).split('\n');
69
+ for (const line of lines) {
70
+ if (this.looksLikeCode(line)) {
71
+ snippets.push(line.trim());
72
+ }
73
+ }
74
+ }
75
+ return [...new Set(snippets)]; // Remove duplicates
76
+ }
77
+ extractErrorMessages(threads) {
78
+ const errors = [];
79
+ const errorPatterns = [
80
+ /error[:\s]+(.+)/gi,
81
+ /exception[:\s]+(.+)/gi,
82
+ /warning[:\s]+(.+)/gi,
83
+ /fatal[:\s]+(.+)/gi,
84
+ /failed[:\s]+(.+)/gi,
85
+ /cannot\s+(.+)/gi,
86
+ /unable\s+to\s+(.+)/gi,
87
+ /undefined\s+(.+)/gi,
88
+ /null\s+(.+)/gi,
89
+ ];
90
+ for (const thread of threads) {
91
+ const text = this.stripHtml(thread.body);
92
+ for (const pattern of errorPatterns) {
93
+ const matches = text.matchAll(pattern);
94
+ for (const match of matches) {
95
+ const error = match[0].trim();
96
+ if (error.length > 10 && error.length < 500) {
97
+ errors.push(error);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ return [...new Set(errors)];
103
+ }
104
+ checkTestedByTeam(teamNotes) {
105
+ const testKeywords = [
106
+ 'tested',
107
+ 'reproduced',
108
+ 'confirmed',
109
+ 'verified',
110
+ 'replicated',
111
+ 'able to reproduce',
112
+ 'can reproduce',
113
+ 'seeing the same',
114
+ ];
115
+ for (const note of teamNotes) {
116
+ const text = this.stripHtml(note.body).toLowerCase();
117
+ if (testKeywords.some(keyword => text.includes(keyword))) {
118
+ return true;
119
+ }
120
+ }
121
+ return false;
122
+ }
123
+ checkReproducible(threads) {
124
+ const reproducibleKeywords = [
125
+ 'steps to reproduce',
126
+ 'how to reproduce',
127
+ 'reproduction steps',
128
+ 'always happens',
129
+ 'consistently',
130
+ 'every time',
131
+ ];
132
+ for (const thread of threads) {
133
+ const text = this.stripHtml(thread.body).toLowerCase();
134
+ if (reproducibleKeywords.some(keyword => text.includes(keyword))) {
135
+ return true;
136
+ }
137
+ }
138
+ return false;
139
+ }
140
+ extractAttachments(threads) {
141
+ const attachments = [];
142
+ for (const thread of threads) {
143
+ if (thread.attachments && thread.attachments.length > 0) {
144
+ for (const attachment of thread.attachments) {
145
+ attachments.push(`${attachment.file_name} (${attachment.mime_type})`);
146
+ }
147
+ }
148
+ }
149
+ return attachments;
150
+ }
151
+ analyzeIssueType(description, threads) {
152
+ const fullText = threads.map(t => this.stripHtml(t.body)).join('\n').toLowerCase();
153
+ // Check for third-party issues
154
+ const thirdPartyIndicators = [
155
+ 'elementor',
156
+ 'third-party plugin',
157
+ 'another plugin',
158
+ 'theme conflict',
159
+ 'hosting limitation',
160
+ 'server configuration',
161
+ 'php version',
162
+ 'wordpress core',
163
+ ];
164
+ const isThirdParty = thirdPartyIndicators.some(indicator => fullText.includes(indicator));
165
+ // Check if it's a feature request vs bug
166
+ const featureKeywords = [
167
+ 'would be nice',
168
+ 'feature request',
169
+ 'enhancement',
170
+ 'could you add',
171
+ 'is it possible to',
172
+ 'would like to',
173
+ ];
174
+ const isFeatureRequest = featureKeywords.some(keyword => fullText.includes(keyword));
175
+ // Check for configuration issues
176
+ const configKeywords = [
177
+ 'settings',
178
+ 'configuration',
179
+ 'not configured',
180
+ 'setup',
181
+ 'installation',
182
+ ];
183
+ const isConfigIssue = configKeywords.some(keyword => fullText.includes(keyword));
184
+ return {
185
+ isBug: !isFeatureRequest && !isConfigIssue && !isThirdParty,
186
+ isThirdParty,
187
+ rootCause: isThirdParty ? 'Third-party plugin or system limitation' :
188
+ isConfigIssue ? 'Configuration or setup issue' :
189
+ isFeatureRequest ? 'Feature request, not a bug' : undefined,
190
+ suggestedSolution: undefined,
191
+ };
192
+ }
193
+ stripHtml(html) {
194
+ return html
195
+ .replace(/<[^>]*>/g, ' ') // Remove HTML tags
196
+ .replace(/&nbsp;/g, ' ') // Replace &nbsp;
197
+ .replace(/&lt;/g, '<') // Replace &lt;
198
+ .replace(/&gt;/g, '>') // Replace &gt;
199
+ .replace(/&amp;/g, '&') // Replace &amp;
200
+ .replace(/&quot;/g, '"') // Replace &quot;
201
+ .replace(/&#39;/g, "'") // Replace &#39;
202
+ .replace(/\s+/g, ' ') // Normalize whitespace
203
+ .trim();
204
+ }
205
+ looksLikeCode(line) {
206
+ const codeIndicators = [
207
+ /^\s*\/\//, // Comments
208
+ /^\s*#/, // Comments or directives
209
+ /^\s*\*/, // Comments
210
+ /function\s+\w+/, // Function declarations
211
+ /class\s+\w+/, // Class declarations
212
+ /\$\w+/, // PHP variables
213
+ /\w+\s*\(\s*\)/, // Function calls
214
+ /\w+\s*=\s*.+/, // Assignments
215
+ /if\s*\(/, // Control structures
216
+ /for\s*\(/,
217
+ /while\s*\(/,
218
+ /return\s+/,
219
+ /import\s+/,
220
+ /require\s*\(/,
221
+ /include\s*\(/,
222
+ ];
223
+ return codeIndicators.some(pattern => pattern.test(line));
224
+ }
225
+ generateCustomerReply(analysis, fixDescription, isExplanatory = false) {
226
+ const customerFirstName = analysis.customerName.split(' ')[0] || 'there';
227
+ if (isExplanatory) {
228
+ return `Hi ${customerFirstName},
229
+
230
+ Thanks for reporting this. After investigating, I've found that ${analysis.rootCause || 'this is expected behavior'}.
231
+
232
+ ${fixDescription || 'This is working as designed based on the current system architecture.'}
233
+
234
+ Please let me know if you have any questions or if there's anything else I can help clarify!`;
235
+ }
236
+ if (!analysis.isBug) {
237
+ return `Hi ${customerFirstName},
238
+
239
+ Thanks for reaching out. ${analysis.rootCause || 'After reviewing your request, this appears to be a configuration or feature request rather than a bug.'}
240
+
241
+ ${fixDescription || 'I can help you with the configuration, or we can consider this as a feature request for a future update.'}
242
+
243
+ Please let me know how you'd like to proceed!`;
244
+ }
245
+ return `Hi ${customerFirstName},
246
+
247
+ Thanks for reporting this. We were able to reproduce it on our end. We've implemented a fix that ${fixDescription || 'addresses the issue you reported'}.
248
+
249
+ The fix has been submitted for review and will be included in the next plugin update. You'll receive the update through WordPress's automatic update system.
250
+
251
+ Here's what was changed:
252
+ - ${fixDescription || 'Fixed the reported issue'}
253
+
254
+ Please let me know if you have any questions!`;
255
+ }
256
+ }
257
+ //# sourceMappingURL=ticket-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ticket-analyzer.js","sourceRoot":"","sources":["../src/ticket-analyzer.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,cAAc;IACzB,mBAAmB,CAAC,YAAmC;QACrD,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,EAAE,OAAO,IAAI,EAAE,CAAC;QACtD,MAAM,QAAQ,GAAG,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC;QAElD,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QAEzD,mDAAmD;QACnD,MAAM,gBAAgB,GAAG,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;QAExE,2CAA2C;QAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,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AAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,qBAAqB,CACnB,QAAwB,EACxB,cAAuB,EACvB,gBAAyB,KAAK;QAE9B,MAAM,iBAAiB,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;QAEzE,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,MAAM,iBAAiB;;kEAE8B,QAAQ,CAAC,SAAS,IAAI,2BAA2B;;EAEjH,cAAc,IAAI,uEAAuE;;6FAEE,CAAC;QAC1F,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,MAAM,iBAAiB;;2BAET,QAAQ,CAAC,SAAS,IAAI,wGAAwG;;EAEvJ,cAAc,IAAI,0GAA0G;;8CAEhF,CAAC;QAC3C,CAAC;QAED,OAAO,MAAM,iBAAiB;;mGAEiE,cAAc,IAAI,kCAAkC;;;;;IAKnJ,cAAc,IAAI,0BAA0B;;8CAEF,CAAC;IAC7C,CAAC;CACF"}
@@ -0,0 +1,77 @@
1
+ export interface FreeScoutThread {
2
+ id: number;
3
+ type: 'customer' | 'message' | 'note';
4
+ body: string;
5
+ created_by_customer: boolean;
6
+ created_at: string;
7
+ attachments?: Array<{
8
+ id: number;
9
+ file_name: string;
10
+ mime_type: string;
11
+ size: number;
12
+ url?: string;
13
+ }>;
14
+ }
15
+ export interface FreeScoutCustomer {
16
+ id: number;
17
+ email: string;
18
+ first_name?: string;
19
+ last_name?: string;
20
+ company?: string;
21
+ phone?: string;
22
+ }
23
+ export interface FreeScoutConversation {
24
+ id: number;
25
+ number: number;
26
+ subject: string;
27
+ status: 'active' | 'pending' | 'closed' | 'spam';
28
+ user_id: number | null;
29
+ customer_id: number;
30
+ mailbox_id: number;
31
+ created_at: string;
32
+ updated_at: string;
33
+ _embedded?: {
34
+ threads?: FreeScoutThread[];
35
+ customer?: FreeScoutCustomer;
36
+ };
37
+ }
38
+ export interface FreeScoutApiResponse<T> {
39
+ _embedded?: {
40
+ conversations?: T[];
41
+ threads?: FreeScoutThread[];
42
+ customer?: FreeScoutCustomer;
43
+ };
44
+ data?: T;
45
+ page?: {
46
+ size: number;
47
+ total_elements: number;
48
+ total_pages: number;
49
+ number: number;
50
+ };
51
+ }
52
+ export interface TicketAnalysis {
53
+ ticketId: string;
54
+ customerName: string;
55
+ customerEmail: string;
56
+ issueDescription: string;
57
+ hasAttachments: boolean;
58
+ attachments: string[];
59
+ codeSnippets: string[];
60
+ errorMessages: string[];
61
+ isReproducible: boolean;
62
+ testedByTeam: boolean;
63
+ suggestedSolution?: string;
64
+ isBug: boolean;
65
+ isThirdPartyIssue: boolean;
66
+ rootCause?: string;
67
+ }
68
+ export interface ImplementationPlan {
69
+ issue: string;
70
+ rootCause: string;
71
+ solution: string;
72
+ filesToModify: string[];
73
+ alternativeApproaches: string[];
74
+ hasBreakingChanges: boolean;
75
+ requiresDocumentationUpdate: boolean;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED,MAAM,WAA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cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,2BAA2B,EAAE,OAAO,CAAC;CACtC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@verygoodplugins/mcp-freescout",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for FreeScout ticket management and workflow automation",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "mcp-freescout": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsx watch src/index.ts",
13
+ "start": "node dist/index.js",
14
+ "test": "jest",
15
+ "lint": "eslint src/**/*.ts",
16
+ "format": "prettier --write src/**/*.ts",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "mcp-server",
22
+ "modelcontextprotocol",
23
+ "freescout",
24
+ "helpdesk",
25
+ "ticket-management",
26
+ "workflow-automation"
27
+ ],
28
+ "author": "Very Good Plugins",
29
+ "license": "GPL-3.0",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/verygoodplugins/mcp-freescout.git"
33
+ },
34
+ "homepage": "https://github.com/verygoodplugins/mcp-freescout#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/verygoodplugins/mcp-freescout/issues"
37
+ },
38
+ "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^0.5.0",
40
+ "node-fetch": "^3.3.2",
41
+ "zod": "^3.22.4",
42
+ "dotenv": "^16.3.1"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^20.10.0",
46
+ "@typescript-eslint/eslint-plugin": "^6.13.0",
47
+ "@typescript-eslint/parser": "^6.13.0",
48
+ "eslint": "^8.54.0",
49
+ "jest": "^29.7.0",
50
+ "prettier": "^3.1.0",
51
+ "tsx": "^4.6.0",
52
+ "typescript": "^5.3.0"
53
+ }
54
+ }