nexup-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.

Potentially problematic release.


This version of nexup-mcp-server might be problematic. Click here for more details.

Files changed (66) hide show
  1. package/README.md +41 -0
  2. package/dist/client/auth.d.ts +6 -0
  3. package/dist/client/auth.d.ts.map +1 -0
  4. package/dist/client/auth.js +14 -0
  5. package/dist/client/auth.js.map +1 -0
  6. package/dist/client/http-client.d.ts +33 -0
  7. package/dist/client/http-client.d.ts.map +1 -0
  8. package/dist/client/http-client.js +149 -0
  9. package/dist/client/http-client.js.map +1 -0
  10. package/dist/config.d.ts +7 -0
  11. package/dist/config.d.ts.map +1 -0
  12. package/dist/config.js +19 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +108 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/resources/crm-resources.d.ts +8 -0
  19. package/dist/resources/crm-resources.d.ts.map +1 -0
  20. package/dist/resources/crm-resources.js +501 -0
  21. package/dist/resources/crm-resources.js.map +1 -0
  22. package/dist/resources/index.d.ts +2 -0
  23. package/dist/resources/index.d.ts.map +1 -0
  24. package/dist/resources/index.js +2 -0
  25. package/dist/resources/index.js.map +1 -0
  26. package/dist/tools/customers.d.ts +221 -0
  27. package/dist/tools/customers.d.ts.map +1 -0
  28. package/dist/tools/customers.js +207 -0
  29. package/dist/tools/customers.js.map +1 -0
  30. package/dist/tools/index.d.ts +883 -0
  31. package/dist/tools/index.d.ts.map +1 -0
  32. package/dist/tools/index.js +38 -0
  33. package/dist/tools/index.js.map +1 -0
  34. package/dist/tools/notifications.d.ts +16 -0
  35. package/dist/tools/notifications.d.ts.map +1 -0
  36. package/dist/tools/notifications.js +47 -0
  37. package/dist/tools/notifications.js.map +1 -0
  38. package/dist/tools/prospects.d.ts +478 -0
  39. package/dist/tools/prospects.d.ts.map +1 -0
  40. package/dist/tools/prospects.js +336 -0
  41. package/dist/tools/prospects.js.map +1 -0
  42. package/dist/tools/tickets.d.ts +83 -0
  43. package/dist/tools/tickets.d.ts.map +1 -0
  44. package/dist/tools/tickets.js +171 -0
  45. package/dist/tools/tickets.js.map +1 -0
  46. package/dist/tools/transcripts.d.ts +97 -0
  47. package/dist/tools/transcripts.d.ts.map +1 -0
  48. package/dist/tools/transcripts.js +188 -0
  49. package/dist/tools/transcripts.js.map +1 -0
  50. package/dist/utils/errors.d.ts +9 -0
  51. package/dist/utils/errors.d.ts.map +1 -0
  52. package/dist/utils/errors.js +28 -0
  53. package/dist/utils/errors.js.map +1 -0
  54. package/dist/utils/formatters.d.ts +5 -0
  55. package/dist/utils/formatters.d.ts.map +1 -0
  56. package/dist/utils/formatters.js +21 -0
  57. package/dist/utils/formatters.js.map +1 -0
  58. package/dist/utils/logger.d.ts +4 -0
  59. package/dist/utils/logger.d.ts.map +1 -0
  60. package/dist/utils/logger.js +43 -0
  61. package/dist/utils/logger.js.map +1 -0
  62. package/dist/validation/schemas.d.ts +424 -0
  63. package/dist/validation/schemas.d.ts.map +1 -0
  64. package/dist/validation/schemas.js +114 -0
  65. package/dist/validation/schemas.js.map +1 -0
  66. package/package.json +34 -0
@@ -0,0 +1,97 @@
1
+ export declare const transcriptTools: ({
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {
7
+ entityType: {
8
+ type: string;
9
+ enum: string[];
10
+ description: string;
11
+ };
12
+ prospectId: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ customerId: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ date: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ duration: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ summary: {
29
+ type: string;
30
+ description: string;
31
+ };
32
+ transcript: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ sentiment: {
37
+ type: string;
38
+ description: string;
39
+ minimum: number;
40
+ maximum: number;
41
+ };
42
+ transcriptId?: undefined;
43
+ };
44
+ required: string[];
45
+ };
46
+ } | {
47
+ name: string;
48
+ description: string;
49
+ inputSchema: {
50
+ type: string;
51
+ properties: {
52
+ entityType: {
53
+ type: string;
54
+ enum: string[];
55
+ description: string;
56
+ };
57
+ prospectId: {
58
+ type: string;
59
+ description: string;
60
+ };
61
+ customerId: {
62
+ type: string;
63
+ description: string;
64
+ };
65
+ date?: undefined;
66
+ duration?: undefined;
67
+ summary?: undefined;
68
+ transcript?: undefined;
69
+ sentiment?: undefined;
70
+ transcriptId?: undefined;
71
+ };
72
+ required?: undefined;
73
+ };
74
+ } | {
75
+ name: string;
76
+ description: string;
77
+ inputSchema: {
78
+ type: string;
79
+ properties: {
80
+ transcriptId: {
81
+ type: string;
82
+ description: string;
83
+ };
84
+ entityType?: undefined;
85
+ prospectId?: undefined;
86
+ customerId?: undefined;
87
+ date?: undefined;
88
+ duration?: undefined;
89
+ summary?: undefined;
90
+ transcript?: undefined;
91
+ sentiment?: undefined;
92
+ };
93
+ required: string[];
94
+ };
95
+ })[];
96
+ export declare function handleTranscriptTool(toolName: string, params: any): Promise<any>;
97
+ //# sourceMappingURL=transcripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcripts.d.ts","sourceRoot":"","sources":["../../src/tools/transcripts.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8C3B,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAgBtF"}
@@ -0,0 +1,188 @@
1
+ import { httpClient } from '../client/http-client.js';
2
+ import { logToolCall } from '../utils/logger.js';
3
+ import { formatError } from '../utils/errors.js';
4
+ import { formatDate } from '../utils/formatters.js';
5
+ import { recordCallTranscriptSchema, } from '../validation/schemas.js';
6
+ export const transcriptTools = [
7
+ {
8
+ name: 'record_call_transcript',
9
+ description: 'Record a call transcript for a prospect or customer with AI-extracted action items. Requires user confirmation before execution.',
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ entityType: {
14
+ type: 'string',
15
+ enum: ['PROSPECT', 'CUSTOMER'],
16
+ description: 'Whether this is a prospect or customer call'
17
+ },
18
+ prospectId: { type: 'string', description: 'Prospect ID (required if entityType=PROSPECT)' },
19
+ customerId: { type: 'string', description: 'Customer ID (required if entityType=CUSTOMER)' },
20
+ date: { type: 'string', description: 'Date of call (ISO format)' },
21
+ duration: { type: 'number', description: 'Call duration in minutes (optional)' },
22
+ summary: { type: 'string', description: 'Call summary (optional)' },
23
+ transcript: { type: 'string', description: 'Full call transcript text (optional)' },
24
+ sentiment: { type: 'number', description: 'Call sentiment 1-5 scale (optional)', minimum: 1, maximum: 5 },
25
+ },
26
+ required: ['entityType', 'date'],
27
+ },
28
+ },
29
+ {
30
+ name: 'list_transcripts',
31
+ description: 'List call transcripts with optional filters (entityType, prospectId, customerId)',
32
+ inputSchema: {
33
+ type: 'object',
34
+ properties: {
35
+ entityType: { type: 'string', enum: ['PROSPECT', 'CUSTOMER'], description: 'Filter by entity type' },
36
+ prospectId: { type: 'string', description: 'Filter by prospect ID' },
37
+ customerId: { type: 'string', description: 'Filter by customer ID' },
38
+ },
39
+ },
40
+ },
41
+ {
42
+ name: 'get_transcript',
43
+ description: 'Get a specific call transcript by ID',
44
+ inputSchema: {
45
+ type: 'object',
46
+ properties: {
47
+ transcriptId: { type: 'string', description: 'Transcript ID' },
48
+ },
49
+ required: ['transcriptId'],
50
+ },
51
+ },
52
+ ];
53
+ export async function handleTranscriptTool(toolName, params) {
54
+ try {
55
+ switch (toolName) {
56
+ case 'record_call_transcript':
57
+ return await recordCallTranscript(params);
58
+ case 'list_transcripts':
59
+ return await listTranscripts(params);
60
+ case 'get_transcript':
61
+ return await getTranscript(params);
62
+ default:
63
+ throw new Error(`Unknown transcript tool: ${toolName}`);
64
+ }
65
+ }
66
+ catch (error) {
67
+ logToolCall(toolName, params, 'error', { error: formatError(error) });
68
+ throw error;
69
+ }
70
+ }
71
+ async function recordCallTranscript(params) {
72
+ const validated = recordCallTranscriptSchema.parse(params);
73
+ const result = await httpClient.post('/api/transcripts', validated, 'record_call_transcript');
74
+ logToolCall('record_call_transcript', params, 'success', {
75
+ transcriptId: result.callTranscript.id,
76
+ actionItemsCount: result.actionItems.length,
77
+ });
78
+ const sentiment = result.callTranscript.sentiment
79
+ ? '★'.repeat(result.callTranscript.sentiment) + '☆'.repeat(5 - result.callTranscript.sentiment)
80
+ : 'Not rated';
81
+ // Get company name from the correct entity
82
+ const companyName = result.callTranscript.entityType === 'PROSPECT'
83
+ ? result.callTranscript.prospect?.companyName
84
+ : result.callTranscript.customer?.companyName;
85
+ const entityLabel = result.callTranscript.entityType === 'PROSPECT' ? 'prospect' : 'customer';
86
+ let response = `✓ Recorded call transcript for ${entityLabel} ${companyName}\n`;
87
+ if (result.callTranscript.sentiment) {
88
+ response += `Sentiment: ${sentiment} (${result.callTranscript.sentiment}/5)\n`;
89
+ }
90
+ if (result.actionItems.length > 0) {
91
+ response += `\nExtracted ${result.actionItems.length} action item(s):\n`;
92
+ result.actionItems.forEach((item, index) => {
93
+ response += `${index + 1}. ${item.title} (${item.priority})\n`;
94
+ });
95
+ }
96
+ return {
97
+ content: [
98
+ {
99
+ type: 'text',
100
+ text: response,
101
+ },
102
+ ],
103
+ };
104
+ }
105
+ async function listTranscripts(params) {
106
+ const queryParams = {};
107
+ if (params.entityType)
108
+ queryParams.entityType = params.entityType;
109
+ if (params.prospectId)
110
+ queryParams.prospectId = params.prospectId;
111
+ if (params.customerId)
112
+ queryParams.customerId = params.customerId;
113
+ const transcripts = await httpClient.get('/api/transcripts', queryParams);
114
+ logToolCall('list_transcripts', params, 'success', { count: transcripts.length });
115
+ if (transcripts.length === 0) {
116
+ return {
117
+ content: [{
118
+ type: 'text',
119
+ text: 'No transcripts found matching the criteria.',
120
+ }],
121
+ };
122
+ }
123
+ let response = `Found ${transcripts.length} transcript(s):\n\n`;
124
+ transcripts.forEach((t, index) => {
125
+ const companyName = t.entityType === 'PROSPECT' ? t.prospect?.companyName : t.customer?.companyName;
126
+ const sentiment = t.sentiment ? '★'.repeat(t.sentiment) + '☆'.repeat(5 - t.sentiment) : 'Not rated';
127
+ response += `${index + 1}. ${companyName} (${t.entityType})\n`;
128
+ response += ` Date: ${formatDate(t.date)}\n`;
129
+ response += ` Sentiment: ${sentiment}\n`;
130
+ if (t.summary) {
131
+ response += ` Summary: ${t.summary.substring(0, 100)}${t.summary.length > 100 ? '...' : ''}\n`;
132
+ }
133
+ response += ` ID: ${t.id}\n\n`;
134
+ });
135
+ return {
136
+ content: [{
137
+ type: 'text',
138
+ text: response,
139
+ }],
140
+ };
141
+ }
142
+ async function getTranscript(params) {
143
+ const transcript = await httpClient.get(`/api/transcripts/${params.transcriptId}`);
144
+ logToolCall('get_transcript', params, 'success', { transcriptId: transcript.id });
145
+ const companyName = transcript.entityType === 'PROSPECT'
146
+ ? transcript.prospect?.companyName
147
+ : transcript.customer?.companyName;
148
+ const sentiment = transcript.sentiment
149
+ ? '★'.repeat(transcript.sentiment) + '☆'.repeat(5 - transcript.sentiment)
150
+ : 'Not rated';
151
+ let actionItems = [];
152
+ try {
153
+ actionItems = transcript.actionItems ? JSON.parse(transcript.actionItems) : [];
154
+ }
155
+ catch (e) {
156
+ // ignore parse errors
157
+ }
158
+ let response = `Call Transcript for ${companyName} (${transcript.entityType})\n`;
159
+ response += `${'='.repeat(50)}\n\n`;
160
+ response += `Date: ${formatDate(transcript.date)}\n`;
161
+ if (transcript.duration) {
162
+ response += `Duration: ${transcript.duration} minutes\n`;
163
+ }
164
+ response += `Sentiment: ${sentiment} (${transcript.sentiment || 'Not rated'})\n`;
165
+ response += `ID: ${transcript.id}\n\n`;
166
+ if (transcript.summary) {
167
+ response += `Summary:\n${transcript.summary}\n\n`;
168
+ }
169
+ if (actionItems.length > 0) {
170
+ response += `Action Items (${actionItems.length}):\n`;
171
+ actionItems.forEach((item, index) => {
172
+ response += `${index + 1}. ${item.title} [${item.priority}]\n`;
173
+ if (item.assignee)
174
+ response += ` Assignee: ${item.assignee}\n`;
175
+ });
176
+ response += '\n';
177
+ }
178
+ if (transcript.transcript) {
179
+ response += `Full Transcript:\n${transcript.transcript}\n`;
180
+ }
181
+ return {
182
+ content: [{
183
+ type: 'text',
184
+ text: response,
185
+ }],
186
+ };
187
+ }
188
+ //# sourceMappingURL=transcripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcripts.js","sourceRoot":"","sources":["../../src/tools/transcripts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAU,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,kIAAkI;QAC/I,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;oBAC9B,WAAW,EAAE,6CAA6C;iBAC3D;gBACD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;gBAC5F,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;gBAC5F,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EA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4
+ details?: any | undefined;
5
+ constructor(message: string, code: string, statusCode?: number | undefined, details?: any | undefined);
6
+ }
7
+ export declare function formatError(error: unknown): string;
8
+ export declare function isAuthError(error: unknown): boolean;
9
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IAGxB,IAAI,EAAE,MAAM;IACZ,UAAU,CAAC,EAAE,MAAM;IACnB,OAAO,CAAC,EAAE,GAAG;gBAHpB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,OAAO,CAAC,EAAE,GAAG,YAAA;CAKvB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQlD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKnD"}
@@ -0,0 +1,28 @@
1
+ export class McpError extends Error {
2
+ code;
3
+ statusCode;
4
+ details;
5
+ constructor(message, code, statusCode, details) {
6
+ super(message);
7
+ this.code = code;
8
+ this.statusCode = statusCode;
9
+ this.details = details;
10
+ this.name = 'McpError';
11
+ }
12
+ }
13
+ export function formatError(error) {
14
+ if (error instanceof McpError) {
15
+ return `${error.message} (${error.code})`;
16
+ }
17
+ if (error instanceof Error) {
18
+ return error.message;
19
+ }
20
+ return String(error);
21
+ }
22
+ export function isAuthError(error) {
23
+ if (error instanceof McpError) {
24
+ return error.statusCode === 401 || error.statusCode === 403;
25
+ }
26
+ return false;
27
+ }
28
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGxB;IACA;IACA;IAJT,YACE,OAAe,EACR,IAAY,EACZ,UAAmB,EACnB,OAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAM;QAGpB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,OAAO,GAAG,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,IAAI,GAAG,CAAC;IAC5C,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,CAAC;IAC9D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function formatProspect(prospect: any): string;
2
+ export declare function formatCustomer(customer: any): string;
3
+ export declare function formatTouchpoint(touchpoint: any): string;
4
+ export declare function formatDate(date: Date | string): string;
5
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAGpD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,CAIpD;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,GAAG,GAAG,MAAM,CAGxD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAMtD"}
@@ -0,0 +1,21 @@
1
+ export function formatProspect(prospect) {
2
+ const company = prospect.company?.companyNameRaw || 'Unknown Company';
3
+ return `${prospect.firstName} ${prospect.lastName} (${company}) - ${prospect.email}`;
4
+ }
5
+ export function formatCustomer(customer) {
6
+ const company = customer.company?.companyNameRaw || 'Unknown Company';
7
+ const sentiment = '★'.repeat(customer.sentiment) + '☆'.repeat(5 - customer.sentiment);
8
+ return `${company} - Sentiment: ${sentiment}`;
9
+ }
10
+ export function formatTouchpoint(touchpoint) {
11
+ const date = new Date(touchpoint.date).toLocaleDateString();
12
+ return `${touchpoint.type} on ${date}${touchpoint.summary ? ': ' + touchpoint.summary : ''}`;
13
+ }
14
+ export function formatDate(date) {
15
+ return new Date(date).toLocaleDateString('en-US', {
16
+ year: 'numeric',
17
+ month: 'short',
18
+ day: 'numeric',
19
+ });
20
+ }
21
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,QAAa;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,cAAc,IAAI,iBAAiB,CAAC;IACtE,OAAO,GAAG,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAa;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,cAAc,IAAI,iBAAiB,CAAC;IACtE,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtF,OAAO,GAAG,OAAO,iBAAiB,SAAS,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAe;IAC9C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC5D,OAAO,GAAG,UAAU,CAAC,IAAI,OAAO,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAmB;IAC5C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAChD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import winston from 'winston';
2
+ export declare const logger: winston.Logger;
3
+ export declare function logToolCall(toolName: string, params: any, result: 'success' | 'error', details?: any): void;
4
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAkB9B,eAAO,MAAM,MAAM,gBAsBjB,CAAC;AAEH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,QAQpG"}
@@ -0,0 +1,43 @@
1
+ import winston from 'winston';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import fs from 'fs';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ // Ensure logs directory exists
8
+ const logsDir = path.join(__dirname, '../../logs');
9
+ if (!fs.existsSync(logsDir)) {
10
+ fs.mkdirSync(logsDir, { recursive: true });
11
+ }
12
+ // Default log level
13
+ const logLevel = process.env.MCP_LOG_LEVEL || 'info';
14
+ const userEmail = process.env.MCP_USER_EMAIL || 'unknown';
15
+ export const logger = winston.createLogger({
16
+ level: logLevel,
17
+ format: winston.format.combine(winston.format.timestamp(), winston.format.errors({ stack: true }), winston.format.json()),
18
+ defaultMeta: { userEmail },
19
+ transports: [
20
+ // Write all logs to audit file
21
+ new winston.transports.File({
22
+ filename: path.join(logsDir, `audit-${new Date().toISOString().split('T')[0]}.log`),
23
+ level: 'info',
24
+ }),
25
+ // Write errors to separate file
26
+ new winston.transports.File({
27
+ filename: path.join(logsDir, 'error.log'),
28
+ level: 'error',
29
+ }),
30
+ // NOTE: Console logging is disabled for MCP servers
31
+ // MCP uses stdio for JSON-RPC communication, so console output breaks the protocol
32
+ ],
33
+ });
34
+ export function logToolCall(toolName, params, result, details) {
35
+ logger.info('MCP Tool Call', {
36
+ tool: toolName,
37
+ params,
38
+ result,
39
+ details,
40
+ timestamp: new Date().toISOString(),
41
+ });
42
+ }
43
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,+BAA+B;AAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5B,EAAE,CAAC,SAAS,CAAC,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