AWS EKS Model Context Protocol (MCP): How It Improves Kubernetes Reliability

The closer we get to using AI in our day-to-day, the more we'll need to ensure that the data we're interacting with from the LLMs that are used is accurate. This way, engineers and technical leadership teams can ensure the usage is worth the time and expense (expense of using LLMs and time for engineers to get trained up on them).
The majority of organizations cannot spend millions of dollars to train a Model to help with AIOps and Kubernetes workloads, but MCP Servers can be used to ensure accurate and reliable information.
In this blog post, you'll learn the key aspects of the EKS MCP Server, how to use the EKS MCP server for your Elastic Kubernetes Service cluster, and how to interact with an MCP Server using Python.
Prerequisites
If you want to follow along from a hands-on perspective, you'll need:
- An AWS account and an EKS cluster deployed. If you don't have an EKS cluster deployed, this blog post will still be very helpful as you'll have a code example for when you do have an EKS cluster deployed.
- Python3 installed.
Model Context Protocol (MCP) Recap
When thinking about what MCP is, think "An API call to a collection of needed data". As the name suggest, it could be an actual server/VM that's hosting the data. Programmatically, it could be a client/server architecture where the "server" in the case of MCP is something like a PyPi package that you can "download" and call upon. You'd then use a client (e.g - a script) to access the tools within the MCP Server.
The overall goal of MCP is simple; accurate information. Sometimes, LLMs don't give you accurate information and because everyone wants as close to "accurate" as an LLM can get, an MCP Server can be used to store accurate information for the job you're trying to do. That's why MCP Servers are popping up for everything from Kubernetes to documentation to CICD.
The AWS EKS MCP Server
The EKS MCP Server, as the name suggests, is an MCP Server that's designed for EKS.
It has the following tools/functionality:
list_k8s_resources
: List k8s resources.list_api_versions
: List k8s API versions.manage_k8s_resource
: CRUD operations for k8s resourcesapply_yaml
: Likekubectl apply -f
get_k8s_events
: Likekubectl get events
suggestsget_pod_logs
: Likekubectl get pods
manage_eks_stacks
: CloudFormation templates for EKS clusters.search_eks_troubleshoot_guide
: Search EKS docs for info.get_cloudwatch_logs
: Logs from CloudWatch for Pods or the Control Plane.get_cloudwatch_metrics
: Metrics from CloudWatch for Pods and Clusters.
Combining all of this functionality in an MCP Server, you have a way to troubleshoot, deploy, and receive information about workloads running in EKS.
Using The AWS EKS MCP Server
There are a few different ways to interact with an MCP Server. In the case of the EKS MCP Server, you'll need a client. That client could be anything from Cline for VS Code to a Python script that interacts with the mcp
library.
In this case, we'll see how it's done with Python.
First, below is what an MCP Server configuration looks like. It's use uvx
, which uses uv
to execute Python tools. Notice how it also takes some environment variables and arguments.
uv
is a Python package manager that's written in Rust. It's gaining a ton of popularity for replacing pip
.{
"mcpServers": {
"awslabs.eks-mcp-server": {
"command": "uvx",
"args": [
"awslabs.eks-mcp-server",
"--allow-write"
],
"env": {
"AWS_PROFILE": "default",
"AWS_REGION": "us-west-2",
"FASTMCP_LOG_LEVEL": "INFO"
}
}
}
}
First, import the libraries that are needed. In this case, it'll be the MCP libraries, the async library for concurrent tasks, and the JSON library for clean output to the terminal.
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
import json
Next, specify a function. In this case, it'll be an async
function. MCP Servers are I/O centric, so having concurrency actions for handling I/O bound tasks is important.
async def main()
The first piece of logic in the function is to call out to the AWS EKS MCP Server. In this case, it's hard-coded into the Python script. However, you could save it as a .json
file and call upon it instead of hard-coding it.
server_params = StdioServerParameters(
command="uvx",
args=["awslabs.eks-mcp-server", "--allow-write"],
env={
"AWS_PROFILE": "default",
"AWS_REGION": "us-east-1",
"FASTMCP_LOG_LEVEL": "INFO"
}
)
Once the EKS MCP Server is defined, you can call upon it via the MCP library and specify some functionality. In the example below, it's using the list_k8s_resources
tool and specifying the name of a cluster and the kind/object that you want to call upon within the list_k8s_resources
tool
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("list_k8s_resources", arguments={
'cluster_name': 'k8squickstart-cluster',
'kind': 'Pod',
'api_version': 'v1',
})
The last step is to output the results to the terminal.
for c in result.content:
data = json.loads(c.text)
print(json.dumps(data, indent=2))
Putting the code together, it'll look like the below.
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
import json
async def main():
server_params = StdioServerParameters(
command="uvx",
args=["awslabs.eks-mcp-server", "--allow-write"],
env={
"AWS_PROFILE": "default",
"AWS_REGION": "us-east-1",
"FASTMCP_LOG_LEVEL": "INFO"
}
)
# Connect to EKS MCP server
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("list_k8s_resources", arguments={
'cluster_name': 'k8squickstart-cluster',
'kind': 'Pod',
'api_version': 'v1',
})
for c in result.content:
data = json.loads(c.text)
print(json.dumps(data, indent=2))
if __name__ == "__main__":
asyncio.run(main())
Save the code above in a file called eksmcp.py
.
Running The Client
Now that the client is built, the only thing left is to run it and confirm that it works as expected.
From the terminal where you saved the script, run the following command:
python3 eksmcppy
python
instead of python3
. It all depends on how you configired your alias.The first output you'll see is the authentication/authorization step, which looks at your AWS config locally for proper access.
2025-07-08 08:45:33.682 | INFO | awslabs.eks_mcp_server.server:main:140 - Starting EKS MCP Server in restricted sensitive data access mode
[07/08/25 08:45:33] INFO Processing request of type CallToolRequest server.py:619
INFO Found credentials in shared credentials file: ~/.aws/credentials credentials.py:1352
INFO Found credentials in shared credentials file: ~/.aws/credentials credentials.py:1352
The second output is a quick list of what resources (in this case, Pods) are deployed.
2025-07-08 08:45:35.392 | INFO | awslabs.eks_mcp_server.logging_helper:log_with_request_id:49 - [request_id=1] Cleaned up resource responses for Pod resources
2025-07-08 08:45:35.392 | INFO | awslabs.eks_mcp_server.logging_helper:log_with_request_id:49 - [request_id=1] Listed 8 Pod resources in all namespaces
You'll then see a JSON output of the Pods running within your environment.

Congrats! You've successfully implemented a solid use case of the AWS EKS MCP Server with Python.
Comments ()