Skip to main content
Glama

Kubernetes MCP Server

A powerful MCP (Model Context Protocol) server for Kubernetes operations that allows you to manage your Kubernetes clusters using natural language through AI assistants.

🌟 Features

  • � Resource Listing

    • List pods, services, deployments, and namespaces

    • Get detailed resource information

  • 🔍 Monitoring & Debugging

    • View pod logs with customizable line counts

    • Describe pod details for troubleshooting

    • Get cluster events for debugging

  • ⚡ Operations

    • Port-forward services to local ports

    • Scale deployments up or down

    • Execute kubectl commands through natural language

  • 🎯 Developer Focused

    • Designed for common Kubernetes developer workflows

    • Easy to extend with additional tools

    • Comprehensive error handling

Related MCP server: Kube MCP

� Available Tools

Tool

Description

Parameters

list-pods

List pods in a namespace

namespace (optional)

list-services

List services in a namespace

namespace (optional)

list-deployments

List deployments in a namespace

namespace (optional)

list-namespaces

List all namespaces

None

describe-pod

Get detailed pod information

pod (required), namespace (optional)

get-logs

Get pod logs

pod (required), namespace (optional), lines (optional), follow (optional)

port-forward

Port forward a service

service, localPort, targetPort (required), namespace (optional)

scale-deployment

Scale a deployment

deployment, replicas (required), namespace (optional)

get-events

Get cluster events

namespace (optional)

📋 Requirements

  • Node.js v18+

  • kubectl installed and configured to access your cluster

  • @modelcontextprotocol/cli (optional, for testing)

# Verify kubectl works
kubectl get pods

# Install MCP CLI (optional)
npm install -g @modelcontextprotocol/cli

🔧 Installation

# Clone or download this repository
cd kube-mcp

# Install dependencies
npm install

# Run tests to verify setup
node test.js

🏃 Running the Server

# Start the MCP server
npm start

# Or run directly
node server.js

The server runs on stdio transport and will output: Kubernetes MCP server running on stdio

🔌 Connecting to MCP Clients

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "node",
      "args": ["/absolute/path/to/kube-mcp/server.js"]
    }
  }
}

Other MCP Clients

For clients that support MCP, configure them to connect to this server using:

  • Command: node

  • Args: ["/path/to/server.js"]

  • Transport: stdio

💡 Example Usage

Once connected to an MCP-compatible client, you can use natural language like:

  • "List all pods in the default namespace"

  • "Show me the logs for the nginx pod"

  • "Port forward the web service on port 8080 to my local port 3000"

  • "Scale the api deployment to 3 replicas"

  • "What events happened recently in the kube-system namespace?"

🧪 Testing

Run the test script to verify everything is working:

node test.js

This will check:

  • ✅ kubectl availability

  • ✅ Server syntax validation

  • ✅ Server startup capability

  • ✅ Cluster connectivity

🛠️ Development

To add new tools:

  1. Add the tool definition to the tools array in server.js

  2. Add a corresponding case in the CallToolRequestSchema handler

  3. Implement the kubectl command and response formatting

  4. Test with node test.js

⚠️ Security Notes

  • This server executes kubectl commands on your system

  • Ensure your kubectl context is set to the correct cluster

  • Be cautious when scaling deployments or port-forwarding in production

  • Review all operations before execution

📜 License

MIT License - feel free to modify and distribute

🤝 Contributing

Contributions are welcome! Please feel free to submit issues and enhancement requests.

Restart your MCP-enabled client (Cursor AI, Claude Desktop, VS Code MCP extension, etc.)

Now you can issue natural commands like:

  • “Show me all pods in namespace payments”

  • “Port forward postgres service to local 5432”

  • “Get logs from api-pod”

Available Tools

81 tools
analyze-resource-usageC

Analyze resource usage across the cluster

Inputs: namespace.

annotateC

Add or update annotations on a resource

Inputs: resource (required), name (required), annotations (required), namespace.

api-resourcesC

Get available API resources

Inputs: no named parameters.

api-versionsB

Get available API versions

Inputs: no named parameters.

applyC

Apply a Kubernetes manifest from a file or URL

Inputs: file (required), namespace.

argocd-app-statusC

Get the status of an ArgoCD application

Inputs: app (required), namespace.

argocd-list-appsB

List ArgoCD applications

Inputs: namespace.

auth-can-iC

Check if the current user can perform an action

Inputs: verb (required), resource (required), namespace.

cluster-infoC

Get cluster information

Inputs: no named parameters.

cordon-nodeB

Mark a node as unschedulable

Inputs: node (required).

cpC

Copy files to/from a pod

Inputs: pod (required), source (required), destination (required), namespace, +1 more.

create-backupB

Create a backup of cluster resources

Inputs: namespace, output.

create-ephemeral-containerC

Create an ephemeral debug container in a pod

Inputs: pod (required), image (required), name (required), namespace, +1 more.

create-namespaceC

Create a new namespace

Inputs: name (required).

current-contextB

Get the current kubectl context

Inputs: no named parameters.

debug-podC

Create a debug container in a pod

Inputs: pod (required), namespace, image.

deleteC

Delete a Kubernetes resource

Inputs: resource (required), name (required), namespace.

describe-configmapC

Describe details of a Kubernetes configmap

Inputs: configmap (required), namespace.

describe-deploymentC

Describe details of a Kubernetes deployment

Inputs: deployment (required), namespace.

describe-nodeC

Describe details of a Kubernetes node

Inputs: node (required).

describe-podC

Describe details of a Kubernetes pod

Inputs: pod (required), namespace.

describe-secretB

Describe details of a Kubernetes secret

Inputs: secret (required), namespace.

describe-serviceC

Describe details of a Kubernetes service

Inputs: service (required), namespace.

drain-nodeC

Drain a node for maintenance

Inputs: node (required), force, ignore_daemonsets.

execC

Execute a command in a pod container

Inputs: pod (required), command (required), namespace, container.

get-cluster-metricsC

Get cluster-wide metrics

Inputs: no named parameters.

get-configmapC

Get the data from a configmap

Inputs: configmap (required), namespace.

get-contextsB

List all kubectl contexts

Inputs: no named parameters.

get-crdC

Get a custom resource definition

Inputs: name (required).

get-eventsC

Get Kubernetes events for troubleshooting

Inputs: namespace.

get-logsC

Get logs from a Kubernetes pod

Inputs: pod (required), namespace, lines, follow, +1 more.

get-node-metricsC

Get detailed metrics for a node

Inputs: node (required).

get-pod-metricsC

Get detailed metrics for a pod

Inputs: pod (required), namespace.

get-secretC

Get the data from a secret

Inputs: secret (required), namespace.

helm-installC

Install a Helm chart

Inputs: name (required), chart (required), namespace, values, +1 more.

helm-listC

List Helm releases

Inputs: namespace.

helm-statusB

Get the status of a Helm release

Inputs: release (required), namespace.

helm-uninstallC

Uninstall a Helm release

Inputs: name (required), namespace.

helm-upgradeC

Upgrade a Helm release

Inputs: name (required), chart (required), namespace, values.

istio-list-gatewaysC

List Istio gateways

Inputs: namespace.

istio-list-virtualservicesC

List Istio virtual services

Inputs: namespace.

labelC

Add or update labels on a resource

Inputs: resource (required), name (required), labels (required), namespace.

list-allC

List all Kubernetes resources in a namespace

Inputs: namespace.

list-clusterrolebindingsB

List Kubernetes cluster role bindings

Inputs: no named parameters.

list-clusterrolesB

List Kubernetes cluster roles

Inputs: no named parameters.

list-configmapsC

List Kubernetes configmaps in a namespace

Inputs: namespace.

list-crdsB

List Kubernetes custom resource definitions

Inputs: no named parameters.

list-cronjobsB

List Kubernetes cronjobs in a namespace

Inputs: namespace.

list-deploymentsC

List Kubernetes deployments in a namespace

Inputs: namespace.

list-endpointsC

List Kubernetes endpoints in a namespace

Inputs: namespace.

list-hpaB

List Kubernetes horizontal pod autoscalers in a namespace

Inputs: namespace.

list-ingressesC

List Kubernetes ingresses in a namespace

Inputs: namespace.

list-jobsB

List Kubernetes jobs in a namespace

Inputs: namespace.

list-limitrangesB

List Kubernetes limit ranges in a namespace

Inputs: namespace.

list-namespacesB

List all Kubernetes namespaces

Inputs: no named parameters.

list-networkpoliciesC

List Kubernetes network policies in a namespace

Inputs: namespace.

list-nodesB

List all Kubernetes nodes

Inputs: no named parameters.

list-podsC

List Kubernetes pods in a namespace

Inputs: namespace.

list-pvB

List Kubernetes persistent volumes

Inputs: no named parameters.

list-pvcC

List Kubernetes persistent volume claims in a namespace

Inputs: namespace.

list-resourcequotasB

List Kubernetes resource quotas in a namespace

Inputs: namespace.

list-rolebindingsB

List Kubernetes role bindings in a namespace

Inputs: namespace.

list-rolesB

List Kubernetes roles in a namespace

Inputs: namespace.

list-secretsB

List Kubernetes secrets in a namespace

Inputs: namespace.

list-serviceaccountsC

List Kubernetes service accounts in a namespace

Inputs: namespace.

list-servicesB

List Kubernetes services in a namespace

Inputs: namespace.

patchC

Patch a Kubernetes resource

Inputs: resource (required), name (required), patch (required), type, +1 more.

port-forwardC

Port forward a Kubernetes service to a local port

Inputs: service (required), localPort (required), targetPort (required), namespace.

port-forward-podB

Port forward a Kubernetes pod to a local port

Inputs: pod (required), localPort (required), targetPort (required), namespace.

rollout-historyB

Show the rollout history of a deployment

Inputs: deployment (required), namespace.

rollout-restartC

Restart a deployment by triggering a rollout

Inputs: deployment (required), namespace.

rollout-statusC

Check the rollout status of a deployment

Inputs: deployment (required), namespace.

runC

Run a pod with a specific image

Inputs: name (required), image (required), namespace, command.

scale-deploymentC

Scale a Kubernetes deployment to a specified number of replicas

Inputs: deployment (required), replicas (required), namespace.

set-imageC

Update the image of a deployment

Inputs: deployment (required), container (required), image (required), namespace.

top-nodesB

Show resource usage for nodes

Inputs: no named parameters.

top-podsC

Show resource usage for pods

Inputs: namespace.

uncordon-nodeC

Mark a node as schedulable

Inputs: node (required).

use-contextC

Switch to a different kubectl context

Inputs: context (required).

versionB

Get Kubernetes version information

Inputs: no named parameters.

waitC

Wait for a condition on a resource

Inputs: resource (required), name (required), condition (required), namespace, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 81 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific resources and actions, but there is some overlap. For example, 'debug-pod' and 'create-ephemeral-container' both relate to pod debugging, and 'port-forward' vs 'port-forward-pod' could be confusing without careful reading of descriptions. However, the majority are well-differentiated.

    Naming Consistency4/5

    The naming follows a consistent kebab-case verb-noun pattern throughout, with clear conventions like 'list-*', 'get-*', 'describe-*', and action-specific verbs. Minor deviations exist, such as 'cp' (abbreviation) and 'run' (single word), but overall the pattern is predictable and readable.

    Tool Count2/5

    With 81 tools, the count is excessive for an MCP server, making it overwhelming and difficult for agents to navigate. While Kubernetes is a complex domain, this many tools suggests poor scoping and could lead to confusion or inefficiency in tool selection.

    Completeness5/5

    The toolset provides comprehensive coverage of Kubernetes operations, including CRUD, monitoring, debugging, and management tasks across resources. It supports core workflows like deployment, scaling, logging, and troubleshooting, with no apparent gaps for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables advanced management of Kubernetes clusters through natural language interactions. Supports querying, managing, and monitoring pods, deployments, nodes, and logs across multiple contexts and namespaces.
      10
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables 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.
      9
      7 npm
      1
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables 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.
      49
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to manage Docker containers and Kubernetes resources through natural language, supporting operations like container management, image building, and pod/deployment/service management.
      9
      MIT