hawkeye-mcp-server 1.2.0 → 1.2.1

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,91 @@ All notable changes to the Hawkeye MCP Server will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.1] - 2025-11-20
9
+
10
+ ### Enhanced
11
+ - **Smart URL Normalization for Instance Switching** - The `hawkeye_switch_instance` tool now accepts flexible URL formats:
12
+ - Just subdomain: `"prod"` → `https://prod.app.neubird.ai/api`
13
+ - Partial URL: `"prod.app.neubird.ai"` → `https://prod.app.neubird.ai/api`
14
+ - Full URL: preserved with smart completion
15
+ - Automatic `https://` prefix addition
16
+ - Automatic `/api` path suffix addition
17
+ - Custom domain support
18
+
19
+ ### Added
20
+ - Comprehensive URL normalization examples in documentation
21
+ - New "Working with Multiple Hawkeye Instances" section in USAGE.md
22
+ - Complete tool specification for `hawkeye_switch_instance` in SPECIFICATION.md
23
+ - Test suite for URL normalization (7 test cases, 100% passing)
24
+
25
+ ### Changed
26
+ - Updated tool description to clarify flexible URL input formats
27
+ - Enhanced error messages with URL normalization information
28
+
29
+ ---
30
+
31
+ ## [1.2.0] - 2025-11-20
32
+
33
+ ### Added
34
+ - **Instance Switching** - New `hawkeye_switch_instance` tool for managing multiple Hawkeye environments
35
+ - Switch between dev/staging/production environments
36
+ - Support for multiple customer deployments
37
+ - Automatic authentication token clearing
38
+ - Automatic project cache clearing
39
+ - URL validation
40
+
41
+ ### Changed
42
+ - Added `clearCache()` method to ProjectService
43
+ - Added `clearTokenCache()` method to AuthenticationService
44
+ - Updated ToolServices interface to include authService
45
+
46
+ ---
47
+
48
+ ## [1.1.0] - 2025-11-19
49
+
50
+ ### Added
51
+ - **Search Functionality** - New `search_term` parameter for `hawkeye_list_sessions`
52
+ - Search incidents by title using keywords (e.g., "load avg", "database", "timeout")
53
+ - Case-insensitive partial matching
54
+ - Works with both investigated and uninvestigated incidents
55
+ - Can be combined with other filters
56
+
57
+ ### Changed
58
+ - Updated documentation with search examples
59
+ - Enhanced USAGE.md with search use cases
60
+
61
+ ---
62
+
63
+ ## [1.0.2] - 2025-11-19
64
+
65
+ ### Enhanced
66
+ - **Tool Descriptions** - Improved clarity to help LLMs select the correct tool
67
+ - Added explicit "START new" vs "ALREADY STARTED" language
68
+ - Added "Do NOT use" warnings to prevent tool confusion
69
+ - Enhanced parameter descriptions for alert_id and session_uuid
70
+ - Added `investigation_hint` to list_sessions response for uninvestigated incidents
71
+
72
+ ### Changed
73
+ - Updated tool descriptions for `hawkeye_investigate_alert` and `hawkeye_continue_investigation`
74
+ - Added contextual hints in responses to guide proper tool usage
75
+
76
+ ---
77
+
78
+ ## [1.0.1] - 2025-11-19
79
+
80
+ ### Added
81
+ - **Compact Mode** - Automatic token optimization for large result sets
82
+ - Auto-enables for >10 sessions in list_sessions
83
+ - Strips verbose fields (raw_data, detailed grouped_incidents)
84
+ - 88.5% token reduction (from ~78KB to ~9KB for 20 sessions)
85
+ - Keeps essential fields: id, title, priority, status, create_time
86
+ - Manual control via `compact` parameter
87
+
88
+ ### Enhanced
89
+ - Added helpful hints in responses (compact_hint, pagination_hint, investigation_hint)
90
+
91
+ ---
92
+
8
93
  ## [1.0.0] - 2024-11-19
9
94
 
10
95
  ### Added
package/README.md CHANGED
@@ -216,20 +216,33 @@ Ask follow-up questions on an existing investigation:
216
216
 
217
217
  ### 7. Switch Hawkeye Instances
218
218
 
219
- Switch between different Hawkeye environments or customer instances:
219
+ Switch between different Hawkeye environments or customer instances with flexible URL formats:
220
220
 
221
221
  ```
222
- "Switch to the production Hawkeye instance at https://prod.app.neubird.ai/api"
222
+ "Switch to the production instance"
223
+ "Switch to customerA deployment"
224
+ "Switch to staging.app.neubird.ai"
223
225
  ```
224
226
 
225
- The MCP server will call `hawkeye_switch_instance` with:
227
+ The tool accepts multiple URL formats and automatically normalizes them:
228
+
229
+ **Supported Formats:**
230
+ - **Just subdomain**: `"prod"` → `https://prod.app.neubird.ai/api`
231
+ - **Subdomain name**: `"customerA"` → `https://customerA.app.neubird.ai/api`
232
+ - **Partial URL**: `"prod.app.neubird.ai"` → `https://prod.app.neubird.ai/api`
233
+ - **URL without protocol**: `"staging.app.neubird.ai"` → `https://staging.app.neubird.ai/api`
234
+ - **Full URL without path**: `"https://prod.app.neubird.ai"` → `https://prod.app.neubird.ai/api`
235
+ - **Complete URL**: `"https://prod.app.neubird.ai/api"` → `https://prod.app.neubird.ai/api` (no change)
236
+ - **Custom domains**: `"custom.domain.com/api"` → `https://custom.domain.com/api`
237
+
238
+ **Example:**
226
239
  ```json
227
240
  {
228
- "base_url": "https://prod.app.neubird.ai/api"
241
+ "base_url": "prod"
229
242
  }
230
243
  ```
231
244
 
232
- Useful for users managing multiple environments (dev, staging, production) or multiple customer instances. Automatically clears authentication tokens and project cache.
245
+ Useful for users managing multiple environments (dev, staging, production) or multiple customer instances. Automatically clears authentication tokens and project cache, requiring re-authentication on the next API call.
233
246
 
234
247
  ## 🛠️ Available Tools
235
248
 
package/SPECIFICATION.md CHANGED
@@ -474,7 +474,92 @@ A developer using Cursor.ai encounters an alert or incident in their cloud envir
474
474
  }
475
475
  ```
476
476
 
477
- ### 11. `hawkeye_configure_defaults`
477
+ ### 11. `hawkeye_switch_instance`
478
+
479
+ **Description**: Switch to a different Hawkeye instance by updating the base URL. Useful for users managing multiple Hawkeye environments (dev, staging, prod) or multiple customer instances.
480
+
481
+ **Input Schema**:
482
+ ```typescript
483
+ {
484
+ base_url: string; // The new Hawkeye instance to connect to
485
+ // Accepts multiple formats:
486
+ // - Just subdomain: "prod", "customerA"
487
+ // - Partial URL: "prod.app.neubird.ai"
488
+ // - Full URL: "https://prod.app.neubird.ai/api"
489
+ }
490
+ ```
491
+
492
+ **Behavior**:
493
+ 1. Normalizes the input URL to ensure correct format:
494
+ - Adds `.app.neubird.ai` suffix if only subdomain provided
495
+ - Adds `https://` prefix if protocol missing
496
+ - Adds `/api` path if not present
497
+ 2. Validates the URL format
498
+ 3. Updates the base URL configuration
499
+ 4. Clears cached authentication tokens (different instance requires new auth)
500
+ 5. Clears project cache (different instance has different projects)
501
+
502
+ **URL Normalization Examples**:
503
+
504
+ | Input | Normalized Output |
505
+ |-------|------------------|
506
+ | `"prod"` | `https://prod.app.neubird.ai/api` |
507
+ | `"customerA"` | `https://customerA.app.neubird.ai/api` |
508
+ | `"staging"` | `https://staging.app.neubird.ai/api` |
509
+ | `"prod.app.neubird.ai"` | `https://prod.app.neubird.ai/api` |
510
+ | `"https://prod.app.neubird.ai"` | `https://prod.app.neubird.ai/api` |
511
+ | `"https://prod.app.neubird.ai/api"` | `https://prod.app.neubird.ai/api` |
512
+ | `"custom.domain.com/api"` | `https://custom.domain.com/api` |
513
+
514
+ **Output**:
515
+ ```typescript
516
+ {
517
+ success: boolean;
518
+ input_provided: string; // Original input from user
519
+ normalized_url: string; // URL after normalization
520
+ previous_url: string; // Previous base URL
521
+ new_url: string; // New base URL (same as normalized_url)
522
+ message: string; // Human-readable status message
523
+ note: string; // Important information about next steps
524
+ }
525
+ ```
526
+
527
+ **Success Response Example**:
528
+ ```typescript
529
+ {
530
+ success: true,
531
+ input_provided: "prod",
532
+ normalized_url: "https://prod.app.neubird.ai/api",
533
+ previous_url: "https://sandbox.app.neubird.ai/api",
534
+ new_url: "https://prod.app.neubird.ai/api",
535
+ message: "Switched from https://sandbox.app.neubird.ai/api to https://prod.app.neubird.ai/api. Authentication tokens cleared. You can now use Hawkeye tools with the new instance.",
536
+ note: "The next Hawkeye API call will authenticate against the new instance."
537
+ }
538
+ ```
539
+
540
+ **Error Response Example**:
541
+ ```typescript
542
+ {
543
+ success: false,
544
+ error: "Invalid base URL format: invalid-url",
545
+ current_url: "https://sandbox.app.neubird.ai/api",
546
+ suggestions: [
547
+ "Verify the base URL format is correct (e.g., \"https://app.neubird.ai/api\")",
548
+ "Ensure the URL includes the /api path",
549
+ "Check that the instance is accessible"
550
+ ]
551
+ }
552
+ ```
553
+
554
+ **Important Notes**:
555
+ - Switching instances clears all authentication tokens
556
+ - Switching instances clears the project cache
557
+ - The next API call will trigger re-authentication
558
+ - Users will need to re-list projects after switching
559
+
560
+ ---
561
+
562
+ ### 12. `hawkeye_configure_defaults`
478
563
 
479
564
  **Description**: Sets default project and preferences for the session.
480
565
 
package/USAGE.md CHANGED
@@ -529,6 +529,79 @@ The `search_term` parameter performs case-insensitive partial matching on incide
529
529
 
530
530
  ## Advanced Usage
531
531
 
532
+ ### Working with Multiple Hawkeye Instances
533
+
534
+ If you manage multiple Hawkeye instances (dev, staging, production) or multiple customer deployments, you can easily switch between them:
535
+
536
+ **Switch Using Simple Names:**
537
+
538
+ ```
539
+ You: "Switch to the production instance"
540
+
541
+ Agent: *Calls hawkeye_switch_instance with base_url: "prod"*
542
+
543
+ Response:
544
+ ✅ Switched from https://sandbox.app.neubird.ai/api to https://prod.app.neubird.ai/api
545
+ Authentication tokens cleared. Next API call will authenticate against the new instance.
546
+ ```
547
+
548
+ **Switch Using Partial URLs:**
549
+
550
+ ```
551
+ You: "Switch to staging.app.neubird.ai"
552
+
553
+ Agent: *Automatically adds https:// prefix and /api suffix*
554
+
555
+ Response: Successfully switched to https://staging.app.neubird.ai/api
556
+ ```
557
+
558
+ **Switch to Customer Deployments:**
559
+
560
+ ```
561
+ You: "Switch to the customerA deployment"
562
+
563
+ Agent: *Calls hawkeye_switch_instance with base_url: "customerA"*
564
+
565
+ Response: Switched to https://customerA.app.neubird.ai/api
566
+ ```
567
+
568
+ **Supported URL Formats:**
569
+
570
+ The `hawkeye_switch_instance` tool accepts flexible URL formats:
571
+
572
+ | Input Format | Normalized Output |
573
+ |--------------|------------------|
574
+ | `"prod"` | `https://prod.app.neubird.ai/api` |
575
+ | `"customerA"` | `https://customerA.app.neubird.ai/api` |
576
+ | `"staging.app.neubird.ai"` | `https://staging.app.neubird.ai/api` |
577
+ | `"https://prod.app.neubird.ai"` | `https://prod.app.neubird.ai/api` |
578
+ | `"https://prod.app.neubird.ai/api"` | `https://prod.app.neubird.ai/api` |
579
+ | `"custom.domain.com/api"` | `https://custom.domain.com/api` |
580
+
581
+ **Important Notes:**
582
+ - Switching instances **clears all cached authentication tokens**
583
+ - Switching instances **clears the project cache**
584
+ - The next API call will automatically re-authenticate against the new instance
585
+ - You'll need to re-list projects after switching to see what's available on the new instance
586
+
587
+ **Example Workflow:**
588
+
589
+ ```
590
+ You: "Switch to prod"
591
+ Agent: ✅ Switched to prod instance
592
+
593
+ You: "List my projects"
594
+ Agent: *Authenticates to prod, lists projects*
595
+
596
+ You: "Show uninvestigated incidents"
597
+ Agent: *Uses the prod instance*
598
+
599
+ You: "Switch back to sandbox"
600
+ Agent: ✅ Switched to sandbox instance
601
+ ```
602
+
603
+ ---
604
+
532
605
  ### Working with Multiple Projects
533
606
 
534
607
  If you manage multiple Hawkeye projects:
@@ -363,13 +363,13 @@ function getSwitchInstanceTool() {
363
363
  return {
364
364
  tool: {
365
365
  name: 'hawkeye_switch_instance',
366
- description: 'Switch to a different Hawkeye instance by updating the base URL. Useful for users managing multiple Hawkeye environments (dev, staging, prod) or multiple customer instances. This clears authentication tokens and project cache.',
366
+ description: 'Switch to a different Hawkeye instance by updating the base URL. Useful for users managing multiple Hawkeye environments (dev, staging, prod) or multiple customer instances. Accepts flexible URL formats and automatically adds https:// and /api if needed. This clears authentication tokens and project cache.',
367
367
  inputSchema: {
368
368
  type: 'object',
369
369
  properties: {
370
370
  base_url: {
371
371
  type: 'string',
372
- description: 'The new Hawkeye API base URL to connect to (e.g., "https://prod.app.neubird.ai/api", "https://sandbox.app.neubird.ai/api"). Must include the /api path.',
372
+ description: 'The new Hawkeye instance to connect to. Accepts multiple formats: just subdomain ("prod", "customerA"), partial URL ("prod.app.neubird.ai"), or full URL ("https://prod.app.neubird.ai/api"). The tool will automatically format it correctly.',
373
373
  },
374
374
  },
375
375
  required: ['base_url'],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,gBAAgB;QAChB,mBAAmB,EAAE;QAErB,gBAAgB;QAChB,uBAAuB,EAAE;QACzB,0BAA0B,EAAE;QAC5B,4BAA4B,EAAE;QAE9B,iDAAiD;QACjD,mBAAmB,EAAE;QACrB,qBAAqB,EAAE;QACvB,oBAAoB,EAAE;QACtB,qBAAqB,EAAE;QACvB,qBAAqB,EAAE;QAEvB,sBAAsB;QACtB,qBAAqB,EAAE;KACxB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB;IAC1B,OAAO;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EAAE,iEAAiE;YAC9E,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,gBAAgB,EAAE;wBAChB,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,uCAAuC;wBACpD,OAAO,EAAE,KAAK;qBACf;iBACF;aACF;SACF;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;YAC3E,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YAExD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACpF,MAAM,kBAAkB,GAAG,QAAQ,CAAC,cAAc,CAAC,qBAAqB,EAAE,CAAC;YAE3E,OAAO;gBACL,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CA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AM,MAAM,CAAC,0BAA0B,CAAC,CAAC;YACvE,OAAO,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB;IAC5B,OAAO;QACL,IAAI,EAAE;YACJ,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,qTAAqT;YAClU,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,gPAAgP;qBAC9P;iBACF;gBACD,QAAQ,EAAE,CAAC,UAAU,CAAC;aACvB;SACF;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;YAChE,OAAO,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -9,22 +9,53 @@ import { z } from 'zod';
9
9
  * Input validation schema
10
10
  */
11
11
  const SwitchInstanceInputSchema = z.object({
12
- base_url: z.string().url().describe('The new Hawkeye API base URL (e.g., "https://prod.app.neubird.ai/api")'),
12
+ base_url: z.string().min(1).describe('The new Hawkeye instance identifier or URL. Can be: a subdomain like "prod" or "customerA", a partial URL like "prod.app.neubird.ai", or a full URL like "https://prod.app.neubird.ai/api"'),
13
13
  });
14
+ /**
15
+ * Normalize and format the base URL to ensure it has the correct format
16
+ * Handles various input formats:
17
+ * - "prod" → "https://prod.app.neubird.ai/api"
18
+ * - "customerA" → "https://customerA.app.neubird.ai/api"
19
+ * - "prod.app.neubird.ai" → "https://prod.app.neubird.ai/api"
20
+ * - "https://prod.app.neubird.ai" → "https://prod.app.neubird.ai/api"
21
+ * - "https://prod.app.neubird.ai/api" → "https://prod.app.neubird.ai/api" (no change)
22
+ * - "https://custom.domain.com/api" → "https://custom.domain.com/api" (custom domains preserved)
23
+ */
24
+ function normalizeBaseUrl(input) {
25
+ let url = input.trim();
26
+ // If it's just a subdomain like "prod" or "customerA", add the full domain
27
+ if (!url.includes('.') && !url.includes('://')) {
28
+ url = `${url}.app.neubird.ai`;
29
+ }
30
+ // Add https:// prefix if missing
31
+ if (!url.startsWith('http://') && !url.startsWith('https://')) {
32
+ url = `https://${url}`;
33
+ }
34
+ // Add /api suffix if missing
35
+ if (!url.endsWith('/api')) {
36
+ // Remove trailing slash if present
37
+ url = url.replace(/\/$/, '');
38
+ url = `${url}/api`;
39
+ }
40
+ return url;
41
+ }
14
42
  /**
15
43
  * Switch to a different Hawkeye instance
16
44
  */
17
45
  export async function switchInstance(services, args) {
18
46
  const input = SwitchInstanceInputSchema.parse(args);
19
- logger.info('Switching Hawkeye instance', {
20
- previousUrl: getCurrentBaseUrl(),
21
- newUrl: input.base_url,
22
- });
23
47
  try {
48
+ // Normalize the URL (handles partial URLs, adds https://, adds /api suffix)
49
+ const normalizedUrl = normalizeBaseUrl(input.base_url);
50
+ logger.info('Switching Hawkeye instance', {
51
+ previousUrl: getCurrentBaseUrl(),
52
+ inputUrl: input.base_url,
53
+ normalizedUrl: normalizedUrl,
54
+ });
24
55
  // Get previous URL for comparison
25
56
  const previousUrl = getCurrentBaseUrl();
26
57
  // Update the base URL in config
27
- const updatedConfig = setBaseUrl(input.base_url);
58
+ const updatedConfig = setBaseUrl(normalizedUrl);
28
59
  // Clear cached authentication tokens (different instance requires new auth)
29
60
  services.authService.clearTokenCache();
30
61
  // Clear project cache (different instance has different projects)
@@ -32,6 +63,8 @@ export async function switchInstance(services, args) {
32
63
  logger.info(`Successfully switched to new Hawkeye instance: ${input.base_url}`);
33
64
  return {
34
65
  success: true,
66
+ input_provided: input.base_url,
67
+ normalized_url: normalizedUrl,
35
68
  previous_url: previousUrl,
36
69
  new_url: updatedConfig.baseUrl,
37
70
  message: `Switched from ${previousUrl} to ${updatedConfig.baseUrl}. Authentication tokens cleared. You can now use Hawkeye tools with the new instance.`,
@@ -1 +1 @@
1
- {"version":3,"file":"switch-instance.js","sourceRoot":"","sources":["../../src/tools/switch-instance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC;CAC9G,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAsB,EACtB,IAAa;IAEb,MAAM,KAAK,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEpD,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;QACxC,WAAW,EAAE,iBAAiB,EAAE;QAChC,MAAM,EAAE,KAAK,CAAC,QAAQ;KACvB,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,kCAAkC;QAClC,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAExC,gCAAgC;QAChC,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAEjD,4EAA4E;QAC5E,QAAQ,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;QAEvC,kEAAkE;QAClE,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;QAErC,MAAM,CAAC,IAAI,CAAC,kDAAkD,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,WAAW;YACzB,OAAO,EAAE,aAAa,CAAC,OAAO;Y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c,EAAE,KAAK,CAAC,QAAQ;YAC9B,cAAc,EAAE,aAAa;YAC7B,YAAY,EAAE,WAAW;YACzB,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,OAAO,EAAE,iBAAiB,WAAW,OAAO,aAAa,CAAC,OAAO,uFAAuF;YACxJ,IAAI,EAAE,uEAAuE;SAC9E,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAEzD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC7D,WAAW,EAAE,iBAAiB,EAAE;YAChC,WAAW,EAAE;gBACX,4EAA4E;gBAC5E,uCAAuC;gBACvC,uCAAuC;aACxC;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hawkeye-mcp-server",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "MCP Server for Hawkeye automated incident investigation and root cause analysis",
5
5
  "private": false,
6
6
  "type": "module",