Kubernetes MCP Server
Provides comprehensive Kubernetes cluster management: list and describe resources such as pods, namespaces, deployments, services, secrets, and ingresses; delete pods; restart and scale deployments; create deployments and namespaces; retrieve pod logs and cluster events; and provide port-forwarding instructions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Kubernetes MCP Server
A Model Context Protocol (MCP) server for Kubernetes that provides comprehensive cluster management capabilities without requiring kubectl to be installed locally. This server can be used in both STDIO and HTTP modes, making it perfect for integration with AI assistants like Claude in Cursor/VS Code.
Features
Resource Management
List Operations: List pods, namespaces, service accounts, deployments, replicasets, secrets, ingresses, services, and custom resource definitions
Describe Operations: Get detailed information about specific resources
Action Operations: Delete pods, restart deployments, scale deployments, create resources, and more
Full Tool List
list_pods- List all pods in a namespace or all namespaceslist_namespaces- List all namespaceslist_service_accounts- List service accountslist_deployments- List deploymentslist_replicasets- List replica setslist_secrets- List secrets (without exposing secret data)list_ingresses- List ingresseslist_services- List serviceslist_crds- List custom resource definitionsdescribe_pod- Get detailed pod informationdescribe_namespace- Get detailed namespace informationdescribe_service_account- Get detailed service account informationdescribe_deployment- Get detailed deployment informationdescribe_replicaset- Get detailed replica set informationdescribe_secret- Get secret metadata (without exposing secret data)describe_ingress- Get detailed ingress informationdescribe_service- Get detailed service informationdelete_pod- Delete a podrestart_deployment- Restart a deployment by triggering a rolloutscale_deployment- Scale a deployment to a specific number of replicascreate_deployment- Create a new deploymentcreate_namespace- Create a new namespaceget_pod_logs- Get logs from a podget_events- Get cluster eventsport_forward_service- Get instructions for port forwarding to a serviceport_forward_pod- Get instructions for port forwarding to a pod
Related MCP server: Kube MCP
Prerequisites
Node.js 18 or higher
Access to a Kubernetes cluster (local or remote)
Valid kubeconfig file (typically at
~/.kube/config)
Installation
Clone the repository:
git clone <repository-url>
cd kubernetes-mcp-serverInstall dependencies:
npm installBuild the project:
npm run buildConfiguration
Kubeconfig Setup
The server uses your kubeconfig file to connect to Kubernetes clusters. By default, it looks for the kubeconfig at the standard location (~/.kube/config).
To use a custom kubeconfig location, set the KUBECONFIG environment variable:
export KUBECONFIG=/path/to/your/kubeconfigConnecting to Different Clusters
The server supports both local and remote Kubernetes clusters:
Local clusters (minikube, kind, Docker Desktop): Use the default kubeconfig
Remote clusters (EKS, GKE, AKS, etc.): Configure your kubeconfig with the appropriate cluster credentials
You can switch between contexts using standard kubectl commands:
kubectl config use-context <context-name>Usage
Running in STDIO Mode (for Cursor/VS Code)
STDIO mode is the default mode for MCP servers integrated with AI assistants.
Development Mode
npm run devProduction Mode
npm run build
npm startRunning in HTTP Mode
HTTP mode exposes the MCP server over HTTP using Server-Sent Events (SSE).
Development Mode
npm run dev:httpProduction Mode
npm run build
npm run start:httpBy default, the server runs on port 3000. You can change this by setting the PORT environment variable:
PORT=8080 npm run start:httpIntegration with Cursor/VS Code
STDIO Mode (Recommended)
Open your Cursor/VS Code settings
Navigate to the MCP settings
Add this server configuration:
For Cursor:
Edit your Cursor settings file (~/.cursor/config/settings.json or through UI):
{
"mcp": {
"servers": {
"kubernetes": {
"command": "node",
"args": ["/absolute/path/to/kubernetes-mcp-server/dist/index.js"],
"env": {
"KUBECONFIG": "/Users/yourusername/.kube/config"
}
}
}
}
}For VS Code with Claude: Edit your MCP settings file:
{
"mcpServers": {
"kubernetes": {
"command": "node",
"args": ["/absolute/path/to/kubernetes-mcp-server/dist/index.js"],
"env": {
"KUBECONFIG": "/Users/yourusername/.kube/config"
}
}
}
}HTTP Mode
For HTTP mode, configure the MCP client to connect to the HTTP endpoint:
{
"mcpServers": {
"kubernetes": {
"url": "http://localhost:3000/message"
}
}
}Example Usage with AI Assistant
Once integrated, you can ask your AI assistant natural language questions like:
"List all pods in the default namespace"
"Show me the deployments in production"
"Scale the web-app deployment to 3 replicas"
"Get the logs from the api-server pod in the backend namespace"
"Create a new namespace called staging"
"Describe the nginx deployment in kube-system"
"Restart the frontend deployment"
"Show me all the events in the cluster"
Development
Project Structure
kubernetes-mcp-server/
├── src/
│ ├── __tests__/ # Test files
│ ├── tools/ # Tool implementations
│ │ ├── list-tools.ts # List operations
│ │ ├── describe-tools.ts # Describe operations
│ │ └── action-tools.ts # Action operations
│ ├── k8s-client.ts # Kubernetes client wrapper
│ ├── server.ts # Main MCP server implementation
│ ├── index.ts # STDIO entry point
│ └── index-http.ts # HTTP entry point
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdRunning Tests
npm testRunning Tests in Watch Mode
npm run test:watchLinting
npm run lintSecurity Considerations
Kubeconfig Access: The server needs access to your kubeconfig file. Ensure it's properly secured with appropriate file permissions.
Secret Handling: The
describe_secretandlist_secretstools intentionally do not expose secret data values, only metadata.RBAC: The server operates with the permissions of the kubeconfig context being used. Ensure appropriate RBAC policies are in place in your cluster.
HTTP Mode: When using HTTP mode, consider implementing authentication and running the server behind a reverse proxy with TLS in production.
Troubleshooting
"Unable to connect to cluster"
Verify your kubeconfig is valid:
kubectl cluster-infoCheck the KUBECONFIG environment variable is set correctly
Ensure you have network access to the cluster
"Tool not found" errors
Rebuild the project:
npm run buildRestart the MCP server
Check the Cursor/VS Code logs for detailed error messages
Permission Errors
Verify your kubeconfig user has appropriate RBAC permissions
Check the service account permissions if using a service account token
Port Forwarding Limitations
Port forwarding operations return instructions rather than maintaining active connections, as MCP tools are designed to be stateless. For active port forwarding, use the returned kubectl command.
Contributing
Contributions are welcome! Please follow these guidelines:
Fork the repository
Create a feature branch
Add tests for new functionality
Ensure all tests pass:
npm testSubmit a pull request
License
MIT License - see LICENSE file for details
Acknowledgments
Built with the Model Context Protocol SDK
Uses the official Kubernetes JavaScript Client
Support
For issues, questions, or contributions, please open an issue on GitHub.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Deploy and run apps, workers, jobs, Postgres, and Valkey on Ownkube from your coding agent.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables managing Kubernetes clusters through natural language by providing tools to list resources, view logs, port-forward services, scale deployments, and execute kubectl operations via AI assistants.81MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with and manage Kubernetes clusters, supporting operations on pods, deployments, services, configmaps, secrets, namespaces, metrics, and events with built-in safety features for destructive actions.99 npm1MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Kubernetes clusters through 50 specialized tools for comprehensive cluster management. Supports both local kubectl and remote SSH-based execution for managing pods, deployments, services, and other Kubernetes resources.49MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI-powered Kubernetes management using natural language, supporting kubectl, Helm, diagnostics, and port forwarding via MCP protocol.MIT