EKS Model Context Protocol (MCP) Server
LocalAbout EKS Model Context Protocol (MCP) Server
EKS Model Context Protocol (MCP) Server exposes EKS and Kubernetes operations through a FastAPI service for GenAI agents. It supports cluster and workload queries, resource management, and multiple authentication approaches.
Key features
- 01List and describe EKS clusters
- 02Inspect nodegroups and Kubernetes resources
- 03Retrieve pod logs
- 04Support multiple EKS authentication methods
- 05Run in Docker or deploy to ECS
Use cases
- 01List clusters in an AWS region
- 02Inspect pods and deployments in a namespace
- 03Retrieve logs from a pod
MCP support
The server exposes EKS and Kubernetes operations to MCP clients through operation discovery and query endpoints.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEEKS Model Context Protocol (MCP) Server
A lightweight, efficient server that implements the Model Context Protocol for EKS operations. This server provides a standardized interface for GenAI agents to interact with EKS clusters.
Features
- Fast response times with proper timeout handling
- Comprehensive EKS operations support
- Kubernetes resource management (pods, services, deployments, etc.)
- Multiple authentication methods for EKS clusters
- Robust error handling and logging
- Docker containerization for easy deployment
- ECS deployment support
Project Structure
main.py: Main server implementation with FastAPIeks_operations.py: EKS API operations implementationk8s_operations.py: Kubernetes API operations implementationk8s_operations_sdk_v4.py: SDK-based Kubernetes operations implementationk8s_operations_kubectl.py: Kubectl-based Kubernetes operations with proper authenticationk8s_auth_config.py: Authentication configuration for Kubernetesdirect_k8s_client.py: Direct Kubernetes API client implementationtest_*.py: Various test scripts for different implementationsDockerfileandDockerfile.amd64: Docker configuration filesdocker-compose.yml: Docker Compose configurationrequirements.txt: Python dependenciesclient/: Client implementation directory (Client README)ecs-deployment/: ECS deployment scripts and configuration (ECS Deployment README)
API Endpoints
GET /health- Health check endpointGET /mcp/v1/operations- List available operationsPOST /mcp/v1/query- Execute MCP operations
Supported Operations
EKS Cluster Operations
list_clusters- List EKS clusters in a regiondescribe_cluster- Get detailed information about a clusterlist_nodegroups- List nodegroups for a clusterdescribe_nodegroup- Get detailed information about a nodegroup
Kubernetes Operations
list_namespaces- List Kubernetes namespaceslist_pods- List pods in a namespacedescribe_pod- Get detailed information about a podget_deployments- List deployments in a namespacedescribe_deployment- Get detailed information about a deploymentget_services- List services in a namespacedescribe_service- Get detailed information about a serviceget_pod_logs- Get logs from a pod
Authentication Methods
The server supports multiple authentication methods for EKS clusters:
- AWS SDK Authentication: Uses the AWS SDK to authenticate with EKS and get cluster information
- Kubectl with Generated Kubeconfig: Creates a temporary kubeconfig file and uses kubectl
- Direct Kubernetes API Calls: Makes direct API calls to the Kubernetes API server
The current implementation uses the Kubectl method with proper authentication, which provides the most reliable results.
Getting Started
Prerequisites
- Docker
- AWS credentials (for production use)
- Python 3.8+ (for local development)
Running Locally
# Install dependencies
pip install -r requirements.txt
# Run the server
python main.py
Running with Docker
# Build the Docker image
docker build -t eks-mcp-server .
# Run the container
docker run -d -p 8000:8000 --name mcp-server eks-mcp-server
Running with Docker Compose
# Start the server
docker-compose up -d
# Stop the server
docker-compose down
Deploying to ECS
See the ECS Deployment README for detailed instructions.
# Deploy to ECS
cd ecs-deployment
./deploy.sh
# Update existing ECS deployment
./update-service.sh
Testing
Use the included test scripts to verify the server is working correctly:
# Basic tests
python test_mcp.py
# Comprehensive operation tests
python test_mcp_operations.py
# Test namespace integration
python test_mcp_namespace.py
python test_mcp_namespace_2.py
# Test kubectl integration
python test_kubectl_operations.py
# Test SDK v3 operations
python test_v3_operations.py
# Test SDK v4 operations
python test_v4_operations.py
Client Usage
The project includes a client implementation that uses Amazon Bedrock for conversational interaction with the MCP server. See the Client README for details.
# Run the client
cd client
python mcp_chat_client_v6.py
Example Requests
List Clusters
curl -X POST http://localhost:8000/mcp/v1/query \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"operation": "list_clusters",
"parameters": {
"region": "us-east-1"
}
}'
List Pods
curl -X POST http://localhost:8000/mcp/v1/query \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"operation": "list_pods",
"parameters": {
"cluster_name": "my-cluster",
"namespace": "default",
"region": "us-east-1"
}
}'
Architecture
The server is built with FastAPI and uses a combination of synchronous and asynchronous operations for improved performance. It includes:
- Timeout handling for AWS API calls
- Multiple authentication methods for EKS clusters
- Comprehensive logging
- Response time tracking
- Error handling with detailed error codes
EKS Authentication
For the server to authenticate with EKS clusters, the ECS task role needs to be added to the EKS cluster's aws-auth ConfigMap. See the ECS Deployment README for detailed instructions.
Current Deployment
The server is currently deployed to ECS and accessible at:
- Endpoint: http://3.90.45.69:8000
- Health check: http://3.90.45.69:8000/health
- Operations discovery: http://3.90.45.69:8000/mcp/v1/operations
Test Namespaces
The project includes test namespaces in the EKS cluster:
mcp-test-namespace: Contains a deployment with 2 nginx podsmcp-test-namespace-2: Contains a deployment with 3 nginx pods
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.