awslabs.eks-mcp-server 0.1.16__py3-none-any.whl → 0.1.17__py3-none-any.whl
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.
- awslabs/eks_mcp_server/__init__.py +1 -1
- awslabs/eks_mcp_server/cloudwatch_handler.py +42 -54
- awslabs/eks_mcp_server/cloudwatch_metrics_guidance_handler.py +15 -10
- awslabs/eks_mcp_server/eks_kb_handler.py +22 -4
- awslabs/eks_mcp_server/eks_stack_handler.py +97 -122
- awslabs/eks_mcp_server/iam_handler.py +36 -36
- awslabs/eks_mcp_server/insights_handler.py +29 -32
- awslabs/eks_mcp_server/k8s_handler.py +125 -145
- awslabs/eks_mcp_server/models.py +52 -62
- awslabs/eks_mcp_server/vpc_config_handler.py +18 -35
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/METADATA +2 -2
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/RECORD +16 -16
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/WHEEL +1 -1
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/entry_points.txt +0 -0
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/licenses/LICENSE +0 -0
- {awslabs_eks_mcp_server-0.1.16.dist-info → awslabs_eks_mcp_server-0.1.17.dist-info}/licenses/NOTICE +0 -0
|
@@ -14,16 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
"""Insights handler for the EKS MCP Server."""
|
|
16
16
|
|
|
17
|
+
import json
|
|
17
18
|
from awslabs.eks_mcp_server.aws_helper import AwsHelper
|
|
18
19
|
from awslabs.eks_mcp_server.logging_helper import LogLevel, log_with_request_id
|
|
19
20
|
from awslabs.eks_mcp_server.models import (
|
|
20
21
|
EksInsightItem,
|
|
21
|
-
|
|
22
|
+
EksInsightsData,
|
|
22
23
|
EksInsightStatus,
|
|
23
24
|
)
|
|
24
25
|
from datetime import datetime
|
|
25
26
|
from mcp.server.fastmcp import Context
|
|
26
|
-
from mcp.types import TextContent
|
|
27
|
+
from mcp.types import CallToolResult, TextContent
|
|
27
28
|
from pydantic import Field
|
|
28
29
|
from typing import Any, Optional
|
|
29
30
|
|
|
@@ -72,7 +73,7 @@ class InsightsHandler:
|
|
|
72
73
|
None,
|
|
73
74
|
description='Token for pagination to get the next set of results',
|
|
74
75
|
),
|
|
75
|
-
) ->
|
|
76
|
+
) -> CallToolResult:
|
|
76
77
|
"""Get EKS Insights for cluster configuration and upgrade readiness.
|
|
77
78
|
|
|
78
79
|
This tool retrieves Amazon EKS Insights that identify potential issues with
|
|
@@ -128,7 +129,7 @@ class InsightsHandler:
|
|
|
128
129
|
insight_id: Optional[str] = None,
|
|
129
130
|
category: Optional[str] = None,
|
|
130
131
|
next_token: Optional[str] = None,
|
|
131
|
-
) ->
|
|
132
|
+
) -> CallToolResult:
|
|
132
133
|
"""Internal implementation of get_eks_insights."""
|
|
133
134
|
try:
|
|
134
135
|
# Always use the default EKS client
|
|
@@ -151,13 +152,9 @@ class InsightsHandler:
|
|
|
151
152
|
except Exception as e:
|
|
152
153
|
error_message = f'Error processing EKS insights request: {str(e)}'
|
|
153
154
|
log_with_request_id(ctx, LogLevel.ERROR, error_message)
|
|
154
|
-
return
|
|
155
|
+
return CallToolResult(
|
|
155
156
|
isError=True,
|
|
156
157
|
content=[TextContent(type='text', text=error_message)],
|
|
157
|
-
cluster_name=cluster_name,
|
|
158
|
-
insights=[],
|
|
159
|
-
next_token=None,
|
|
160
|
-
detail_mode=(insight_id is not None),
|
|
161
158
|
)
|
|
162
159
|
|
|
163
160
|
async def _get_insight_detail(
|
|
@@ -167,7 +164,7 @@ class InsightsHandler:
|
|
|
167
164
|
cluster_name: str,
|
|
168
165
|
insight_id: str,
|
|
169
166
|
next_token: Optional[str] = None,
|
|
170
|
-
) ->
|
|
167
|
+
) -> CallToolResult:
|
|
171
168
|
"""Get details for a specific EKS insight."""
|
|
172
169
|
log_with_request_id(
|
|
173
170
|
ctx,
|
|
@@ -214,36 +211,34 @@ class InsightsHandler:
|
|
|
214
211
|
)
|
|
215
212
|
|
|
216
213
|
success_message = f'Successfully retrieved details for insight {insight_id}'
|
|
217
|
-
|
|
218
|
-
isError=False,
|
|
219
|
-
content=[TextContent(type='text', text=success_message)],
|
|
214
|
+
data = EksInsightsData(
|
|
220
215
|
cluster_name=cluster_name,
|
|
221
216
|
insights=[insight_item],
|
|
222
217
|
next_token=None, # No pagination for detail view
|
|
223
218
|
detail_mode=True,
|
|
224
219
|
)
|
|
220
|
+
|
|
221
|
+
return CallToolResult(
|
|
222
|
+
isError=False,
|
|
223
|
+
content=[
|
|
224
|
+
TextContent(type='text', text=success_message),
|
|
225
|
+
TextContent(type='text', text=json.dumps(data.model_dump())),
|
|
226
|
+
],
|
|
227
|
+
)
|
|
225
228
|
else:
|
|
226
229
|
error_message = f'No insight details found for ID {insight_id}'
|
|
227
230
|
log_with_request_id(ctx, LogLevel.WARNING, error_message)
|
|
228
|
-
return
|
|
231
|
+
return CallToolResult(
|
|
229
232
|
isError=True,
|
|
230
233
|
content=[TextContent(type='text', text=error_message)],
|
|
231
|
-
cluster_name=cluster_name,
|
|
232
|
-
insights=[],
|
|
233
|
-
next_token=None,
|
|
234
|
-
detail_mode=True,
|
|
235
234
|
)
|
|
236
235
|
|
|
237
236
|
except Exception as e:
|
|
238
237
|
error_message = f'Error retrieving insight details: {str(e)}'
|
|
239
238
|
log_with_request_id(ctx, LogLevel.ERROR, error_message)
|
|
240
|
-
return
|
|
239
|
+
return CallToolResult(
|
|
241
240
|
isError=True,
|
|
242
241
|
content=[TextContent(type='text', text=error_message)],
|
|
243
|
-
cluster_name=cluster_name,
|
|
244
|
-
insights=[],
|
|
245
|
-
next_token=None,
|
|
246
|
-
detail_mode=True,
|
|
247
242
|
)
|
|
248
243
|
|
|
249
244
|
async def _list_insights(
|
|
@@ -253,7 +248,7 @@ class InsightsHandler:
|
|
|
253
248
|
cluster_name: str,
|
|
254
249
|
category: Optional[str] = None,
|
|
255
250
|
next_token: Optional[str] = None,
|
|
256
|
-
) ->
|
|
251
|
+
) -> CallToolResult:
|
|
257
252
|
"""List EKS insights for a cluster with optional category filtering."""
|
|
258
253
|
log_with_request_id(ctx, LogLevel.INFO, f'Listing insights for cluster {cluster_name}')
|
|
259
254
|
|
|
@@ -320,23 +315,25 @@ class InsightsHandler:
|
|
|
320
315
|
success_message = (
|
|
321
316
|
f'Successfully retrieved {len(insight_items)} insights for cluster {cluster_name}'
|
|
322
317
|
)
|
|
323
|
-
|
|
324
|
-
isError=False,
|
|
325
|
-
content=[TextContent(type='text', text=success_message)],
|
|
318
|
+
data = EksInsightsData(
|
|
326
319
|
cluster_name=cluster_name,
|
|
327
320
|
insights=insight_items,
|
|
328
321
|
next_token=response.get('nextToken'),
|
|
329
322
|
detail_mode=False,
|
|
330
323
|
)
|
|
331
324
|
|
|
325
|
+
return CallToolResult(
|
|
326
|
+
isError=False,
|
|
327
|
+
content=[
|
|
328
|
+
TextContent(type='text', text=success_message),
|
|
329
|
+
TextContent(type='text', text=json.dumps(data.model_dump())),
|
|
330
|
+
],
|
|
331
|
+
)
|
|
332
|
+
|
|
332
333
|
except Exception as e:
|
|
333
334
|
error_message = f'Error listing insights: {str(e)}'
|
|
334
335
|
log_with_request_id(ctx, LogLevel.ERROR, error_message)
|
|
335
|
-
return
|
|
336
|
+
return CallToolResult(
|
|
336
337
|
isError=True,
|
|
337
338
|
content=[TextContent(type='text', text=error_message)],
|
|
338
|
-
cluster_name=cluster_name,
|
|
339
|
-
insights=[],
|
|
340
|
-
next_token=None,
|
|
341
|
-
detail_mode=False,
|
|
342
339
|
)
|