@mcp-consultant-tools/application-insights 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,105 @@
1
+ export interface ApplicationInsightsResourceConfig {
2
+ id: string;
3
+ name: string;
4
+ appId: string;
5
+ active: boolean;
6
+ apiKey?: string;
7
+ description?: string;
8
+ }
9
+ export interface ApplicationInsightsConfig {
10
+ resources: ApplicationInsightsResourceConfig[];
11
+ tenantId?: string;
12
+ clientId?: string;
13
+ clientSecret?: string;
14
+ authMethod: 'entra-id' | 'api-key';
15
+ }
16
+ export interface QueryResult {
17
+ tables: {
18
+ name: string;
19
+ columns: {
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ rows: any[][];
24
+ }[];
25
+ }
26
+ export interface MetadataResult {
27
+ tables: {
28
+ name: string;
29
+ columns: {
30
+ name: string;
31
+ type: string;
32
+ description?: string;
33
+ }[];
34
+ }[];
35
+ }
36
+ export declare class ApplicationInsightsService {
37
+ private config;
38
+ private msalClient;
39
+ private accessToken;
40
+ private tokenExpirationTime;
41
+ private readonly baseUrl;
42
+ constructor(config: ApplicationInsightsConfig);
43
+ /**
44
+ * Get an access token for the Application Insights API (Entra ID auth)
45
+ */
46
+ private getAccessToken;
47
+ /**
48
+ * Get authentication headers based on configuration
49
+ */
50
+ private getAuthHeaders;
51
+ /**
52
+ * Get active resources
53
+ */
54
+ getActiveResources(): ApplicationInsightsResourceConfig[];
55
+ /**
56
+ * Get all resources (including inactive)
57
+ */
58
+ getAllResources(): ApplicationInsightsResourceConfig[];
59
+ /**
60
+ * Get resource by ID
61
+ */
62
+ getResourceById(resourceId: string): ApplicationInsightsResourceConfig;
63
+ /**
64
+ * Execute a KQL query against an Application Insights resource
65
+ */
66
+ executeQuery(resourceId: string, query: string, timespan?: string): Promise<QueryResult>;
67
+ /**
68
+ * Get metadata (schema) for an Application Insights resource
69
+ */
70
+ getMetadata(resourceId: string): Promise<MetadataResult>;
71
+ /**
72
+ * Helper method: Get recent exceptions
73
+ */
74
+ getRecentExceptions(resourceId: string, timespan?: string, limit?: number): Promise<QueryResult>;
75
+ /**
76
+ * Helper method: Get slow requests
77
+ */
78
+ getSlowRequests(resourceId: string, durationThresholdMs?: number, timespan?: string, limit?: number): Promise<QueryResult>;
79
+ /**
80
+ * Helper method: Get failed dependencies
81
+ */
82
+ getFailedDependencies(resourceId: string, timespan?: string, limit?: number): Promise<QueryResult>;
83
+ /**
84
+ * Helper method: Get operation performance summary
85
+ */
86
+ getOperationPerformance(resourceId: string, timespan?: string): Promise<QueryResult>;
87
+ /**
88
+ * Helper method: Get traces by severity
89
+ */
90
+ getTracesBySeverity(resourceId: string, severityLevel?: number, // 0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Critical
91
+ timespan?: string, limit?: number): Promise<QueryResult>;
92
+ /**
93
+ * Helper method: Get availability test results
94
+ */
95
+ getAvailabilityResults(resourceId: string, timespan?: string): Promise<QueryResult>;
96
+ /**
97
+ * Helper method: Get custom events
98
+ */
99
+ getCustomEvents(resourceId: string, eventName?: string, timespan?: string, limit?: number): Promise<QueryResult>;
100
+ /**
101
+ * Convert ISO 8601 duration to KQL format
102
+ */
103
+ private convertTimespanToKQL;
104
+ }
105
+ //# sourceMappingURL=ApplicationInsightsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationInsightsService.d.ts","sourceRoot":"","sources":["../src/ApplicationInsightsService.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,iCAAiC,EAAE,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM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IAwB9D;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAe,EACzB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,WAAW,CAAC;IAYvB;;OAEG;IACG,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,mBAAmB,GAAE,MAAa,EAClC,QAAQ,GAAE,MAAe,EACzB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,WAAW,CAAC;IAavB;;OAEG;IACG,qBAAqB,CACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAe,EACzB,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,WAAW,CAAC;IAavB;;OAEG;IACG,uBAAuB,CAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAe,GACxB,OAAO,CAAC,WAAW,CAAC;IAkBvB;;OAEG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,aAAa,GAAE,MAAU,EAAE,oDAAoD;IAC/E,QAAQ,GAAE,MAAe,EACzB,KAAK,GAAE,MAAY,GAClB,OAAO,CAAC,WAAW,CAAC;IAavB;;OAEG;IACG,sBAAsB,CAC1B,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAgB,GACzB,OAAO,CAAC,WAAW,CAAC;IAiBvB;;OAEG;IACG,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAe,EACzB,KAAK,GAAE,MAAY,GAClB,OAAO,CAAC,WAAW,CAAC;IAmBvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAiB7B"}
@@ -0,0 +1,324 @@
1
+ import { ConfidentialClientApplication } from '@azure/msal-node';
2
+ import axios from 'axios';
3
+ export class ApplicationInsightsService {
4
+ config;
5
+ msalClient = null;
6
+ accessToken = null;
7
+ tokenExpirationTime = 0;
8
+ baseUrl = 'https://api.applicationinsights.io/v1';
9
+ constructor(config) {
10
+ this.config = config;
11
+ // Initialize MSAL client if using Entra ID auth
12
+ if (this.config.authMethod === 'entra-id') {
13
+ if (!this.config.tenantId || !this.config.clientId || !this.config.clientSecret) {
14
+ throw new Error('Entra ID authentication requires tenantId, clientId, and clientSecret');
15
+ }
16
+ this.msalClient = new ConfidentialClientApplication({
17
+ auth: {
18
+ clientId: this.config.clientId,
19
+ clientSecret: this.config.clientSecret,
20
+ authority: `https://login.microsoftonline.com/${this.config.tenantId}`,
21
+ }
22
+ });
23
+ }
24
+ }
25
+ /**
26
+ * Get an access token for the Application Insights API (Entra ID auth)
27
+ */
28
+ async getAccessToken() {
29
+ if (this.config.authMethod !== 'entra-id' || !this.msalClient) {
30
+ throw new Error('Entra ID authentication not configured');
31
+ }
32
+ const currentTime = Date.now();
33
+ // Return cached token if still valid (with 5 minute buffer)
34
+ if (this.accessToken && this.tokenExpirationTime > currentTime) {
35
+ return this.accessToken;
36
+ }
37
+ try {
38
+ const result = await this.msalClient.acquireTokenByClientCredential({
39
+ scopes: ['https://api.applicationinsights.io/.default'],
40
+ });
41
+ if (!result || !result.accessToken) {
42
+ throw new Error('Failed to acquire access token');
43
+ }
44
+ this.accessToken = result.accessToken;
45
+ // Set expiration time (subtract 5 minutes to refresh early)
46
+ if (result.expiresOn) {
47
+ this.tokenExpirationTime = result.expiresOn.getTime() - (5 * 60 * 1000);
48
+ }
49
+ return this.accessToken;
50
+ }
51
+ catch (error) {
52
+ console.error('Error acquiring access token:', error);
53
+ throw new Error('Application Insights authentication failed');
54
+ }
55
+ }
56
+ /**
57
+ * Get authentication headers based on configuration
58
+ */
59
+ async getAuthHeaders(resourceId) {
60
+ const resource = this.getResourceById(resourceId);
61
+ if (this.config.authMethod === 'entra-id') {
62
+ const token = await this.getAccessToken();
63
+ return {
64
+ 'Authorization': `Bearer ${token}`,
65
+ 'Accept': 'application/json',
66
+ };
67
+ }
68
+ else {
69
+ // API Key authentication
70
+ if (!resource.apiKey) {
71
+ throw new Error(`API key not configured for resource '${resourceId}'`);
72
+ }
73
+ return {
74
+ 'x-api-key': resource.apiKey,
75
+ 'Accept': 'application/json',
76
+ };
77
+ }
78
+ }
79
+ /**
80
+ * Get active resources
81
+ */
82
+ getActiveResources() {
83
+ return this.config.resources.filter(r => r.active);
84
+ }
85
+ /**
86
+ * Get all resources (including inactive)
87
+ */
88
+ getAllResources() {
89
+ return this.config.resources;
90
+ }
91
+ /**
92
+ * Get resource by ID
93
+ */
94
+ getResourceById(resourceId) {
95
+ const resource = this.config.resources.find(r => r.id === resourceId);
96
+ if (!resource) {
97
+ throw new Error(`Application Insights resource '${resourceId}' not found`);
98
+ }
99
+ if (!resource.active) {
100
+ throw new Error(`Application Insights resource '${resourceId}' is inactive`);
101
+ }
102
+ return resource;
103
+ }
104
+ /**
105
+ * Execute a KQL query against an Application Insights resource
106
+ */
107
+ async executeQuery(resourceId, query, timespan) {
108
+ try {
109
+ const resource = this.getResourceById(resourceId);
110
+ const headers = await this.getAuthHeaders(resourceId);
111
+ const url = `${this.baseUrl}/apps/${resource.appId}/query`;
112
+ const params = { query };
113
+ if (timespan) {
114
+ params.timespan = timespan;
115
+ }
116
+ const response = await axios.get(url, {
117
+ headers,
118
+ params,
119
+ timeout: 30000, // 30 second timeout
120
+ });
121
+ return response.data;
122
+ }
123
+ catch (error) {
124
+ // Handle timeout
125
+ if (error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT') {
126
+ throw new Error('Application Insights query timed out after 30 seconds. ' +
127
+ 'Try reducing the time range or simplifying the query.');
128
+ }
129
+ // Handle network errors
130
+ if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
131
+ throw new Error('Network error: Unable to connect to Application Insights API. ' +
132
+ 'Check your internet connection and firewall settings.');
133
+ }
134
+ const errorDetails = error.response?.data?.error?.message || error.message;
135
+ console.error('Application Insights query failed:', {
136
+ resourceId,
137
+ query: query.substring(0, 100) + '...',
138
+ error: errorDetails,
139
+ });
140
+ // Provide user-friendly error messages
141
+ if (error.response?.status === 401) {
142
+ throw new Error('Application Insights authentication failed. Check credentials and permissions.');
143
+ }
144
+ if (error.response?.status === 403) {
145
+ throw new Error('Application Insights access denied. Ensure you have Reader role on the resource.');
146
+ }
147
+ if (error.response?.status === 429) {
148
+ const retryAfter = error.response.headers['retry-after'] || 60;
149
+ throw new Error(`Application Insights rate limit exceeded. ` +
150
+ `Please retry after ${retryAfter} seconds. ` +
151
+ `Current limits: ${this.config.authMethod === 'entra-id' ? '60 requests/minute' : '15 requests/minute'}`);
152
+ }
153
+ // Handle KQL syntax errors
154
+ if (error.response?.data?.error?.innererror?.code === 'SyntaxError') {
155
+ const syntaxError = error.response.data.error.innererror.message;
156
+ throw new Error(`KQL query syntax error: ${syntaxError}\n` +
157
+ `Hint: Check table names, column names, and operator syntax`);
158
+ }
159
+ // Handle semantic errors
160
+ if (error.response?.data?.error?.innererror?.code === 'SemanticError') {
161
+ const semanticError = error.response.data.error.innererror.message;
162
+ throw new Error(`KQL query semantic error: ${semanticError}\n` +
163
+ `Hint: Use appinsights-get-metadata to see available tables and columns`);
164
+ }
165
+ throw new Error(`Application Insights query failed: ${errorDetails}`);
166
+ }
167
+ }
168
+ /**
169
+ * Get metadata (schema) for an Application Insights resource
170
+ */
171
+ async getMetadata(resourceId) {
172
+ try {
173
+ const resource = this.getResourceById(resourceId);
174
+ const headers = await this.getAuthHeaders(resourceId);
175
+ const url = `${this.baseUrl}/apps/${resource.appId}/metadata`;
176
+ const response = await axios.get(url, {
177
+ headers,
178
+ timeout: 30000,
179
+ });
180
+ return response.data;
181
+ }
182
+ catch (error) {
183
+ const errorDetails = error.response?.data?.error?.message || error.message;
184
+ console.error('Application Insights metadata request failed:', {
185
+ resourceId,
186
+ error: errorDetails,
187
+ });
188
+ throw new Error(`Application Insights metadata request failed: ${errorDetails}`);
189
+ }
190
+ }
191
+ /**
192
+ * Helper method: Get recent exceptions
193
+ */
194
+ async getRecentExceptions(resourceId, timespan = 'PT1H', limit = 50) {
195
+ const query = `
196
+ exceptions
197
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
198
+ | order by timestamp desc
199
+ | take ${limit}
200
+ | project timestamp, type, outerMessage, innermostMessage, operation_Name, operation_Id, cloud_RoleName
201
+ `.trim();
202
+ return this.executeQuery(resourceId, query, timespan);
203
+ }
204
+ /**
205
+ * Helper method: Get slow requests
206
+ */
207
+ async getSlowRequests(resourceId, durationThresholdMs = 5000, timespan = 'PT1H', limit = 50) {
208
+ const query = `
209
+ requests
210
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
211
+ | where duration > ${durationThresholdMs}
212
+ | order by duration desc
213
+ | take ${limit}
214
+ | project timestamp, name, duration, resultCode, success, operation_Id, cloud_RoleName
215
+ `.trim();
216
+ return this.executeQuery(resourceId, query, timespan);
217
+ }
218
+ /**
219
+ * Helper method: Get failed dependencies
220
+ */
221
+ async getFailedDependencies(resourceId, timespan = 'PT1H', limit = 50) {
222
+ const query = `
223
+ dependencies
224
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
225
+ | where success == false
226
+ | order by timestamp desc
227
+ | take ${limit}
228
+ | project timestamp, name, target, type, duration, resultCode, operation_Id, cloud_RoleName
229
+ `.trim();
230
+ return this.executeQuery(resourceId, query, timespan);
231
+ }
232
+ /**
233
+ * Helper method: Get operation performance summary
234
+ */
235
+ async getOperationPerformance(resourceId, timespan = 'PT1H') {
236
+ const query = `
237
+ requests
238
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
239
+ | summarize
240
+ RequestCount=count(),
241
+ AvgDuration=avg(duration),
242
+ P50Duration=percentile(duration, 50),
243
+ P95Duration=percentile(duration, 95),
244
+ P99Duration=percentile(duration, 99),
245
+ FailureCount=countif(success == false)
246
+ by operation_Name
247
+ | order by RequestCount desc
248
+ `.trim();
249
+ return this.executeQuery(resourceId, query, timespan);
250
+ }
251
+ /**
252
+ * Helper method: Get traces by severity
253
+ */
254
+ async getTracesBySeverity(resourceId, severityLevel = 2, // 0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Critical
255
+ timespan = 'PT1H', limit = 100) {
256
+ const query = `
257
+ traces
258
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
259
+ | where severityLevel >= ${severityLevel}
260
+ | order by timestamp desc
261
+ | take ${limit}
262
+ | project timestamp, message, severityLevel, operation_Name, operation_Id, cloud_RoleName
263
+ `.trim();
264
+ return this.executeQuery(resourceId, query, timespan);
265
+ }
266
+ /**
267
+ * Helper method: Get availability test results
268
+ */
269
+ async getAvailabilityResults(resourceId, timespan = 'PT24H') {
270
+ const query = `
271
+ availabilityResults
272
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
273
+ | summarize
274
+ TotalTests=count(),
275
+ SuccessCount=countif(success == true),
276
+ FailureCount=countif(success == false),
277
+ AvgDuration=avg(duration)
278
+ by name
279
+ | extend SuccessRate=round(100.0 * SuccessCount / TotalTests, 2)
280
+ | order by FailureCount desc
281
+ `.trim();
282
+ return this.executeQuery(resourceId, query, timespan);
283
+ }
284
+ /**
285
+ * Helper method: Get custom events
286
+ */
287
+ async getCustomEvents(resourceId, eventName, timespan = 'PT1H', limit = 100) {
288
+ let query = `
289
+ customEvents
290
+ | where timestamp > ago(${this.convertTimespanToKQL(timespan)})
291
+ `;
292
+ if (eventName) {
293
+ query += `\n | where name == "${eventName}"`;
294
+ }
295
+ query += `
296
+ | order by timestamp desc
297
+ | take ${limit}
298
+ | project timestamp, name, customDimensions, operation_Id, cloud_RoleName
299
+ `.trim();
300
+ return this.executeQuery(resourceId, query, timespan);
301
+ }
302
+ /**
303
+ * Convert ISO 8601 duration to KQL format
304
+ */
305
+ convertTimespanToKQL(timespan) {
306
+ // Convert ISO 8601 duration (PT1H, P1D) to KQL format (1h, 1d)
307
+ const match = timespan.match(/P(?:(\d+)D)?T?(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/);
308
+ if (!match) {
309
+ return timespan; // Return as-is if not recognized
310
+ }
311
+ const [, days, hours, minutes, seconds] = match;
312
+ const parts = [];
313
+ if (days)
314
+ parts.push(`${days}d`);
315
+ if (hours)
316
+ parts.push(`${hours}h`);
317
+ if (minutes)
318
+ parts.push(`${minutes}m`);
319
+ if (seconds)
320
+ parts.push(`${seconds}s`);
321
+ return parts.length > 0 ? parts.join('') : '1h';
322
+ }
323
+ }
324
+ //# sourceMappingURL=ApplicationInsightsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationInsightsService.js","sourceRoot":"","sources":["../src/ApplicationInsightsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAkC1B,MAAM,OAAO,0BAA0B;IAC7B,MAAM,CAA4B;IAClC,UAAU,GAAyC,IAAI,CAAC;IACxD,WAAW,GAAkB,IAAI,CAAC;IAClC,mBAAmB,GAAW,CAAC,CAAC;IACvB,OAAO,GAAG,uCAAuC,CAAC;IAEnE,YAAY,MAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,gDAAgD;QAChD,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBAChF,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC3F,CAAC;YAED,IAAI,CAAC,UAAU,GAAG,IAAI,6BAA6B,CAAC;gBAClD,IAAI,EAAE;oBACJ,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;oBAC9B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;oBACtC,SAAS,EAAE,qCAAqC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;iBACvE;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;I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AAC,CAAC;QACnC,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;QACvC,IAAI,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;QAEvC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { ApplicationInsightsService } from "./ApplicationInsightsService.js";
3
+ export declare function registerApplicationInsightsTools(server: any, service?: ApplicationInsightsService): void;
4
+ export { ApplicationInsightsService } from "./ApplicationInsightsService.js";
5
+ export type { ApplicationInsightsConfig } from "./ApplicationInsightsService.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAG7E,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,0BAA0B,QAGjG;AAED,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { createMcpServer, createEnvLoader } from "@mcp-consultant-tools/core";
4
+ export function registerApplicationInsightsTools(server, service) {
5
+ // TODO: Extract tool registrations from main index.ts during meta-package phase
6
+ console.error("Application Insights tools registered (tool extraction pending)");
7
+ }
8
+ export { ApplicationInsightsService } from "./ApplicationInsightsService.js";
9
+ if (import.meta.url === `file://${process.argv[1]}`) {
10
+ const loadEnv = createEnvLoader();
11
+ loadEnv();
12
+ const server = createMcpServer({ name: "@mcp-consultant-tools/application-insights", version: "1.0.0", capabilities: { tools: {} } });
13
+ registerApplicationInsightsTools(server);
14
+ const transport = new StdioServerTransport();
15
+ server.connect(transport).catch((error) => { console.error("Failed to start Application Insights server:", error); process.exit(1); });
16
+ console.error("@mcp-consultant-tools/application-insights server running");
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI9E,MAAM,UAAU,gCAAgC,CAAC,MAAW,EAAE,OAAoC;IAChG,gFAAgF;IAChF,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;AACnF,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAG7E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC;IACV,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,4CAA4C,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtI,gCAAgC,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9I,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Utility functions for formatting Application Insights query results
3
+ */
4
+ /**
5
+ * Format Application Insights table result as markdown table
6
+ */
7
+ export declare function formatTableAsMarkdown(table: {
8
+ columns: {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ rows: any[][];
13
+ }): string;
14
+ /**
15
+ * Convert Application Insights query result to CSV
16
+ */
17
+ export declare function formatTableAsCSV(table: {
18
+ columns: {
19
+ name: string;
20
+ type: string;
21
+ }[];
22
+ rows: any[][];
23
+ }): string;
24
+ /**
25
+ * Extract key insights from exception data
26
+ */
27
+ export declare function analyzeExceptions(exceptionsTable: any): string;
28
+ /**
29
+ * Extract key insights from performance data
30
+ */
31
+ export declare function analyzePerformance(performanceTable: any): string;
32
+ /**
33
+ * Extract key insights from dependency data
34
+ */
35
+ export declare function analyzeDependencies(dependenciesTable: any): string;
36
+ /**
37
+ * Sanitize error messages to remove sensitive information
38
+ */
39
+ export declare function sanitizeErrorMessage(message: string): string;
40
+ /**
41
+ * Parse and validate ISO 8601 duration strings
42
+ */
43
+ export declare function parseTimespan(timespan: string): {
44
+ valid: boolean;
45
+ error?: string;
46
+ };
47
+ /**
48
+ * Get common timespan presets
49
+ */
50
+ export declare function getTimespanPresets(): Record<string, string>;
51
+ //# sourceMappingURL=appinsights-formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appinsights-formatters.d.ts","sourceRoot":"","sources":["../../src/utils/appinsights-formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;CACf,GAAG,MAAM,CAmBT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;CACf,GAAG,MAAM,CAuBT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,EAAE,GAAG,GAAG,MAAM,CAgC9D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,GAAG,GAAG,MAAM,CA4BhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,GAAG,GAAG,MAAM,CA+BlE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAW5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAYlF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW3D"}
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Utility functions for formatting Application Insights query results
3
+ */
4
+ /**
5
+ * Format Application Insights table result as markdown table
6
+ */
7
+ export function formatTableAsMarkdown(table) {
8
+ if (!table || !table.rows || table.rows.length === 0) {
9
+ return '*No results*';
10
+ }
11
+ // Create header row
12
+ const header = '| ' + table.columns.map(c => c.name).join(' | ') + ' |';
13
+ const separator = '| ' + table.columns.map(() => '---').join(' | ') + ' |';
14
+ // Create data rows
15
+ const rows = table.rows.map(row => {
16
+ return '| ' + row.map(cell => {
17
+ if (cell === null || cell === undefined)
18
+ return '';
19
+ if (typeof cell === 'object')
20
+ return JSON.stringify(cell);
21
+ return String(cell);
22
+ }).join(' | ') + ' |';
23
+ });
24
+ return [header, separator, ...rows].join('\n');
25
+ }
26
+ /**
27
+ * Convert Application Insights query result to CSV
28
+ */
29
+ export function formatTableAsCSV(table) {
30
+ if (!table || !table.rows || table.rows.length === 0) {
31
+ return '';
32
+ }
33
+ // Create header row
34
+ const header = table.columns.map(c => c.name).join(',');
35
+ // Create data rows
36
+ const rows = table.rows.map(row => {
37
+ return row.map(cell => {
38
+ if (cell === null || cell === undefined)
39
+ return '';
40
+ if (typeof cell === 'object')
41
+ return JSON.stringify(cell);
42
+ const str = String(cell);
43
+ // Escape CSV values
44
+ if (str.includes(',') || str.includes('"') || str.includes('\n')) {
45
+ return `"${str.replace(/"/g, '""')}"`;
46
+ }
47
+ return str;
48
+ }).join(',');
49
+ });
50
+ return [header, ...rows].join('\n');
51
+ }
52
+ /**
53
+ * Extract key insights from exception data
54
+ */
55
+ export function analyzeExceptions(exceptionsTable) {
56
+ if (!exceptionsTable || !exceptionsTable.rows || exceptionsTable.rows.length === 0) {
57
+ return 'No exceptions found in the specified time range.';
58
+ }
59
+ const insights = [];
60
+ // Count unique exception types
61
+ const typeIndex = exceptionsTable.columns.findIndex((c) => c.name === 'type');
62
+ if (typeIndex >= 0) {
63
+ const types = new Set(exceptionsTable.rows.map((r) => r[typeIndex]));
64
+ insights.push(`- Found ${types.size} unique exception type(s)`);
65
+ }
66
+ // Count total exceptions
67
+ insights.push(`- Total exceptions: ${exceptionsTable.rows.length}`);
68
+ // Identify most common operation
69
+ const operationIndex = exceptionsTable.columns.findIndex((c) => c.name === 'operation_Name');
70
+ if (operationIndex >= 0) {
71
+ const operations = {};
72
+ exceptionsTable.rows.forEach((r) => {
73
+ const op = r[operationIndex];
74
+ operations[op] = (operations[op] || 0) + 1;
75
+ });
76
+ const mostCommon = Object.entries(operations).sort((a, b) => b[1] - a[1])[0];
77
+ if (mostCommon) {
78
+ insights.push(`- Most affected operation: ${mostCommon[0]} (${mostCommon[1]} exceptions)`);
79
+ }
80
+ }
81
+ return insights.join('\n');
82
+ }
83
+ /**
84
+ * Extract key insights from performance data
85
+ */
86
+ export function analyzePerformance(performanceTable) {
87
+ if (!performanceTable || !performanceTable.rows || performanceTable.rows.length === 0) {
88
+ return 'No performance data found in the specified time range.';
89
+ }
90
+ const insights = [];
91
+ // Find slowest operation
92
+ const avgDurationIndex = performanceTable.columns.findIndex((c) => c.name === 'AvgDuration');
93
+ const operationIndex = performanceTable.columns.findIndex((c) => c.name === 'operation_Name');
94
+ if (avgDurationIndex >= 0 && operationIndex >= 0) {
95
+ const sorted = [...performanceTable.rows].sort((a, b) => b[avgDurationIndex] - a[avgDurationIndex]);
96
+ const slowest = sorted[0];
97
+ insights.push(`- Slowest operation: ${slowest[operationIndex]} (avg: ${Math.round(slowest[avgDurationIndex])}ms)`);
98
+ }
99
+ // Find operation with most failures
100
+ const failureIndex = performanceTable.columns.findIndex((c) => c.name === 'FailureCount');
101
+ if (failureIndex >= 0 && operationIndex >= 0) {
102
+ const sorted = [...performanceTable.rows].sort((a, b) => b[failureIndex] - a[failureIndex]);
103
+ const mostFailed = sorted[0];
104
+ if (mostFailed[failureIndex] > 0) {
105
+ insights.push(`- Operation with most failures: ${mostFailed[operationIndex]} (${mostFailed[failureIndex]} failures)`);
106
+ }
107
+ }
108
+ return insights.join('\n');
109
+ }
110
+ /**
111
+ * Extract key insights from dependency data
112
+ */
113
+ export function analyzeDependencies(dependenciesTable) {
114
+ if (!dependenciesTable || !dependenciesTable.rows || dependenciesTable.rows.length === 0) {
115
+ return 'No dependency failures found in the specified time range.';
116
+ }
117
+ const insights = [];
118
+ // Count unique targets
119
+ const targetIndex = dependenciesTable.columns.findIndex((c) => c.name === 'target');
120
+ if (targetIndex >= 0) {
121
+ const targets = new Set(dependenciesTable.rows.map((r) => r[targetIndex]));
122
+ insights.push(`- Affected targets: ${targets.size}`);
123
+ }
124
+ // Count total failures
125
+ insights.push(`- Total failed dependency calls: ${dependenciesTable.rows.length}`);
126
+ // Identify most failing target
127
+ if (targetIndex >= 0) {
128
+ const targets = {};
129
+ dependenciesTable.rows.forEach((r) => {
130
+ const target = r[targetIndex];
131
+ targets[target] = (targets[target] || 0) + 1;
132
+ });
133
+ const mostFailing = Object.entries(targets).sort((a, b) => b[1] - a[1])[0];
134
+ if (mostFailing) {
135
+ insights.push(`- Most failing target: ${mostFailing[0]} (${mostFailing[1]} failures)`);
136
+ }
137
+ }
138
+ return insights.join('\n');
139
+ }
140
+ /**
141
+ * Sanitize error messages to remove sensitive information
142
+ */
143
+ export function sanitizeErrorMessage(message) {
144
+ // Remove potential connection strings
145
+ message = message.replace(/Server=.+?;/gi, 'Server=***;');
146
+ message = message.replace(/Password=.+?;/gi, 'Password=***;');
147
+ message = message.replace(/ApiKey=.+?;/gi, 'ApiKey=***;');
148
+ // Remove potential API keys and tokens
149
+ message = message.replace(/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi, 'Bearer ***');
150
+ message = message.replace(/[A-Za-z0-9]{32,}/g, '***'); // Remove long alphanumeric strings
151
+ return message;
152
+ }
153
+ /**
154
+ * Parse and validate ISO 8601 duration strings
155
+ */
156
+ export function parseTimespan(timespan) {
157
+ const iso8601Pattern = /^P(?:(\d+)D)?T?(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/;
158
+ const match = timespan.match(iso8601Pattern);
159
+ if (!match) {
160
+ return {
161
+ valid: false,
162
+ error: 'Invalid timespan format. Use ISO 8601 duration (e.g., PT1H, P1D, PT30M)',
163
+ };
164
+ }
165
+ return { valid: true };
166
+ }
167
+ /**
168
+ * Get common timespan presets
169
+ */
170
+ export function getTimespanPresets() {
171
+ return {
172
+ '15min': 'PT15M',
173
+ '30min': 'PT30M',
174
+ '1hour': 'PT1H',
175
+ '6hours': 'PT6H',
176
+ '12hours': 'PT12H',
177
+ '1day': 'P1D',
178
+ '7days': 'P7D',
179
+ '30days': 'P30D',
180
+ };
181
+ }
182
+ //# sourceMappingURL=appinsights-formatters.js.map
@@ -0,0 +1 @@
1
+ {"version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AAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,sCAAsC;IACtC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IAC1D,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IAC9D,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IAE1D,uCAAuC;IACvC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,EAAE,YAAY,CAAC,CAAC;IAC5E,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAC,mCAAmC;IAE1F,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,MAAM,cAAc,GAAG,mDAAmD,CAAC;IAC3E,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,yEAAyE;SACjF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,MAAM;KACjB,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@mcp-consultant-tools/application-insights",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Azure Application Insights - telemetry and performance monitoring",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "types": "./build/index.d.ts",
8
+ "bin": { "mcp-appinsights": "./build/index.js" },
9
+ "exports": { ".": { "import": "./build/index.js", "types": "./build/index.d.ts" } },
10
+ "files": ["build", "README.md"],
11
+ "scripts": { "build": "tsc", "clean": "rm -rf build *.tsbuildinfo", "prepublishOnly": "npm run build" },
12
+ "keywords": ["mcp", "model-context-protocol", "azure", "application-insights", "telemetry", "monitoring"],
13
+ "author": "Michal Sobieraj",
14
+ "license": "MIT",
15
+ "repository": { "type": "git", "url": "git+https://github.com/klemensms/mcp-consultant-tools.git", "directory": "packages/application-insights" },
16
+ "engines": { "node": ">=16.0.0" },
17
+ "dependencies": {
18
+ "@azure/msal-node": "^3.3.0",
19
+ "@mcp-consultant-tools/core": "^1.0.0",
20
+ "@modelcontextprotocol/sdk": "^1.0.4",
21
+ "axios": "^1.8.3",
22
+ "zod": "^3.24.1"
23
+ },
24
+ "devDependencies": { "@types/node": "^22.10.5", "typescript": "^5.8.2" }
25
+ }