hawkeye-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 (70) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/INSTALLATION.md +734 -0
  3. package/LICENSE +21 -0
  4. package/README.md +289 -0
  5. package/SPECIFICATION.md +1073 -0
  6. package/USAGE.md +849 -0
  7. package/build/config/config.d.ts +58 -0
  8. package/build/config/config.js +100 -0
  9. package/build/config/config.js.map +1 -0
  10. package/build/index.d.ts +6 -0
  11. package/build/index.js +138 -0
  12. package/build/index.js.map +1 -0
  13. package/build/services/auth.service.d.ts +34 -0
  14. package/build/services/auth.service.js +96 -0
  15. package/build/services/auth.service.js.map +1 -0
  16. package/build/services/project.service.d.ts +50 -0
  17. package/build/services/project.service.js +136 -0
  18. package/build/services/project.service.js.map +1 -0
  19. package/build/services/session.service.d.ts +68 -0
  20. package/build/services/session.service.js +357 -0
  21. package/build/services/session.service.js.map +1 -0
  22. package/build/tools/continue-investigation.d.ts +10 -0
  23. package/build/tools/continue-investigation.js +84 -0
  24. package/build/tools/continue-investigation.js.map +1 -0
  25. package/build/tools/get-incident-report.d.ts +10 -0
  26. package/build/tools/get-incident-report.js +62 -0
  27. package/build/tools/get-incident-report.js.map +1 -0
  28. package/build/tools/get-session-report.d.ts +25 -0
  29. package/build/tools/get-session-report.js +46 -0
  30. package/build/tools/get-session-report.js.map +1 -0
  31. package/build/tools/get-session-summary.d.ts +22 -0
  32. package/build/tools/get-session-summary.js +41 -0
  33. package/build/tools/get-session-summary.js.map +1 -0
  34. package/build/tools/get-status.d.ts +10 -0
  35. package/build/tools/get-status.js +129 -0
  36. package/build/tools/get-status.js.map +1 -0
  37. package/build/tools/index.d.ts +29 -0
  38. package/build/tools/index.js +349 -0
  39. package/build/tools/index.js.map +1 -0
  40. package/build/tools/inspect-session.d.ts +28 -0
  41. package/build/tools/inspect-session.js +51 -0
  42. package/build/tools/inspect-session.js.map +1 -0
  43. package/build/tools/investigate-alert.d.ts +10 -0
  44. package/build/tools/investigate-alert.js +122 -0
  45. package/build/tools/investigate-alert.js.map +1 -0
  46. package/build/tools/list-sessions.d.ts +49 -0
  47. package/build/tools/list-sessions.js +79 -0
  48. package/build/tools/list-sessions.js.map +1 -0
  49. package/build/types/errors.d.ts +61 -0
  50. package/build/types/errors.js +76 -0
  51. package/build/types/errors.js.map +1 -0
  52. package/build/types/hawkeye.d.ts +238 -0
  53. package/build/types/hawkeye.js +8 -0
  54. package/build/types/hawkeye.js.map +1 -0
  55. package/build/types/mcp.d.ts +125 -0
  56. package/build/types/mcp.js +6 -0
  57. package/build/types/mcp.js.map +1 -0
  58. package/build/utils/errors.d.ts +20 -0
  59. package/build/utils/errors.js +125 -0
  60. package/build/utils/errors.js.map +1 -0
  61. package/build/utils/http-client.d.ts +51 -0
  62. package/build/utils/http-client.js +133 -0
  63. package/build/utils/http-client.js.map +1 -0
  64. package/build/utils/logger.d.ts +35 -0
  65. package/build/utils/logger.js +77 -0
  66. package/build/utils/logger.js.map +1 -0
  67. package/build/utils/validation.d.ts +134 -0
  68. package/build/utils/validation.js +68 -0
  69. package/build/utils/validation.js.map +1 -0
  70. package/package.json +66 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * HTTP client wrapper with retry logic and better error handling
3
+ * Wraps axios with exponential backoff and standardized error handling
4
+ */
5
+ import axios from 'axios';
6
+ import { CONSTANTS } from '../config/config.js';
7
+ import { logger } from './logger.js';
8
+ import { isRetryableError } from './errors.js';
9
+ /**
10
+ * HTTP client with retry logic
11
+ */
12
+ export class HttpClient {
13
+ client;
14
+ maxRetries;
15
+ baseDelay;
16
+ backoffMultiplier;
17
+ constructor(baseURL, defaultTimeout = CONSTANTS.TIMEOUTS.DEFAULT_REQUEST) {
18
+ this.client = axios.create({
19
+ baseURL,
20
+ timeout: defaultTimeout,
21
+ headers: {
22
+ // Don't set Content-Type as default - it causes issues with GET requests
23
+ // Content-Type will be set per-request for POST/PUT/PATCH
24
+ 'Accept': CONSTANTS.HEADERS.ACCEPT,
25
+ 'X-Client-Identifier': CONSTANTS.HEADERS.CLIENT_IDENTIFIER,
26
+ },
27
+ });
28
+ this.maxRetries = CONSTANTS.RETRY.MAX_ATTEMPTS;
29
+ this.baseDelay = CONSTANTS.RETRY.BACKOFF_MS;
30
+ this.backoffMultiplier = CONSTANTS.RETRY.BACKOFF_MULTIPLIER;
31
+ }
32
+ /**
33
+ * Set authorization header
34
+ */
35
+ setAuthToken(token) {
36
+ this.client.defaults.headers.common['Authorization'] = `Bearer ${token}`;
37
+ }
38
+ /**
39
+ * Clear authorization header
40
+ */
41
+ clearAuthToken() {
42
+ delete this.client.defaults.headers.common['Authorization'];
43
+ }
44
+ /**
45
+ * Execute request with retry logic
46
+ */
47
+ async executeWithRetry(requestFn, attempt = 0) {
48
+ try {
49
+ return await requestFn();
50
+ }
51
+ catch (error) {
52
+ // Check if we should retry
53
+ if (attempt < this.maxRetries && isRetryableError(error)) {
54
+ const delay = this.baseDelay * Math.pow(this.backoffMultiplier, attempt);
55
+ logger.warn(`Request failed (attempt ${attempt + 1}/${this.maxRetries}), retrying in ${delay}ms`, {
56
+ error: error instanceof Error ? error.message : String(error),
57
+ });
58
+ // Wait before retrying
59
+ await new Promise(resolve => setTimeout(resolve, delay));
60
+ // Retry
61
+ return this.executeWithRetry(requestFn, attempt + 1);
62
+ }
63
+ // No more retries or not retryable
64
+ throw error;
65
+ }
66
+ }
67
+ /**
68
+ * GET request
69
+ */
70
+ async get(url, config) {
71
+ logger.debug(`GET ${url}`, config?.params);
72
+ return this.executeWithRetry(() => this.client.get(url, config));
73
+ }
74
+ /**
75
+ * POST request
76
+ */
77
+ async post(url, data, config) {
78
+ logger.debug(`POST ${url}`, { data });
79
+ // Set Content-Type for POST requests
80
+ const requestConfig = {
81
+ ...config,
82
+ headers: {
83
+ 'Content-Type': CONSTANTS.HEADERS.CONTENT_TYPE,
84
+ ...config?.headers,
85
+ },
86
+ };
87
+ return this.executeWithRetry(() => this.client.post(url, data, requestConfig));
88
+ }
89
+ /**
90
+ * PUT request
91
+ */
92
+ async put(url, data, config) {
93
+ logger.debug(`PUT ${url}`, { data });
94
+ // Set Content-Type for PUT requests
95
+ const requestConfig = {
96
+ ...config,
97
+ headers: {
98
+ 'Content-Type': CONSTANTS.HEADERS.CONTENT_TYPE,
99
+ ...config?.headers,
100
+ },
101
+ };
102
+ return this.executeWithRetry(() => this.client.put(url, data, requestConfig));
103
+ }
104
+ /**
105
+ * DELETE request
106
+ */
107
+ async delete(url, config) {
108
+ logger.debug(`DELETE ${url}`);
109
+ return this.executeWithRetry(() => this.client.delete(url, config));
110
+ }
111
+ /**
112
+ * PATCH request
113
+ */
114
+ async patch(url, data, config) {
115
+ logger.debug(`PATCH ${url}`, { data });
116
+ // Set Content-Type for PATCH requests
117
+ const requestConfig = {
118
+ ...config,
119
+ headers: {
120
+ 'Content-Type': CONSTANTS.HEADERS.CONTENT_TYPE,
121
+ ...config?.headers,
122
+ },
123
+ };
124
+ return this.executeWithRetry(() => this.client.patch(url, data, requestConfig));
125
+ }
126
+ /**
127
+ * Get the underlying Axios instance for advanced usage
128
+ */
129
+ getAxiosInstance() {
130
+ return this.client;
131
+ }
132
+ }
133
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/utils/http-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAgB;IACtB,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,iBAAiB,CAAS;IAElC,YAAY,OAAe,EAAE,iBAAyB,SAAS,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ACrF,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Logging utilities for Hawkeye MCP Server
3
+ *
4
+ * Important: In MCP servers, we use stderr for debug/log messages
5
+ * and stdout is reserved for MCP protocol communication only.
6
+ */
7
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
8
+ /**
9
+ * Logger class for structured logging to stderr
10
+ */
11
+ declare class Logger {
12
+ private enabled;
13
+ private minLevel;
14
+ constructor();
15
+ private shouldLog;
16
+ private formatMessage;
17
+ /**
18
+ * Log debug message (lowest priority)
19
+ */
20
+ debug(message: string, data?: any): void;
21
+ /**
22
+ * Log informational message
23
+ */
24
+ info(message: string, data?: any): void;
25
+ /**
26
+ * Log warning message
27
+ */
28
+ warn(message: string, data?: any): void;
29
+ /**
30
+ * Log error message (highest priority)
31
+ */
32
+ error(message: string, error?: Error | any): void;
33
+ }
34
+ export declare const logger: Logger;
35
+ export {};
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Logging utilities for Hawkeye MCP Server
3
+ *
4
+ * Important: In MCP servers, we use stderr for debug/log messages
5
+ * and stdout is reserved for MCP protocol communication only.
6
+ */
7
+ /**
8
+ * Logger class for structured logging to stderr
9
+ */
10
+ class Logger {
11
+ enabled;
12
+ minLevel;
13
+ constructor() {
14
+ this.enabled = process.env.HAWKEYE_LOG_ENABLED !== 'false';
15
+ this.minLevel = process.env.HAWKEYE_LOG_LEVEL || 'info';
16
+ }
17
+ shouldLog(level) {
18
+ if (!this.enabled)
19
+ return false;
20
+ const levels = ['debug', 'info', 'warn', 'error'];
21
+ const currentLevelIndex = levels.indexOf(this.minLevel);
22
+ const messageLevelIndex = levels.indexOf(level);
23
+ return messageLevelIndex >= currentLevelIndex;
24
+ }
25
+ formatMessage(level, message, data) {
26
+ const timestamp = new Date().toISOString();
27
+ const levelStr = level.toUpperCase().padEnd(5);
28
+ let output = `[${timestamp}] ${levelStr} ${message}`;
29
+ if (data !== undefined) {
30
+ if (typeof data === 'object') {
31
+ output += `\n${JSON.stringify(data, null, 2)}`;
32
+ }
33
+ else {
34
+ output += ` ${data}`;
35
+ }
36
+ }
37
+ return output;
38
+ }
39
+ /**
40
+ * Log debug message (lowest priority)
41
+ */
42
+ debug(message, data) {
43
+ if (this.shouldLog('debug')) {
44
+ console.error(this.formatMessage('debug', message, data));
45
+ }
46
+ }
47
+ /**
48
+ * Log informational message
49
+ */
50
+ info(message, data) {
51
+ if (this.shouldLog('info')) {
52
+ console.error(this.formatMessage('info', message, data));
53
+ }
54
+ }
55
+ /**
56
+ * Log warning message
57
+ */
58
+ warn(message, data) {
59
+ if (this.shouldLog('warn')) {
60
+ console.error(this.formatMessage('warn', message, data));
61
+ }
62
+ }
63
+ /**
64
+ * Log error message (highest priority)
65
+ */
66
+ error(message, error) {
67
+ if (this.shouldLog('error')) {
68
+ const errorData = error instanceof Error
69
+ ? { message: error.message, stack: error.stack }
70
+ : error;
71
+ console.error(this.formatMessage('error', message, errorData));
72
+ }
73
+ }
74
+ }
75
+ // Export singleton instance
76
+ export const logger = new Logger();
77
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,MAAM;IACF,OAAO,CAAU;IACjB,QAAQ,CAAW;IAE3B;QACE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAI,OAAO,CAAC,GAAG,CAAC,iBAA8B,IAAI,MAAM,CAAC;IACxE,CAAC;IAEO,SAAS,CAAC,KAAe;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAEhC,MAAM,MAAM,GAAe,CAAC,OAAO,EAAE,MAAM,EAA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M,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAe,EAAE,IAAU;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAe,EAAE,KAAmB;QACxC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,MAAM,SAAS,GAAG,KAAK,YAAY,KAAK;gBACtC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;gBAChD,CAAC,CAAC,KAAK,CAAC;YAEV,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Validation schemas for MCP tool inputs
3
+ * Uses Zod for runtime type validation (no eval!)
4
+ */
5
+ import { z } from 'zod';
6
+ export declare const InvestigateAlertInputSchema: z.ZodObject<{
7
+ alert_id: z.ZodString;
8
+ project_uuid: z.ZodOptional<z.ZodString>;
9
+ wait_for_completion: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
10
+ max_wait_seconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ alert_id: string;
13
+ wait_for_completion: boolean;
14
+ max_wait_seconds: number;
15
+ project_uuid?: string | undefined;
16
+ }, {
17
+ alert_id: string;
18
+ project_uuid?: string | undefined;
19
+ wait_for_completion?: boolean | undefined;
20
+ max_wait_seconds?: number | undefined;
21
+ }>;
22
+ export declare const CreateInvestigationInputSchema: z.ZodObject<{
23
+ prompt: z.ZodString;
24
+ timeframe: z.ZodOptional<z.ZodString>;
25
+ start_time: z.ZodOptional<z.ZodString>;
26
+ end_time: z.ZodOptional<z.ZodString>;
27
+ project_uuid: z.ZodOptional<z.ZodString>;
28
+ wait_for_completion: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
29
+ max_wait_seconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
30
+ stream_updates: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ wait_for_completion: boolean;
33
+ max_wait_seconds: number;
34
+ prompt: string;
35
+ stream_updates: boolean;
36
+ project_uuid?: string | undefined;
37
+ timeframe?: string | undefined;
38
+ start_time?: string | undefined;
39
+ end_time?: string | undefined;
40
+ }, {
41
+ prompt: string;
42
+ project_uuid?: string | undefined;
43
+ wait_for_completion?: boolean | undefined;
44
+ max_wait_seconds?: number | undefined;
45
+ timeframe?: string | undefined;
46
+ start_time?: string | undefined;
47
+ end_time?: string | undefined;
48
+ stream_updates?: boolean | undefined;
49
+ }>;
50
+ export declare const GetInvestigationStatusInputSchema: z.ZodObject<{
51
+ session_uuid: z.ZodString;
52
+ project_uuid: z.ZodOptional<z.ZodString>;
53
+ include_full_details: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ session_uuid: string;
56
+ include_full_details: boolean;
57
+ project_uuid?: string | undefined;
58
+ }, {
59
+ session_uuid: string;
60
+ project_uuid?: string | undefined;
61
+ include_full_details?: boolean | undefined;
62
+ }>;
63
+ export declare const ContinueInvestigationInputSchema: z.ZodObject<{
64
+ session_uuid: z.ZodString;
65
+ follow_up_prompt: z.ZodString;
66
+ project_uuid: z.ZodOptional<z.ZodString>;
67
+ wait_for_completion: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
68
+ max_wait_seconds: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ session_uuid: string;
71
+ wait_for_completion: boolean;
72
+ max_wait_seconds: number;
73
+ follow_up_prompt: string;
74
+ project_uuid?: string | undefined;
75
+ }, {
76
+ session_uuid: string;
77
+ follow_up_prompt: string;
78
+ project_uuid?: string | undefined;
79
+ wait_for_completion?: boolean | undefined;
80
+ max_wait_seconds?: number | undefined;
81
+ }>;
82
+ export declare const ListProjectsInputSchema: z.ZodObject<{
83
+ include_inactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ include_inactive: boolean;
86
+ }, {
87
+ include_inactive?: boolean | undefined;
88
+ }>;
89
+ export declare const ListRecentInvestigationsInputSchema: z.ZodObject<{
90
+ project_uuid: z.ZodOptional<z.ZodString>;
91
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
92
+ filter_by_alert_id: z.ZodOptional<z.ZodString>;
93
+ filter_by_status: z.ZodOptional<z.ZodEnum<["completed", "in_progress", "failed"]>>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ limit: number;
96
+ project_uuid?: string | undefined;
97
+ filter_by_alert_id?: string | undefined;
98
+ filter_by_status?: "completed" | "in_progress" | "failed" | undefined;
99
+ }, {
100
+ project_uuid?: string | undefined;
101
+ limit?: number | undefined;
102
+ filter_by_alert_id?: string | undefined;
103
+ filter_by_status?: "completed" | "in_progress" | "failed" | undefined;
104
+ }>;
105
+ export declare const ConfigureDefaultsInputSchema: z.ZodObject<{
106
+ default_project_uuid: z.ZodOptional<z.ZodString>;
107
+ default_organization_uuid: z.ZodOptional<z.ZodString>;
108
+ default_timeframe: z.ZodOptional<z.ZodString>;
109
+ enable_streaming: z.ZodOptional<z.ZodBoolean>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ default_project_uuid?: string | undefined;
112
+ default_organization_uuid?: string | undefined;
113
+ default_timeframe?: string | undefined;
114
+ enable_streaming?: boolean | undefined;
115
+ }, {
116
+ default_project_uuid?: string | undefined;
117
+ default_organization_uuid?: string | undefined;
118
+ default_timeframe?: string | undefined;
119
+ enable_streaming?: boolean | undefined;
120
+ }>;
121
+ /**
122
+ * Validate and parse input against a Zod schema
123
+ */
124
+ export declare function validateInput<T>(schema: z.ZodSchema<T>, input: unknown): T;
125
+ /**
126
+ * Safe validation that returns errors instead of throwing
127
+ */
128
+ export declare function safeValidateInput<T>(schema: z.ZodSchema<T>, input: unknown): {
129
+ success: true;
130
+ data: T;
131
+ } | {
132
+ success: false;
133
+ error: z.ZodError;
134
+ };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Validation schemas for MCP tool inputs
3
+ * Uses Zod for runtime type validation (no eval!)
4
+ */
5
+ import { z } from 'zod';
6
+ // ============================================================================
7
+ // Tool Input Schemas
8
+ // ============================================================================
9
+ export const InvestigateAlertInputSchema = z.object({
10
+ alert_id: z.string().min(1, 'Alert ID is required'),
11
+ project_uuid: z.string().uuid().optional(),
12
+ wait_for_completion: z.boolean().optional().default(false),
13
+ max_wait_seconds: z.number().int().positive().optional().default(300),
14
+ });
15
+ export const CreateInvestigationInputSchema = z.object({
16
+ prompt: z.string().min(1, 'Prompt is required'),
17
+ timeframe: z.string().optional(),
18
+ start_time: z.string().datetime().optional(),
19
+ end_time: z.string().datetime().optional(),
20
+ project_uuid: z.string().uuid().optional(),
21
+ wait_for_completion: z.boolean().optional().default(false),
22
+ max_wait_seconds: z.number().int().positive().optional().default(300),
23
+ stream_updates: z.boolean().optional().default(false),
24
+ });
25
+ export const GetInvestigationStatusInputSchema = z.object({
26
+ session_uuid: z.string().uuid('Invalid session UUID'),
27
+ project_uuid: z.string().uuid().optional(),
28
+ include_full_details: z.boolean().optional().default(true),
29
+ });
30
+ export const ContinueInvestigationInputSchema = z.object({
31
+ session_uuid: z.string().uuid('Invalid session UUID'),
32
+ follow_up_prompt: z.string().min(1, 'Follow-up prompt is required'),
33
+ project_uuid: z.string().uuid().optional(),
34
+ wait_for_completion: z.boolean().optional().default(false),
35
+ max_wait_seconds: z.number().int().positive().optional().default(300),
36
+ });
37
+ export const ListProjectsInputSchema = z.object({
38
+ include_inactive: z.boolean().optional().default(false),
39
+ });
40
+ export const ListRecentInvestigationsInputSchema = z.object({
41
+ project_uuid: z.string().uuid().optional(),
42
+ limit: z.number().int().positive().optional().default(10),
43
+ filter_by_alert_id: z.string().optional(),
44
+ filter_by_status: z.enum(['completed', 'in_progress', 'failed']).optional(),
45
+ });
46
+ export const ConfigureDefaultsInputSchema = z.object({
47
+ default_project_uuid: z.string().uuid().optional(),
48
+ default_organization_uuid: z.string().optional(),
49
+ default_timeframe: z.string().optional(),
50
+ enable_streaming: z.boolean().optional(),
51
+ });
52
+ // ============================================================================
53
+ // Helper Functions
54
+ // ============================================================================
55
+ /**
56
+ * Validate and parse input against a Zod schema
57
+ */
58
+ export function validateInput(schema, input) {
59
+ return schema.parse(input);
60
+ }
61
+ /**
62
+ * Safe validation that returns errors instead of throwing
63
+ */
64
+ export function safeValidateInput(schema, input) {
65
+ const result = schema.safeParse(input);
66
+ return result;
67
+ }
68
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;IACnD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC1C,mBAAmB,EAAE,CAAC,CAAC,OAAO,EA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,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC5E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAClD,yBAAyB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAsB,EACtB,KAAc;IAEd,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAsB,EACtB,KAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "hawkeye-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP Server for Hawkeye automated incident investigation and root cause analysis",
5
+ "private": false,
6
+ "type": "module",
7
+ "main": "build/index.js",
8
+ "bin": {
9
+ "hawkeye-mcp": "build/index.js"
10
+ },
11
+ "files": [
12
+ "build/**/*",
13
+ "README.md",
14
+ "INSTALLATION.md",
15
+ "USAGE.md",
16
+ "SPECIFICATION.md",
17
+ "LICENSE",
18
+ "CHANGELOG.md"
19
+ ],
20
+ "scripts": {
21
+ "start": "node build/index.js",
22
+ "build": "tsc && chmod 755 build/index.js",
23
+ "typecheck": "tsc --noEmit",
24
+ "prestart": "npm run build",
25
+ "prepublishOnly": "npm run build",
26
+ "test:install": "node build/index.js --version"
27
+ },
28
+ "keywords": [
29
+ "mcp",
30
+ "model-context-protocol",
31
+ "hawkeye",
32
+ "neubird",
33
+ "incident-investigation",
34
+ "rca",
35
+ "root-cause-analysis",
36
+ "cloud-monitoring",
37
+ "observability",
38
+ "cursor",
39
+ "claude",
40
+ "ai-agent"
41
+ ],
42
+ "author": "Neubird AI <support@neubird.ai>",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/neubird/solutions"
47
+ },
48
+ "homepage": "https://github.com/neubird/solutions/tree/main/hawkeye-mcp",
49
+ "bugs": {
50
+ "email": "support@neubird.ai"
51
+ },
52
+ "engines": {
53
+ "node": ">=20.0.0"
54
+ },
55
+ "dependencies": {
56
+ "@modelcontextprotocol/sdk": "^1.10.0",
57
+ "axios": "^1.9.0",
58
+ "dotenv": "^16.4.5",
59
+ "zod": "^3.24.3",
60
+ "json-schema-to-zod": "^2.6.1"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.15.2",
64
+ "typescript": "^5.8.3"
65
+ }
66
+ }