awslabs.eks-mcp-server 0.1.1__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 +13 -0
- awslabs/eks_mcp_server/__init__.py +14 -0
- awslabs/eks_mcp_server/aws_helper.py +71 -0
- awslabs/eks_mcp_server/cloudwatch_handler.py +670 -0
- awslabs/eks_mcp_server/consts.py +33 -0
- awslabs/eks_mcp_server/eks_kb_handler.py +86 -0
- awslabs/eks_mcp_server/eks_stack_handler.py +661 -0
- awslabs/eks_mcp_server/iam_handler.py +359 -0
- awslabs/eks_mcp_server/k8s_apis.py +506 -0
- awslabs/eks_mcp_server/k8s_client_cache.py +164 -0
- awslabs/eks_mcp_server/k8s_handler.py +1151 -0
- awslabs/eks_mcp_server/logging_helper.py +52 -0
- awslabs/eks_mcp_server/models.py +271 -0
- awslabs/eks_mcp_server/server.py +151 -0
- awslabs/eks_mcp_server/templates/eks-templates/eks-with-vpc.yaml +454 -0
- awslabs/eks_mcp_server/templates/k8s-templates/deployment.yaml +49 -0
- awslabs/eks_mcp_server/templates/k8s-templates/service.yaml +18 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/METADATA +596 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/RECORD +23 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/WHEEL +4 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/entry_points.txt +2 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/licenses/LICENSE +175 -0
- awslabs_eks_mcp_server-0.1.1.dist-info/licenses/NOTICE +2 -0
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: awslabs.eks-mcp-server
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: An AWS Labs Model Context Protocol (MCP) server for EKS
|
|
5
|
+
Project-URL: homepage, https://awslabs.github.io/mcp/
|
|
6
|
+
Project-URL: docs, https://awslabs.github.io/mcp/servers/eks-mcp-server/
|
|
7
|
+
Project-URL: documentation, https://awslabs.github.io/mcp/servers/eks-mcp-server/
|
|
8
|
+
Project-URL: repository, https://github.com/awslabs/mcp.git
|
|
9
|
+
Project-URL: changelog, https://github.com/awslabs/mcp/blob/main/src/eks-mcp-server/CHANGELOG.md
|
|
10
|
+
Author: Amazon Web Services
|
|
11
|
+
Author-email: AWSLabs MCP <203918161+awslabs-mcp@users.noreply.github.com>, Amazon Web Services <githubusername@users.noreply.github.com>
|
|
12
|
+
License: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: boto3>=1.34.0
|
|
25
|
+
Requires-Dist: cachetools>=5.3.0
|
|
26
|
+
Requires-Dist: kubernetes>=28.1.0
|
|
27
|
+
Requires-Dist: loguru>=0.7.0
|
|
28
|
+
Requires-Dist: mcp[cli]>=1.6.0
|
|
29
|
+
Requires-Dist: pydantic>=2.10.6
|
|
30
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
31
|
+
Requires-Dist: requests-auth-aws-sigv4
|
|
32
|
+
Requires-Dist: requests>=2.31.0
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Amazon EKS MCP Server
|
|
36
|
+
|
|
37
|
+
The Amazon EKS MCP server provides AI code assistants with resource management tools and real-time cluster state visibility. This provides large language models (LLMs) with essential tooling and contextual awareness, enabling AI code assistants to streamline application development through tailored guidance — from initial setup through production optimization and troubleshooting.
|
|
38
|
+
|
|
39
|
+
Integrating the EKS MCP server into AI code assistants enhances development workflow across all phases, from simplifying initial cluster setup with automated prerequisite creation and application of best practices. Further, it streamlines application deployment with high-level workflows and automated code generation. Finally, it accelerates troubleshooting through intelligent debugging tools and knowledge base access. All of this simplifies complex operations through natural language interactions in AI code assistants.
|
|
40
|
+
|
|
41
|
+
## Key features
|
|
42
|
+
|
|
43
|
+
* Enables users of AI code assistants to create new EKS clusters, complete with prerequisites such as dedicated VPCs, networking, and EKS Auto Mode node pools, by translating requests into the appropriate AWS CloudFormation actions.
|
|
44
|
+
* Provides the ability to deploy containerized applications by applying existing Kubernetes YAML files or by generating new deployment and service manifests based on user-provided parameters.
|
|
45
|
+
* Supports full lifecycle management of individual Kubernetes resources (such as Pods, Services, and Deployments) within EKS clusters, enabling create, read, update, patch, and delete operations.
|
|
46
|
+
* Provides the ability to list Kubernetes resources with filtering by namespace, labels, and fields, simplifying the process for both users and LLMs to gather information about the state of Kubernetes applications and EKS infrastructure.
|
|
47
|
+
* Facilitates operational tasks such as retrieving logs from specific pods and containers or fetching Kubernetes events related to particular resources, supporting troubleshooting and monitoring for both direct users and AI-driven workflows.
|
|
48
|
+
* Enables users to troubleshoot issues with an EKS cluster.
|
|
49
|
+
|
|
50
|
+
## Prerequisites
|
|
51
|
+
|
|
52
|
+
* [Install Python 3.10+](https://www.python.org/downloads/release/python-3100/)
|
|
53
|
+
* [Install the `uv` package manager](https://docs.astral.sh/uv/getting-started/installation/)
|
|
54
|
+
* [Install and configure the AWS CLI with credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
|
|
55
|
+
|
|
56
|
+
## Setup
|
|
57
|
+
|
|
58
|
+
Add these IAM policies to the IAM role or user that you use to manage your EKS cluster resources.
|
|
59
|
+
|
|
60
|
+
### Read-Only Operations Policy
|
|
61
|
+
|
|
62
|
+
For read operations, the following permissions are required:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
{
|
|
66
|
+
"Version": "2012-10-17",
|
|
67
|
+
"Statement": [
|
|
68
|
+
{
|
|
69
|
+
"Effect": "Allow",
|
|
70
|
+
"Action": [
|
|
71
|
+
"eks:DescribeCluster",
|
|
72
|
+
"cloudformation:DescribeStacks",
|
|
73
|
+
"cloudwatch:GetMetricData",
|
|
74
|
+
"logs:StartQuery",
|
|
75
|
+
"logs:GetQueryResults",
|
|
76
|
+
"iam:GetRole",
|
|
77
|
+
"iam:GetRolePolicy",
|
|
78
|
+
"iam:ListRolePolicies",
|
|
79
|
+
"iam:ListAttachedRolePolicies",
|
|
80
|
+
"iam:GetPolicy",
|
|
81
|
+
"iam:GetPolicyVersion",
|
|
82
|
+
"eks-mcpserver:QueryKnowledgeBase"
|
|
83
|
+
],
|
|
84
|
+
"Resource": "*"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Write Operations Policy
|
|
91
|
+
|
|
92
|
+
For write operations, the following permissions are required:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
{
|
|
96
|
+
"Version": "2012-10-17",
|
|
97
|
+
"Statement": [
|
|
98
|
+
{
|
|
99
|
+
"Effect": "Allow",
|
|
100
|
+
"Action": [
|
|
101
|
+
"cloudformation:CreateStack",
|
|
102
|
+
"cloudformation:UpdateStack",
|
|
103
|
+
"cloudformation:DeleteStack",
|
|
104
|
+
"iam:PutRolePolicy"
|
|
105
|
+
],
|
|
106
|
+
"Resource": "*",
|
|
107
|
+
"Condition": {
|
|
108
|
+
"StringEquals": {
|
|
109
|
+
"aws:RequestTag/CreatedBy": "EksMcpServer"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Quickstart
|
|
118
|
+
|
|
119
|
+
This quickstart guide walks you through the steps to configure the Amazon EKS MCP Server for use with both the [Cursor](https://www.cursor.com/en/downloads) IDE and the [Amazon Q Developer CLI](https://github.com/aws/amazon-q-developer-cli). By following these steps, you'll setup your development environment to leverage the EKS MCP Server's tools for managing your Amazon EKS clusters and Kubernetes resources.
|
|
120
|
+
|
|
121
|
+
**Set up Cursor**
|
|
122
|
+
|
|
123
|
+
1. Open Cursor.
|
|
124
|
+
2. Click the gear icon (⚙️) in the top right to open the settings panel, click **MCP**, **Add new global MCP server**.
|
|
125
|
+
3. Paste your MCP server definition. For example, this example shows how to configure the EKS MCP Server, including enabling mutating actions by adding the `--allow-write` flag to the server arguments:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
{
|
|
129
|
+
"mcpServers": {
|
|
130
|
+
"awslabs.eks-mcp-server": {
|
|
131
|
+
"autoApprove": [],
|
|
132
|
+
"disabled": false,
|
|
133
|
+
"command": "uvx",
|
|
134
|
+
"args": [
|
|
135
|
+
"awslabs.eks-mcp-server@latest",
|
|
136
|
+
"--allow-write"
|
|
137
|
+
],
|
|
138
|
+
"env": {
|
|
139
|
+
"FASTMCP_LOG_LEVEL": "ERROR"
|
|
140
|
+
},
|
|
141
|
+
"transportType": "stdio"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
After a few minutes, you should see a green indicator if your MCP server definition is valid.
|
|
148
|
+
|
|
149
|
+
4. Open a chat panel in Cursor (e.g., `Ctrl/⌘ + L`). In your Cursor chat window, enter your prompt. For example, "Create a new EKS cluster named 'my-test-cluster' in the 'us-west-2' region using Kubernetes version 1.31."
|
|
150
|
+
|
|
151
|
+
**Set up the Amazon Q Developer CLI**
|
|
152
|
+
|
|
153
|
+
1. Install the [Amazon Q Developer CLI](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html) .
|
|
154
|
+
2. The Q Developer CLI supports MCP servers for tools and prompts out-of-the-box. Edit your Q developer CLI's MCP configuration file named mcp.json following [these instructions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html). For example:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
{
|
|
158
|
+
"mcpServers": {
|
|
159
|
+
"awslabs.eks-mcp-server": {
|
|
160
|
+
"command": "uvx",
|
|
161
|
+
"args": ["awslabs.eks-mcp-server@latest"],
|
|
162
|
+
"env": {
|
|
163
|
+
"FASTMCP_LOG_LEVEL": "ERROR"
|
|
164
|
+
},
|
|
165
|
+
"autoApprove": [],
|
|
166
|
+
"disabled": false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
3. Verify your setup by running the `/tools` command in the Q Developer CLI to see the available EKS MCP tools.
|
|
173
|
+
|
|
174
|
+
Note that this is a basic quickstart. You can enable additional capabilities, such as [running MCP servers in containers](https://github.com/awslabs/mcp?tab=readme-ov-file#running-mcp-servers-in-containers) or combining more MCP servers like the [AWS Documentation MCP Server](https://awslabs.github.io/mcp/servers/aws-documentation-mcp-server/) into a single MCP server definition. To view an example, see the [Installation and Setup](https://github.com/awslabs/mcp?tab=readme-ov-file#installation-and-setup) guide in AWS MCP Servers on GitHub. To view a real-world implementation with application code in context with an MCP server, see the [Server Developer](https://modelcontextprotocol.io/quickstart/server) guide in Anthropic documentation.
|
|
175
|
+
|
|
176
|
+
## Configurations
|
|
177
|
+
|
|
178
|
+
### Arguments
|
|
179
|
+
|
|
180
|
+
The `args` field in the MCP server definition specifies the command-line arguments passed to the server when it starts. These arguments control how the server is executed and configured. For example:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"awslabs.eks-mcp-server": {
|
|
186
|
+
"command": "uvx",
|
|
187
|
+
"args": [
|
|
188
|
+
"awslabs.eks-mcp-server@latest",
|
|
189
|
+
"--allow-write",
|
|
190
|
+
"--allow-sensitive-data-access"
|
|
191
|
+
],
|
|
192
|
+
"env": {
|
|
193
|
+
"AWS_PROFILE": "your-profile",
|
|
194
|
+
"AWS_REGION": "us-east-1"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### `awslabs.eks-mcp-server@latest` (required)
|
|
202
|
+
|
|
203
|
+
Specifies the latest package/version specifier for the MCP client config.
|
|
204
|
+
|
|
205
|
+
* Enables MCP server startup and tool registration.
|
|
206
|
+
|
|
207
|
+
#### `--allow-write` (optional)
|
|
208
|
+
|
|
209
|
+
Enables write access mode, which allows mutating operations (e.g., create, update, delete resources) for apply_yaml, generate_app_manifest, manage_k8s_resource, manage_eks_stacks, add_inline_policy tool operations.
|
|
210
|
+
|
|
211
|
+
* Default: false (The server runs in read-only mode by default)
|
|
212
|
+
* Example: Add `--allow-write` to the `args` list in your MCP server definition.
|
|
213
|
+
|
|
214
|
+
#### `--allow-sensitive-data-access` (optional)
|
|
215
|
+
|
|
216
|
+
Enables access to sensitive data such as logs, events, and Kubernetes Secrets.
|
|
217
|
+
|
|
218
|
+
* Default: false (Access to sensitive data is restricted by default)
|
|
219
|
+
* Example: Add `--allow-sensitive-data-access` to the `args` list in your MCP server definition.
|
|
220
|
+
|
|
221
|
+
### Environment variables
|
|
222
|
+
|
|
223
|
+
The `env` field in the MCP server definition allows you to configure environment variables that control the behavior of the EKS MCP server. For example:
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
{
|
|
227
|
+
"mcpServers": {
|
|
228
|
+
"awslabs.eks-mcp-server": {
|
|
229
|
+
"env": {
|
|
230
|
+
"FASTMCP_LOG_LEVEL": "ERROR",
|
|
231
|
+
"AWS_PROFILE": "my-profile",
|
|
232
|
+
"AWS_REGION": "us-west-2"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### `FASTMCP_LOG_LEVEL` (optional)
|
|
240
|
+
|
|
241
|
+
Sets the logging level verbosity for the server.
|
|
242
|
+
|
|
243
|
+
* Valid values: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
|
|
244
|
+
* Default: "WARNING"
|
|
245
|
+
* Example: `"FASTMCP_LOG_LEVEL": "ERROR"`
|
|
246
|
+
|
|
247
|
+
#### `AWS_PROFILE` (optional)
|
|
248
|
+
|
|
249
|
+
Specifies the AWS profile to use for authentication.
|
|
250
|
+
|
|
251
|
+
* Default: None (If not set, uses default AWS credentials).
|
|
252
|
+
* Example: `"AWS_PROFILE": "my-profile"`
|
|
253
|
+
|
|
254
|
+
#### `AWS_REGION` (optional)
|
|
255
|
+
|
|
256
|
+
Specifies the AWS region where EKS clusters are managed, which will be used for all AWS service operations.
|
|
257
|
+
|
|
258
|
+
* Default: None (If not set, uses default AWS region).
|
|
259
|
+
* Example: `"AWS_REGION": "us-west-2"`
|
|
260
|
+
|
|
261
|
+
## Tools
|
|
262
|
+
|
|
263
|
+
The following tools are provided by the EKS MCP server for managing Amazon EKS clusters and Kubernetes resources. Each tool performs a specific action that can be invoked to automate common tasks in your EKS clusters and Kubernetes workloads.
|
|
264
|
+
|
|
265
|
+
### EKS Cluster Management
|
|
266
|
+
|
|
267
|
+
#### `manage_eks_stacks`
|
|
268
|
+
|
|
269
|
+
Manages EKS CloudFormation stacks with operations for generating templates, deploying, describing, and deleting EKS clusters and their underlying infrastructure. **Note**: Cluster creation typically takes 15-20 minutes to complete.
|
|
270
|
+
|
|
271
|
+
Features:
|
|
272
|
+
|
|
273
|
+
* Generates CloudFormation templates for EKS clusters, embedding specified cluster names.
|
|
274
|
+
* Deploys EKS clusters using CloudFormation, creating or updating stacks with VPC, subnets, NAT gateways, IAM roles, and node pools.
|
|
275
|
+
* Describes existing EKS CloudFormation stacks, providing details like status, outputs, and creation time.
|
|
276
|
+
* Deletes EKS CloudFormation stacks and their associated resources, ensuring proper cleanup.
|
|
277
|
+
* Ensures safety by only modifying/deleting stacks that were originally created by this tool.
|
|
278
|
+
|
|
279
|
+
Parameters:
|
|
280
|
+
|
|
281
|
+
* operation (generate, deploy, describe, delete), template_file (for generate/deploy), cluster_name
|
|
282
|
+
|
|
283
|
+
### Kubernetes Resource Management
|
|
284
|
+
|
|
285
|
+
#### `manage_k8s_resource`
|
|
286
|
+
|
|
287
|
+
Manages individual Kubernetes resources with various operations.
|
|
288
|
+
|
|
289
|
+
Features:
|
|
290
|
+
|
|
291
|
+
* Supports create, replace, patch, delete, and read Kubernetes operations.
|
|
292
|
+
* Handles both namespaced and non-namespaced Kubernetes resources.
|
|
293
|
+
|
|
294
|
+
Parameters:
|
|
295
|
+
|
|
296
|
+
* operation (create, replace, patch, delete, read), cluster_name, kind, api_version, name, namespace (optional), body (for create/replace/patch)
|
|
297
|
+
|
|
298
|
+
#### `apply_yaml`
|
|
299
|
+
|
|
300
|
+
Applies Kubernetes YAML manifests to an EKS cluster.
|
|
301
|
+
|
|
302
|
+
Features:
|
|
303
|
+
|
|
304
|
+
* Supports multi-document YAML files.
|
|
305
|
+
* Applies all resources in the manifest to the specified namespace.
|
|
306
|
+
* Can update existing resources if force is true.
|
|
307
|
+
|
|
308
|
+
Parameters:
|
|
309
|
+
|
|
310
|
+
* yaml_path, cluster_name, namespace, force
|
|
311
|
+
|
|
312
|
+
#### `list_k8s_resources`
|
|
313
|
+
|
|
314
|
+
Lists Kubernetes resources of a specific kind in an EKS cluster.
|
|
315
|
+
|
|
316
|
+
Features:
|
|
317
|
+
|
|
318
|
+
* Returns summaries of EKS resources with metadata.
|
|
319
|
+
* Supports filtering by EKS cluster namespace, labels, and fields.
|
|
320
|
+
|
|
321
|
+
Parameters:
|
|
322
|
+
|
|
323
|
+
* cluster_name, kind, api_version, namespace (optional), label_selector (optional), field_selector (optional)
|
|
324
|
+
|
|
325
|
+
#### `list_api_versions`
|
|
326
|
+
|
|
327
|
+
Lists all available API versions in the specified Kubernetes cluster.
|
|
328
|
+
|
|
329
|
+
Features:
|
|
330
|
+
|
|
331
|
+
* Discovers all available API versions on the Kubernetes cluster.
|
|
332
|
+
* Helps determine the correct `apiVersion` to use for managing Kubernetes resources.
|
|
333
|
+
* Includes both core APIs (e.g., "v1") and API groups (e.g., "apps/v1", "networking.k8s.io/v1").
|
|
334
|
+
|
|
335
|
+
Parameters:
|
|
336
|
+
|
|
337
|
+
* cluster_name
|
|
338
|
+
|
|
339
|
+
### Application Support
|
|
340
|
+
|
|
341
|
+
#### `generate_app_manifest`
|
|
342
|
+
|
|
343
|
+
Generates Kubernetes manifests for application deployment.
|
|
344
|
+
|
|
345
|
+
Features:
|
|
346
|
+
|
|
347
|
+
* Generates Kubernetes deployment and service YAMLs with configurable parameters.
|
|
348
|
+
* Supports load balancer configuration and resource requests.
|
|
349
|
+
* Outputs Kubernetes manifest to a specified directory.
|
|
350
|
+
|
|
351
|
+
Parameters:
|
|
352
|
+
|
|
353
|
+
* app_name, image_uri, output_dir, port (optional), replicas (optional), cpu (optional), memory (optional), namespace (optional), load_balancer_scheme (optional)
|
|
354
|
+
|
|
355
|
+
#### `get_pod_logs`
|
|
356
|
+
|
|
357
|
+
Retrieves logs from pods in a Kubernetes cluster.
|
|
358
|
+
|
|
359
|
+
Features:
|
|
360
|
+
|
|
361
|
+
* Supports filtering logs by time, line count, and byte size.
|
|
362
|
+
* Can retrieve logs from specific containers in a pod.
|
|
363
|
+
* Requires `--allow-sensitive-data-access` server flag to be enabled.
|
|
364
|
+
|
|
365
|
+
Parameters:
|
|
366
|
+
|
|
367
|
+
* cluster_name, pod_name, namespace, container_name (optional), since_seconds (optional), tail_lines (optional), limit_bytes (optional)
|
|
368
|
+
|
|
369
|
+
#### `get_k8s_events`
|
|
370
|
+
|
|
371
|
+
Retrieves events related to specific Kubernetes resources.
|
|
372
|
+
|
|
373
|
+
Features:
|
|
374
|
+
|
|
375
|
+
* Returns Kubernetes event details including timestamps, count, message, reason, reporting component, and type.
|
|
376
|
+
* Supports both namespaced and non-namespaced Kubernetes resources.
|
|
377
|
+
* Requires `--allow-sensitive-data-access` server flag to be enabled.
|
|
378
|
+
|
|
379
|
+
Parameters:
|
|
380
|
+
|
|
381
|
+
* cluster_name, kind, name, namespace (optional)
|
|
382
|
+
|
|
383
|
+
### CloudWatch Integration
|
|
384
|
+
|
|
385
|
+
#### `get_cloudwatch_logs`
|
|
386
|
+
|
|
387
|
+
Retrieves logs from CloudWatch for a specific resource within an EKS cluster.
|
|
388
|
+
|
|
389
|
+
Features:
|
|
390
|
+
|
|
391
|
+
* Fetches logs based on resource type (pod, node, container), resource name, and log type.
|
|
392
|
+
* Allows filtering by time range (minutes, start/end time), log content (filter_pattern), and number of entries.
|
|
393
|
+
* Supports specifying custom fields to be included in the query results.
|
|
394
|
+
* Requires `--allow-sensitive-data-access` server flag to be enabled.
|
|
395
|
+
|
|
396
|
+
Parameters:
|
|
397
|
+
|
|
398
|
+
* cluster_name, log_type (application, host, performance, control-plane, custom), resource_type (pod, node, container, cluster),
|
|
399
|
+
resource_name, minutes (optional), start_time (optional), end_time (optional), limit (optional), filter_pattern (optional), fields (optional)
|
|
400
|
+
|
|
401
|
+
#### `get_cloudwatch_metrics`
|
|
402
|
+
|
|
403
|
+
Retrieves metrics from CloudWatch for a specific EKS cluster resource.
|
|
404
|
+
|
|
405
|
+
Features:
|
|
406
|
+
|
|
407
|
+
* Fetches metrics based on resource type (pod, node, container, cluster), resource name, and metric name.
|
|
408
|
+
* Allows specification of CloudWatch namespace, Kubernetes namespace, and time range.
|
|
409
|
+
* Configurable period, statistic (Average, Sum, etc.), and limit for data points.
|
|
410
|
+
* Supports providing custom dimensions for fine-grained metric querying.
|
|
411
|
+
|
|
412
|
+
Parameters:
|
|
413
|
+
|
|
414
|
+
* cluster_name, metric_name, resource_type (pod, node, container, cluster), resource_name, namespace (optional), k8s_namespace
|
|
415
|
+
(optional), minutes (optional), start_time (optional), end_time (optional), limit (optional), stat (optional), period (optional), custom_dimensions
|
|
416
|
+
(optional)
|
|
417
|
+
|
|
418
|
+
### IAM Integration
|
|
419
|
+
|
|
420
|
+
#### `get_policies_for_role`
|
|
421
|
+
|
|
422
|
+
Retrieves all policies attached to a specified IAM role, including assume role policy, managed policies, and inline policies.
|
|
423
|
+
|
|
424
|
+
Features:
|
|
425
|
+
|
|
426
|
+
* Fetches the assume role policy document for the specified IAM role.
|
|
427
|
+
* Lists all attached managed policies and includes their policy documents.
|
|
428
|
+
* Lists all embedded inline policies and includes their policy documents.
|
|
429
|
+
|
|
430
|
+
Parameters:
|
|
431
|
+
|
|
432
|
+
* role_name
|
|
433
|
+
|
|
434
|
+
#### `add_inline_policy`
|
|
435
|
+
|
|
436
|
+
Adds a new inline policy with specified permissions to an IAM role; it will not modify existing policies. It will only create new policies; it will reject requests to modify existing policies.
|
|
437
|
+
|
|
438
|
+
Features:
|
|
439
|
+
|
|
440
|
+
* Creates and attaches a new inline policy to a specified IAM role.
|
|
441
|
+
* Rejects requests if the policy name already exists on the role to prevent accidental modification.
|
|
442
|
+
* Requires `--allow-write` server flag to be enabled.
|
|
443
|
+
* Accepts permissions as a single JSON object (statement) or a list of JSON objects (statements).
|
|
444
|
+
|
|
445
|
+
Parameters:
|
|
446
|
+
|
|
447
|
+
* policy_name, role_name, permissions (JSON object or array of objects)
|
|
448
|
+
|
|
449
|
+
### Troubleshooting
|
|
450
|
+
|
|
451
|
+
#### `search_eks_troubleshoot_guide`
|
|
452
|
+
|
|
453
|
+
Searches the EKS Troubleshoot Guide for troubleshooting information based on a query.
|
|
454
|
+
|
|
455
|
+
Features:
|
|
456
|
+
|
|
457
|
+
* Provides detailed troubleshooting guidance for Amazon EKS issues.
|
|
458
|
+
* Covers EKS Auto mode node provisioning, bootstrap issues, and controller failure modes.
|
|
459
|
+
* Returns symptoms, step-by-step short-term, and long-term fixes for identified issues.
|
|
460
|
+
|
|
461
|
+
Parameters:
|
|
462
|
+
|
|
463
|
+
* query
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
## Security & permissions
|
|
467
|
+
|
|
468
|
+
### Features
|
|
469
|
+
|
|
470
|
+
The EKS MCP Server implements the following security features:
|
|
471
|
+
|
|
472
|
+
1. **AWS Authentication**: Uses AWS credentials from the environment for secure authentication.
|
|
473
|
+
2. **Kubernetes Authentication**: Generates temporary credentials for Kubernetes API access.
|
|
474
|
+
3. **SSL Verification**: Enforces SSL verification for all Kubernetes API calls.
|
|
475
|
+
4. **Resource Tagging**: Tags all created resources for traceability.
|
|
476
|
+
5. **Least Privilege**: Uses IAM roles with appropriate permissions for CloudFormation templates.
|
|
477
|
+
6. **Stack Protection**: Ensures CloudFormation stacks can only be modified by the tool that created them.
|
|
478
|
+
7. **Client Caching**: Caches Kubernetes clients with TTL-based expiration for security and performance.
|
|
479
|
+
|
|
480
|
+
### Considerations
|
|
481
|
+
|
|
482
|
+
When using the EKS MCP Server, consider the following:
|
|
483
|
+
|
|
484
|
+
* **AWS Credentials**: The server needs permission to create and manage EKS resources.
|
|
485
|
+
* **Kubernetes Access**: The server generates temporary credentials for Kubernetes API access.
|
|
486
|
+
* **Network Security**: Configure VPC and security groups properly for EKS clusters.
|
|
487
|
+
* **Authentication**: Use appropriate authentication mechanisms for Kubernetes resources.
|
|
488
|
+
* **Authorization**: Configure RBAC properly for Kubernetes resources.
|
|
489
|
+
* **Data Protection**: Encrypt sensitive data in Kubernetes secrets.
|
|
490
|
+
* **Logging and Monitoring**: Enable logging and monitoring for EKS clusters.
|
|
491
|
+
|
|
492
|
+
### Permissions
|
|
493
|
+
|
|
494
|
+
The EKS MCP Server can be used for production environments with proper security controls in place. The server runs in read-only mode by default, which is recommended and considered generally safer for production environments. Only explicitly enable write access when necessary. Below are the EKS MCP server tools available in read-only versus write-access mode:
|
|
495
|
+
|
|
496
|
+
* **Read-only mode (default)**: `manage_eks_stacks` (with operation="describe"), `manage_k8s_resource` (with operation="read"), `list_k8s_resources`, `get_pod_logs`, `get_k8s_events`, `get_cloudwatch_logs`, `get_cloudwatch_metrics`, `get_policies_for_role`, `search_eks_troubleshoot_guide`, `list_api_versions`.
|
|
497
|
+
* **Write-access mode**: (require `--allow-write`): `manage_eks_stacks` (with "generate", "deploy", "delete"), `manage_k8s_resource` (with "create", "replace", "patch", "delete"), `apply_yaml`, `generate_app_manifest`, `add_inline_policy`.
|
|
498
|
+
|
|
499
|
+
#### `autoApprove` (optional)
|
|
500
|
+
|
|
501
|
+
An array within the MCP server definition that lists tool names to be automatically approved by the EKS MCP Server client, bypassing user confirmation for those specific tools. For example:
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
{
|
|
505
|
+
"mcpServers": {
|
|
506
|
+
"awslabs.eks-mcp-server": {
|
|
507
|
+
"command": "uvx",
|
|
508
|
+
"args": [
|
|
509
|
+
"awslabs.eks-mcp-server@latest"
|
|
510
|
+
],
|
|
511
|
+
"env": {
|
|
512
|
+
"AWS_PROFILE": "eks-mcp-readonly-profile",
|
|
513
|
+
"AWS_REGION": "us-east-1",
|
|
514
|
+
"FASTMCP_LOG_LEVEL": "INFO"
|
|
515
|
+
},
|
|
516
|
+
"autoApprove": [
|
|
517
|
+
"manage_eks_stacks",
|
|
518
|
+
"manage_k8s_resource",
|
|
519
|
+
"list_k8s_resources",
|
|
520
|
+
"get_pod_logs",
|
|
521
|
+
"get_k8s_events",
|
|
522
|
+
"get_cloudwatch_logs",
|
|
523
|
+
"get_cloudwatch_metrics",
|
|
524
|
+
"get_policies_for_role",
|
|
525
|
+
"search_eks_troubleshoot_guide",
|
|
526
|
+
"list_api_versions"
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### IAM Permissions Management
|
|
534
|
+
|
|
535
|
+
When the `--allow-write` flag is enabled, the EKS MCP Server can create missing IAM permissions for EKS resources through the `add_inline_policy` tool. This tool enables the following:
|
|
536
|
+
|
|
537
|
+
* Only creates new inline policies; it never modifies existing policies.
|
|
538
|
+
* Is useful for automatically fixing common permissions issues with EKS clusters.
|
|
539
|
+
* Should be used with caution and with properly scoped IAM roles.
|
|
540
|
+
|
|
541
|
+
### Role Scoping Recommendations
|
|
542
|
+
|
|
543
|
+
In accordance with security best practices, we recommend the following:
|
|
544
|
+
|
|
545
|
+
1. **Create dedicated IAM roles** to be used by the EKS MCP Server with the principle of "least privilege."
|
|
546
|
+
2. **Use separate roles** for read-only and write operations.
|
|
547
|
+
3. **Implement resource tagging** to limit actions to resources created by the server.
|
|
548
|
+
4. **Enable AWS CloudTrail** to audit all API calls made by the server.
|
|
549
|
+
5. **Regularly review** the permissions granted to the server's IAM role.
|
|
550
|
+
6. **Use IAM Access Analyzer** to identify unused permissions that can be removed.
|
|
551
|
+
|
|
552
|
+
### Sensitive Information Handling
|
|
553
|
+
|
|
554
|
+
**IMPORTANT**: Do not pass secrets or sensitive information via allowed input mechanisms:
|
|
555
|
+
|
|
556
|
+
* Do not include secrets or credentials in YAML files applied with `apply_yaml`.
|
|
557
|
+
* Do not pass sensitive information directly in the prompt to the model.
|
|
558
|
+
* Do not include secrets in CloudFormation templates or application manifests.
|
|
559
|
+
* Avoid using MCP tools for creating Kubernetes Secrets, as this would require providing the secret data to the model.
|
|
560
|
+
|
|
561
|
+
**YAML Content Security**:
|
|
562
|
+
|
|
563
|
+
* Only use YAML files from trustworthy sources.
|
|
564
|
+
* The server relies on Kubernetes API validation for YAML content and does not perform its own validation.
|
|
565
|
+
* Audit YAML files before applying them to your cluster.
|
|
566
|
+
|
|
567
|
+
**Instead of passing secrets through MCP**:
|
|
568
|
+
|
|
569
|
+
* Use AWS Secrets Manager or Parameter Store to store sensitive information.
|
|
570
|
+
* Configure proper Kubernetes RBAC for service accounts.
|
|
571
|
+
* Use IAM roles for service accounts (IRSA) for AWS service access from pods.
|
|
572
|
+
|
|
573
|
+
## General Best Practices
|
|
574
|
+
|
|
575
|
+
* **Resource Naming**: Use descriptive names for EKS clusters and Kubernetes resources.
|
|
576
|
+
* **Namespace Usage**: Organize resources into namespaces for better management.
|
|
577
|
+
* **Error Handling**: Check for errors in tool responses and handle them appropriately.
|
|
578
|
+
* **Resource Cleanup**: Delete unused resources to avoid unnecessary costs.
|
|
579
|
+
* **Monitoring**: Monitor cluster and resource status regularly.
|
|
580
|
+
* **Security**: Follow AWS security best practices for EKS clusters.
|
|
581
|
+
* **Backup**: Regularly backup important Kubernetes resources.
|
|
582
|
+
|
|
583
|
+
## General Troubleshooting
|
|
584
|
+
|
|
585
|
+
* **Permission Errors**: Verify that your AWS credentials have the necessary permissions.
|
|
586
|
+
* **CloudFormation Errors**: Check the CloudFormation console for stack creation errors.
|
|
587
|
+
* **Kubernetes API Errors**: Verify that the EKS cluster is running and accessible.
|
|
588
|
+
* **Network Issues**: Check VPC and security group configurations.
|
|
589
|
+
* **Client Errors**: Verify that the MCP client is configured correctly.
|
|
590
|
+
* **Log Level**: Increase the log level to DEBUG for more detailed logs.
|
|
591
|
+
|
|
592
|
+
For general EKS issues, consult the [Amazon EKS documentation](https://docs.aws.amazon.com/eks/).
|
|
593
|
+
|
|
594
|
+
## Version
|
|
595
|
+
|
|
596
|
+
Current MCP server version: 0.1.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
awslabs/__init__.py,sha256=47wJeKcStxEJwX7SVVV2pnAWYR8FxcaYoT3YTmZ5Plg,674
|
|
2
|
+
awslabs/eks_mcp_server/__init__.py,sha256=ClxsTrvClkBctqdiivFNI1oYee4M8mHm0E2jlQxmw_Y,611
|
|
3
|
+
awslabs/eks_mcp_server/aws_helper.py,sha256=Ozn0xl5Qup7vQ2HEcIsMJSXZOv74eHA5yeiptKuZVhM,2733
|
|
4
|
+
awslabs/eks_mcp_server/cloudwatch_handler.py,sha256=ZwWsym2zn4a9ounIXVrB4Xsw9I4TbzkHk5a9eotO-so,28874
|
|
5
|
+
awslabs/eks_mcp_server/consts.py,sha256=tYxCxyDQy_Y1W__U6BeyBsB0Rcz3cTj-meWdJtIzPeE,1323
|
|
6
|
+
awslabs/eks_mcp_server/eks_kb_handler.py,sha256=h5xEo_-X_lMt7ifZmfJm9PiEOkR_85j5BsS5ivskv88,3489
|
|
7
|
+
awslabs/eks_mcp_server/eks_stack_handler.py,sha256=hjl5S3T-9iIIS8-Zkm-IIxLeAr3XeGlwTtTfQaDWEJk,28345
|
|
8
|
+
awslabs/eks_mcp_server/iam_handler.py,sha256=hRF_YUwjHP-QAQkJOoutjsvTJungBCY0ouMAznXdPug,14266
|
|
9
|
+
awslabs/eks_mcp_server/k8s_apis.py,sha256=VoF9KCD_eEUqqY2bcd2-hTXm02DVAHOTtKwMOEpPdzc,20170
|
|
10
|
+
awslabs/eks_mcp_server/k8s_client_cache.py,sha256=KFlDt6_tq1PjhGhOy1Q4EOMyK0NkPu6xKzZf4ciGFvI,5814
|
|
11
|
+
awslabs/eks_mcp_server/k8s_handler.py,sha256=Sa3-UwDFa8iELlMpRkM21UpoTvjwpRwfnVmv3LHMESo,47641
|
|
12
|
+
awslabs/eks_mcp_server/logging_helper.py,sha256=p_7SbWclTIVQNcQvPf5jP7OSFEJNOFbSq9b1U4v6Cxw,1797
|
|
13
|
+
awslabs/eks_mcp_server/models.py,sha256=YlTuQeweBlqt0aBPfK27_OFWhq4XFD023BBjbTPJWnY,11575
|
|
14
|
+
awslabs/eks_mcp_server/server.py,sha256=PDoyTTkhYs_Saqp4uo1M-4jVT6H7ZWvw7MTLIIl7P_E,6247
|
|
15
|
+
awslabs/eks_mcp_server/templates/eks-templates/eks-with-vpc.yaml,sha256=_Lxk2MEXNA7N0-kvXckxwBamDEagjGvC6-Z5uxhVO5s,10774
|
|
16
|
+
awslabs/eks_mcp_server/templates/k8s-templates/deployment.yaml,sha256=J2efYFISlT3sTvf8_BJV3p0_m51cltqiRhXdBXb9YJs,2343
|
|
17
|
+
awslabs/eks_mcp_server/templates/k8s-templates/service.yaml,sha256=DA0Db_5yjUZmnnYy5Bljcv3hj7D6YvFFWFRB6GiIstY,414
|
|
18
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/METADATA,sha256=l7ux4WDJae7sZx4ZOMR6hmpdETdGkgcA0Q1C-tJZllo,24126
|
|
19
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
20
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/entry_points.txt,sha256=VydotfOJYck8o4TPsaF6Pjmc8Bp_doacYXSE_71qH4c,78
|
|
21
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
22
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/licenses/NOTICE,sha256=gnCtD34qTDnb2Lykm9kNFYkqZIvqJHGuq1ZJBkl6EgE,90
|
|
23
|
+
awslabs_eks_mcp_server-0.1.1.dist-info/RECORD,,
|