awslabs.eks-mcp-server 0.1.2__py3-none-any.whl → 0.1.3__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/__init__.py +9 -6
- awslabs/eks_mcp_server/__init__.py +9 -6
- awslabs/eks_mcp_server/aws_helper.py +9 -6
- awslabs/eks_mcp_server/cloudwatch_handler.py +75 -77
- awslabs/eks_mcp_server/cloudwatch_metrics_guidance_handler.py +141 -0
- awslabs/eks_mcp_server/consts.py +9 -6
- awslabs/eks_mcp_server/data/eks_cloudwatch_metrics_guidance.json +287 -0
- awslabs/eks_mcp_server/eks_kb_handler.py +9 -6
- awslabs/eks_mcp_server/eks_stack_handler.py +17 -7
- awslabs/eks_mcp_server/iam_handler.py +14 -6
- awslabs/eks_mcp_server/k8s_apis.py +13 -6
- awslabs/eks_mcp_server/k8s_client_cache.py +9 -6
- awslabs/eks_mcp_server/k8s_handler.py +20 -6
- awslabs/eks_mcp_server/logging_helper.py +9 -6
- awslabs/eks_mcp_server/models.py +24 -10
- awslabs/eks_mcp_server/scripts/update_eks_cloudwatch_metrics_guidance.py +280 -0
- awslabs/eks_mcp_server/server.py +16 -7
- {awslabs_eks_mcp_server-0.1.2.dist-info → awslabs_eks_mcp_server-0.1.3.dist-info}/METADATA +146 -15
- awslabs_eks_mcp_server-0.1.3.dist-info/RECORD +26 -0
- awslabs_eks_mcp_server-0.1.2.dist-info/RECORD +0 -23
- {awslabs_eks_mcp_server-0.1.2.dist-info → awslabs_eks_mcp_server-0.1.3.dist-info}/WHEEL +0 -0
- {awslabs_eks_mcp_server-0.1.2.dist-info → awslabs_eks_mcp_server-0.1.3.dist-info}/entry_points.txt +0 -0
- {awslabs_eks_mcp_server-0.1.2.dist-info → awslabs_eks_mcp_server-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {awslabs_eks_mcp_server-0.1.2.dist-info → awslabs_eks_mcp_server-0.1.3.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cluster": {
|
|
3
|
+
"metrics": [
|
|
4
|
+
{
|
|
5
|
+
"description": "The number of failed worker nodes in the cluster. A node is considered failed if it is suffering from any node conditions. For more information, see Conditions in the Kubernetes documentation.",
|
|
6
|
+
"dimensions": [
|
|
7
|
+
"ClusterName"
|
|
8
|
+
],
|
|
9
|
+
"name": "cluster_failed_node_count"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "The total number of worker nodes in the cluster.",
|
|
13
|
+
"dimensions": [
|
|
14
|
+
"ClusterName"
|
|
15
|
+
],
|
|
16
|
+
"name": "cluster_node_count"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"namespace": {
|
|
21
|
+
"metrics": [
|
|
22
|
+
{
|
|
23
|
+
"description": "The number of pods running per namespace in the resource that is specified by the dimensions that you're using.",
|
|
24
|
+
"dimensions": [
|
|
25
|
+
"Namespace,ClusterName",
|
|
26
|
+
"ClusterName"
|
|
27
|
+
],
|
|
28
|
+
"name": "namespace_number_of_running_pods"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"node": {
|
|
33
|
+
"metrics": [
|
|
34
|
+
{
|
|
35
|
+
"description": "The maximum number of CPU units that can be assigned to a single node in this cluster.",
|
|
36
|
+
"dimensions": [
|
|
37
|
+
"ClusterName"
|
|
38
|
+
],
|
|
39
|
+
"name": "node_cpu_limit"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"description": "The percentage of CPU units that are reserved for node components, such as kubelet, kube-proxy, and Docker.",
|
|
43
|
+
"dimensions": [
|
|
44
|
+
"NodeName,ClusterName,InstanceId",
|
|
45
|
+
"ClusterName"
|
|
46
|
+
],
|
|
47
|
+
"name": "node_cpu_reserved_capacity"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"description": "The number of CPU units being used on the nodes in the cluster.",
|
|
51
|
+
"dimensions": [
|
|
52
|
+
"ClusterName"
|
|
53
|
+
],
|
|
54
|
+
"name": "node_cpu_usage_total"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"description": "The total percentage of CPU units being used on the nodes in the cluster.",
|
|
58
|
+
"dimensions": [
|
|
59
|
+
"NodeName,ClusterName,InstanceId",
|
|
60
|
+
"ClusterName"
|
|
61
|
+
],
|
|
62
|
+
"name": "node_cpu_utilization"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"description": "The total number of GPU(s) available on the node.",
|
|
66
|
+
"dimensions": [
|
|
67
|
+
"ClusterName",
|
|
68
|
+
"ClusterName,InstanceId,NodeName"
|
|
69
|
+
],
|
|
70
|
+
"name": "node_gpu_limit"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"description": "The number of GPU(s) being used by the running pods on the node.",
|
|
74
|
+
"dimensions": [
|
|
75
|
+
"ClusterName",
|
|
76
|
+
"ClusterName,InstanceId,NodeName"
|
|
77
|
+
],
|
|
78
|
+
"name": "node_gpu_usage_total"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"description": "The percentage of GPU currently being reserved on the node. The formula is, node_gpu_request / node_gpu_limit.",
|
|
82
|
+
"dimensions": [
|
|
83
|
+
"ClusterName",
|
|
84
|
+
"ClusterName,InstanceId,NodeName"
|
|
85
|
+
],
|
|
86
|
+
"name": "node_gpu_reserved_capacity"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"description": "The total percentage of file system capacity being used on nodes in the cluster.",
|
|
90
|
+
"dimensions": [
|
|
91
|
+
"NodeName,ClusterName,InstanceId",
|
|
92
|
+
"ClusterName"
|
|
93
|
+
],
|
|
94
|
+
"name": "node_filesystem_utilization"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"description": "The maximum amount of memory, in bytes, that can be assigned to a single node in this cluster.",
|
|
98
|
+
"dimensions": [
|
|
99
|
+
"ClusterName"
|
|
100
|
+
],
|
|
101
|
+
"name": "node_memory_limit"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"description": "The percentage of memory currently being used on the nodes in the cluster.",
|
|
105
|
+
"dimensions": [
|
|
106
|
+
"NodeName,ClusterName,InstanceId",
|
|
107
|
+
"ClusterName"
|
|
108
|
+
],
|
|
109
|
+
"name": "node_memory_reserved_capacity"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"description": "The percentage of memory currently being used by the node or nodes. It is the percentage of node memory usage divided by the node memory limitation.",
|
|
113
|
+
"dimensions": [
|
|
114
|
+
"NodeName,ClusterName,InstanceId",
|
|
115
|
+
"ClusterName"
|
|
116
|
+
],
|
|
117
|
+
"name": "node_memory_utilization"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"description": "The amount of memory, in bytes, being used in the working set of the nodes in the cluster.",
|
|
121
|
+
"dimensions": [
|
|
122
|
+
"ClusterName"
|
|
123
|
+
],
|
|
124
|
+
"name": "node_memory_working_set"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"description": "The total number of bytes per second transmitted and received over the network per node in a cluster.",
|
|
128
|
+
"dimensions": [
|
|
129
|
+
"NodeName,ClusterName,InstanceId",
|
|
130
|
+
"ClusterName"
|
|
131
|
+
],
|
|
132
|
+
"name": "node_network_total_bytes"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"description": "The number of running containers per node in a cluster.",
|
|
136
|
+
"dimensions": [
|
|
137
|
+
"NodeName,ClusterName,InstanceId",
|
|
138
|
+
"ClusterName"
|
|
139
|
+
],
|
|
140
|
+
"name": "node_number_of_running_containers"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"description": "The number of running pods per node in a cluster.",
|
|
144
|
+
"dimensions": [
|
|
145
|
+
"NodeName,ClusterName,InstanceId",
|
|
146
|
+
"ClusterName"
|
|
147
|
+
],
|
|
148
|
+
"name": "node_number_of_running_pods"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"pod": {
|
|
153
|
+
"metrics": [
|
|
154
|
+
{
|
|
155
|
+
"description": "The CPU capacity that is reserved per pod in a cluster.",
|
|
156
|
+
"dimensions": [
|
|
157
|
+
"PodName,Namespace,ClusterName",
|
|
158
|
+
"ClusterName"
|
|
159
|
+
],
|
|
160
|
+
"name": "pod_cpu_reserved_capacity"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"description": "The percentage of CPU units being used by pods.",
|
|
164
|
+
"dimensions": [
|
|
165
|
+
"PodName,Namespace,ClusterName",
|
|
166
|
+
"Namespace,ClusterName",
|
|
167
|
+
"Service,Namespace,ClusterName",
|
|
168
|
+
"ClusterName"
|
|
169
|
+
],
|
|
170
|
+
"name": "pod_cpu_utilization"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"description": "The percentage of CPU units being used by pods relative to the pod limit.",
|
|
174
|
+
"dimensions": [
|
|
175
|
+
"PodName,Namespace,ClusterName",
|
|
176
|
+
"Namespace,ClusterName",
|
|
177
|
+
"Service,Namespace,ClusterName",
|
|
178
|
+
"ClusterName"
|
|
179
|
+
],
|
|
180
|
+
"name": "pod_cpu_utilization_over_pod_limit"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"description": "The GPU requests for the pod. This value must always be equal to pod_gpu_limit.",
|
|
184
|
+
"dimensions": [
|
|
185
|
+
"ClusterName",
|
|
186
|
+
"ClusterName,Namespace,PodName",
|
|
187
|
+
"ClusterName,FullPodName,Namespace,PodName"
|
|
188
|
+
],
|
|
189
|
+
"name": "pod_gpu_request"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"description": "The maximum number of GPU(s) that can be assigned to the pod in a node.",
|
|
193
|
+
"dimensions": [
|
|
194
|
+
"ClusterName",
|
|
195
|
+
"ClusterName,Namespace,PodName",
|
|
196
|
+
"ClusterName,FullPodName,Namespace,PodName"
|
|
197
|
+
],
|
|
198
|
+
"name": "pod_gpu_limit"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"description": "The number of GPU(s) being allocated on the pod.",
|
|
202
|
+
"dimensions": [
|
|
203
|
+
"ClusterName",
|
|
204
|
+
"ClusterName,Namespace,PodName",
|
|
205
|
+
"ClusterName,FullPodName,Namespace,PodName"
|
|
206
|
+
],
|
|
207
|
+
"name": "pod_gpu_usage_total"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"description": "The percentage of GPU currently being reserved for the pod. The formula is - pod_gpu_request / node_gpu_reserved_capacity.",
|
|
211
|
+
"dimensions": [
|
|
212
|
+
"ClusterName",
|
|
213
|
+
"ClusterName,Namespace,PodName",
|
|
214
|
+
"ClusterName,FullPodName,Namespace,PodName"
|
|
215
|
+
],
|
|
216
|
+
"name": "pod_gpu_reserved_capacity"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"description": "The percentage of memory that is reserved for pods.",
|
|
220
|
+
"dimensions": [
|
|
221
|
+
"PodName,Namespace,ClusterName",
|
|
222
|
+
"ClusterName"
|
|
223
|
+
],
|
|
224
|
+
"name": "pod_memory_reserved_capacity"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"description": "The percentage of memory currently being used by the pod or pods.",
|
|
228
|
+
"dimensions": [
|
|
229
|
+
"PodName,Namespace,ClusterName",
|
|
230
|
+
"Namespace,ClusterName",
|
|
231
|
+
"Service,Namespace,ClusterName",
|
|
232
|
+
"ClusterName"
|
|
233
|
+
],
|
|
234
|
+
"name": "pod_memory_utilization"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"description": "The percentage of memory that is being used by pods relative to the pod limit. If any containers in the pod don't have a memory limit defined, this metric doesn't appear.",
|
|
238
|
+
"dimensions": [
|
|
239
|
+
"PodName,Namespace,ClusterName",
|
|
240
|
+
"Namespace,ClusterName",
|
|
241
|
+
"Service,Namespace,ClusterName",
|
|
242
|
+
"ClusterName"
|
|
243
|
+
],
|
|
244
|
+
"name": "pod_memory_utilization_over_pod_limit"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"description": "The number of bytes per second being received over the network by the pod.",
|
|
248
|
+
"dimensions": [
|
|
249
|
+
"PodName,Namespace,ClusterName",
|
|
250
|
+
"Namespace,ClusterName",
|
|
251
|
+
"Service,Namespace,ClusterName",
|
|
252
|
+
"ClusterName"
|
|
253
|
+
],
|
|
254
|
+
"name": "pod_network_rx_bytes"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"description": "The number of bytes per second being transmitted over the network by the pod.",
|
|
258
|
+
"dimensions": [
|
|
259
|
+
"PodName,Namespace,ClusterName",
|
|
260
|
+
"Namespace,ClusterName",
|
|
261
|
+
"Service,Namespace,ClusterName",
|
|
262
|
+
"ClusterName"
|
|
263
|
+
],
|
|
264
|
+
"name": "pod_network_tx_bytes"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"description": "The total number of container restarts in a pod.",
|
|
268
|
+
"dimensions": [
|
|
269
|
+
"PodName,Namespace,ClusterName"
|
|
270
|
+
],
|
|
271
|
+
"name": "pod_number_of_container_restarts"
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
"service": {
|
|
276
|
+
"metrics": [
|
|
277
|
+
{
|
|
278
|
+
"description": "The number of pods running the service or services in the cluster.",
|
|
279
|
+
"dimensions": [
|
|
280
|
+
"Service,Namespace,ClusterName",
|
|
281
|
+
"ClusterName"
|
|
282
|
+
],
|
|
283
|
+
"name": "service_number_of_running_pods"
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Knowledge Base Retrival handler for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""EKS stack handler for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -135,6 +138,13 @@ class EksStackHandler:
|
|
|
135
138
|
mechanism for creating and managing EKS clusters through CloudFormation, enabling standardized
|
|
136
139
|
cluster creation, configuration updates, and resource cleanup.
|
|
137
140
|
|
|
141
|
+
IMPORTANT: Use this tool instead of 'aws eks create-cluster', 'aws eks delete-cluster',
|
|
142
|
+
'eksctl create cluster', 'eksctl delete cluster', or similar CLI commands.
|
|
143
|
+
|
|
144
|
+
IMPORTANT: Use this tool's standardized templates for creating EKS clusters with proper VPC configuration,
|
|
145
|
+
networking, security groups, and EKS auto mode. DO NOT create EKS clusters by generating CloudFormation
|
|
146
|
+
templates from scratch.
|
|
147
|
+
|
|
138
148
|
## Requirements
|
|
139
149
|
- The server must be run with the `--allow-write` flag for generate, deploy, and delete operations
|
|
140
150
|
- For deploy and delete operations, the stack must have been created by this tool
|
|
@@ -319,7 +329,7 @@ class EksStackHandler:
|
|
|
319
329
|
- Security groups for cluster communication
|
|
320
330
|
- IAM roles for the EKS cluster and worker nodes
|
|
321
331
|
- An EKS cluster in Auto Mode with:
|
|
322
|
-
- Compute configuration
|
|
332
|
+
- Compute configuration for automatic node management
|
|
323
333
|
- Kubernetes network configuration with elastic load balancing
|
|
324
334
|
- Block storage configuration
|
|
325
335
|
- API authentication mode
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""IAM handler for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -63,6 +66,9 @@ class IAMHandler:
|
|
|
63
66
|
permissions, identify missing or excessive permissions, troubleshoot EKS cluster issues,
|
|
64
67
|
and verify trust relationships for service roles.
|
|
65
68
|
|
|
69
|
+
IMPORTANT: Use this tool instead of 'aws iam get-role', 'aws iam list-attached-role-policies',
|
|
70
|
+
'aws iam list-role-policies', and 'aws iam get-role-policy' commands.
|
|
71
|
+
|
|
66
72
|
## Requirements
|
|
67
73
|
- The role must exist in your AWS account
|
|
68
74
|
- Valid AWS credentials with permissions to read IAM role information
|
|
@@ -156,6 +162,8 @@ class IAMHandler:
|
|
|
156
162
|
for granting EKS clusters access to AWS services, enabling worker nodes to access resources, and
|
|
157
163
|
configuring permissions for CloudWatch logging and ECR access.
|
|
158
164
|
|
|
165
|
+
IMPORTANT: Use this tool instead of 'aws iam put-role-policy' commands.
|
|
166
|
+
|
|
159
167
|
## Requirements
|
|
160
168
|
- The server must be run with the `--allow-write` flag
|
|
161
169
|
- The role must exist in your AWS account
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Kubernetes API client for the EKS MCP Server."""
|
|
13
16
|
|
|
14
17
|
import base64
|
|
15
18
|
import os
|
|
16
19
|
import tempfile
|
|
20
|
+
from awslabs.eks_mcp_server import __version__
|
|
17
21
|
from awslabs.eks_mcp_server.models import Operation
|
|
18
22
|
from loguru import logger
|
|
19
23
|
from typing import Any, Dict, List, Optional
|
|
@@ -72,6 +76,9 @@ class K8sApis:
|
|
|
72
76
|
# Create base API client
|
|
73
77
|
self.api_client = client.ApiClient(configuration)
|
|
74
78
|
|
|
79
|
+
# Set user-agent directly on the ApiClient
|
|
80
|
+
self.api_client.user_agent = f'awslabs/mcp/eks-mcp-server/{__version__}'
|
|
81
|
+
|
|
75
82
|
# Create dynamic client
|
|
76
83
|
self.dynamic_client = dynamic.DynamicClient(self.api_client)
|
|
77
84
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Kubernetes client cache for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Kubernetes handler for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -111,6 +114,8 @@ class K8sHandler:
|
|
|
111
114
|
and can create or update resources, useful for deploying applications, creating
|
|
112
115
|
Kubernetes resources, and applying complete application stacks.
|
|
113
116
|
|
|
117
|
+
IMPORTANT: Use this tool instead of 'kubectl apply -f' commands.
|
|
118
|
+
|
|
114
119
|
## Requirements
|
|
115
120
|
- The server must be run with the `--allow-write` flag
|
|
116
121
|
- The YAML file must exist and be accessible to the server
|
|
@@ -334,6 +339,9 @@ class K8sHandler:
|
|
|
334
339
|
custom resources, update specific fields, read detailed information, and delete
|
|
335
340
|
resources that are no longer needed.
|
|
336
341
|
|
|
342
|
+
IMPORTANT: Use this tool instead of 'kubectl create', 'kubectl edit', 'kubectl patch',
|
|
343
|
+
'kubectl delete', or 'kubectl get' commands.
|
|
344
|
+
|
|
337
345
|
## Requirements
|
|
338
346
|
- The server must be run with the `--allow-write` flag for mutating operations
|
|
339
347
|
- The server must be run with the `--allow-sensitive-data-access` flag for Secret resources
|
|
@@ -534,6 +542,8 @@ class K8sHandler:
|
|
|
534
542
|
for listing pods in a namespace, finding services with specific labels, or
|
|
535
543
|
checking resources in a specific state.
|
|
536
544
|
|
|
545
|
+
IMPORTANT: Use this tool instead of 'kubectl get' commands.
|
|
546
|
+
|
|
537
547
|
## Response Information
|
|
538
548
|
The response includes a summary of each resource with name, namespace, creation timestamp,
|
|
539
549
|
labels, and annotations.
|
|
@@ -875,6 +885,8 @@ class K8sHandler:
|
|
|
875
885
|
to filter by container, time range, and size. It's useful for debugging application
|
|
876
886
|
issues, monitoring behavior, investigating crashes, and verifying startup configuration.
|
|
877
887
|
|
|
888
|
+
IMPORTANT: Use this tool instead of 'kubectl logs' commands.
|
|
889
|
+
|
|
878
890
|
## Requirements
|
|
879
891
|
- The server must be run with the `--allow-sensitive-data-access` flag
|
|
880
892
|
- The pod must exist and be accessible in the specified namespace
|
|
@@ -1000,6 +1012,8 @@ class K8sHandler:
|
|
|
1000
1012
|
are useful for troubleshooting pod startup failures, investigating deployment issues,
|
|
1001
1013
|
understanding resource modifications, and diagnosing scheduling problems.
|
|
1002
1014
|
|
|
1015
|
+
IMPORTANT: Use this tool instead of 'kubectl describe' or 'kubectl get events' commands.
|
|
1016
|
+
|
|
1003
1017
|
## Requirements
|
|
1004
1018
|
- The server must be run with the `--allow-sensitive-data-access` flag
|
|
1005
1019
|
- The resource must exist and be accessible in the specified namespace
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Logging helper for the EKS MCP Server."""
|
|
13
16
|
|
awslabs/eks_mcp_server/models.py
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License")
|
|
4
|
-
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
11
14
|
|
|
12
15
|
"""Data models for the EKS MCP Server."""
|
|
13
16
|
|
|
@@ -150,7 +153,7 @@ class CloudWatchLogsResponse(CallToolResult):
|
|
|
150
153
|
"""
|
|
151
154
|
|
|
152
155
|
resource_type: str = Field(..., description='Resource type (pod, node, container)')
|
|
153
|
-
resource_name: str = Field(
|
|
156
|
+
resource_name: Optional[str] = Field(None, description='Resource name')
|
|
154
157
|
cluster_name: str = Field(..., description='Name of the EKS cluster')
|
|
155
158
|
log_type: str = Field(
|
|
156
159
|
..., description='Log type (application, host, performance, control-plane, or custom)'
|
|
@@ -178,11 +181,9 @@ class CloudWatchMetricsResponse(CallToolResult):
|
|
|
178
181
|
"""Response model for get_cloudwatch_metrics tool.
|
|
179
182
|
|
|
180
183
|
This model contains the response from a CloudWatch metrics query,
|
|
181
|
-
including
|
|
184
|
+
including metric details, time range, and data points.
|
|
182
185
|
"""
|
|
183
186
|
|
|
184
|
-
resource_type: str = Field(..., description='Resource type (pod, node, container, cluster)')
|
|
185
|
-
resource_name: str = Field(..., description='Resource name')
|
|
186
187
|
cluster_name: str = Field(..., description='Name of the EKS cluster')
|
|
187
188
|
metric_name: str = Field(..., description='Metric name (e.g., cpu_usage_total, memory_rss)')
|
|
188
189
|
namespace: str = Field(..., description='CloudWatch namespace (e.g., ContainerInsights)')
|
|
@@ -269,3 +270,16 @@ class AddInlinePolicyResponse(CallToolResult):
|
|
|
269
270
|
permissions_added: Union[Dict[str, Any], List[Dict[str, Any]]] = Field(
|
|
270
271
|
..., description='Permissions to include in the policy (in JSON format)'
|
|
271
272
|
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class MetricsGuidanceResponse(CallToolResult):
|
|
276
|
+
"""Response model for get_eks_metrics_guidance tool.
|
|
277
|
+
|
|
278
|
+
This model contains the response from a metrics guidance query,
|
|
279
|
+
including resource type and available metrics with their details.
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
resource_type: str = Field(
|
|
283
|
+
..., description='Resource type (cluster, node, pod, namespace, service)'
|
|
284
|
+
)
|
|
285
|
+
metrics: List[Dict[str, Any]] = Field(..., description='List of metrics with their details')
|