Kubernetes MCP Server
@wakeupworld
About Kubernetes MCP Server
No overview available yet
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"k8s_mcp_server": {
"command": "python3",
"args": [
"k8s_mcp_wrapper.py"
]
}
}
}Tools
14Get a list of pods in the specified namespace
Get a list of services in the specified namespace
Get a list of deployments in the specified namespace
Get a list of all namespaces in the cluster
Describe a Kubernetes resource in detail
Get logs from a pod in the specified namespace
Create a new namespace in the Kubernetes cluster
Delete a Kubernetes resource
Scale a deployment to the specified number of replicas
Get events from the Kubernetes cluster
Get the current kubectl context
Get the list of available kubectl contexts
Switch the kubectl context
List all available scripts with their parameters
Overview
What is Kubernetes MCP Server?
A flexible Machine Communication Protocol (MCP) server that provides Kubernetes management capabilities with support for custom extension scripts. It integrates with kubectl to offer a wide range of cluster operations through tabular output, and automatically detects and registers user-created Python scripts as additional tools.
How to use Kubernetes MCP Server?
Install dependencies (Python 3.10+ and kubectl required), then run python3 k8s_mcp_wrapper.py from the bin/ directory. For development and debugging, use the --dev flag with an optional --dev-port. The scripts directory can be overridden by setting the SCRIPTS_DIR environment variable.
Key features of Kubernetes MCP Server
- Implements MCP protocol using the official MCP SDK.
- Provides built-in tools for common Kubernetes operations.
- Supports dynamic loading and auto-detection of custom extension scripts.
- Automatic parameter detection and validation for scripts.
- Clean, modular architecture with Pydantic models for type safety.
Use cases of Kubernetes MCP Server
- Manage Kubernetes resources (pods, services, deployments, namespaces) through MCP-based clients.
- Retrieve logs, describe resources, and scale deployments programmatically.
- Switch between kubectl contexts and list available contexts.
- Extend functionality by adding custom Python scripts that are automatically registered as tools.
FAQ from Kubernetes MCP Server
What Python version is required?
Python 3.10 or higher is required by the MCP SDK.
What are the prerequisites?
kubectl must be installed and configured, and the Python packages listed in requirements.txt must be installed.
How do I create custom extension scripts?
Scripts must be Python files with a .py extension, use argparse for parameter definitions, and support receiving arguments via a JSON file with the --args-file flag. A detailed template is provided in the README.
Can I override the default scripts directory?
Yes, set the SCRIPTS_DIR environment variable to the desired path before starting the server.
What built-in tools are available?
Tools include get_pods, get_services, get_deployments, get_namespaces, describe_resource, get_pod_logs, create_namespace, delete_resource, scale_deployment, get_events, get_current_context, get_available_contexts, switch_context, and list_scripts.
More Cloud & Infrastructure MCP servers
Firebase MCP
gannonh🔥 Model Context Protocol (MCP) server for Firebase.
MCP Server Kubernetes
Flux159MCP Server for kubernetes management commands
MCP Server that interacts with Azure AI Foundry (experimental)
azure-ai-foundryA MCP Server for Azure AI Foundry: it's now moved to cloud, check the new Foundry MCP Server
Run Model Context Protocol (MCP) servers with AWS Lambda
awslabsRun existing Model Context Protocol (MCP) stdio-based servers in AWS Lambda functions
Azure DevOps MCP Server
Tiberriver256An MCP server for Azure DevOps
Comments