Kubernetes MCP server

Manage Kubernetes, with additional support for OpenShift.
Back to servers
Provider
Marc Nuri
Release date
Feb 11, 2025
Language
Go
Stats
173 stars

Kubernetes MCP Server is a powerful implementation of the Model Context Protocol for Kubernetes and OpenShift clusters. It allows you to perform various operations on your Kubernetes resources without requiring external dependencies like kubectl or helm, making it ideal for AI assistants and tools that need to interact with Kubernetes.

Installation

Requirements

  • Access to a Kubernetes cluster

Installing for Claude Desktop

The quickest way to set up kubernetes-mcp-server with Claude Desktop is using npx:

  1. Open your claude_desktop_config.json file
  2. Add the MCP server to the mcpServers section:
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": [
        "-y",
        "kubernetes-mcp-server@latest"
      ]
    }
  }
}

Installing for VS Code

Install the Kubernetes MCP server extension by running this command:

# For VS Code
code --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'
# For VS Code Insiders
code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'

Installing for Goose CLI

To use kubernetes-mcp-server with Goose CLI:

  1. Open your goose config.yaml file
  2. Add the MCP server to the extensions:
extensions:
  kubernetes:
    command: npx
    args:
      - -y
      - kubernetes-mcp-server@latest

Configuration Options

You can run the Kubernetes MCP server using npx, uvx, or by downloading the latest release binary:

# Using npx
npx kubernetes-mcp-server@latest --help

# Using uvx
uvx kubernetes-mcp-server@latest --help

# Using binary
./kubernetes-mcp-server --help

Available configuration options:

Option Description
--sse-port Starts the MCP server in Server-Sent Event mode and listens on specified port
--log-level Sets logging level (0-9), similar to kubectl logging levels
--kubeconfig Path to Kubernetes configuration file (attempts auto-resolution if not provided)

Available Tools and Usage

Kubernetes Configuration

configuration_view

View your current Kubernetes configuration as kubeconfig YAML.

Parameters:

  • minified (boolean, optional, default: true) - Returns minimal config with only current context if true

Pods Management

pods_list

List all Kubernetes pods across all namespaces.

pods_list_in_namespace

List all pods in a specific namespace.

Parameters:

  • namespace (string, required) - Namespace to list pods from
pods_get

Get details of a specific pod.

Parameters:

  • name (string, required) - Pod name
  • namespace (string, required) - Pod namespace
pods_delete

Delete a pod.

Parameters:

  • name (string, required) - Pod name
  • namespace (string, required) - Pod namespace
pods_log

Get logs from a pod.

Parameters:

  • name (string, required) - Pod name
  • namespace (string, required) - Pod namespace
  • container (string, optional) - Container name within pod
pods_exec

Execute a command in a pod.

Parameters:

  • command (string[], required) - Command and arguments (e.g., ["ls", "-l", "/tmp"])
  • name (string, required) - Pod name
  • namespace (string, required) - Pod namespace
  • container (string, optional) - Container name
pods_run

Run a container image in a pod.

Parameters:

  • image (string, required) - Container image
  • namespace (string, required) - Namespace to run in
  • name (string, optional) - Pod name (random if not provided)
  • port (number, optional) - Port to expose

Namespace and Project Management

namespaces_list

List all Kubernetes namespaces.

projects_list

List all OpenShift projects.

Events

events_list

List Kubernetes events.

Parameters:

  • namespace (string, optional) - Namespace to get events from (all if not specified)

Helm Operations

helm_install

Install a Helm chart.

Parameters:

  • chart (string, required) - Chart name or path
  • values (object, optional) - Chart values
  • name (string, optional) - Release name
  • namespace (string, optional) - Target namespace
helm_list

List Helm releases.

Parameters:

  • namespace (string, optional) - Namespace to list from
  • all_namespaces (boolean, optional) - List from all namespaces if true

Generic Resource Management

resources_create_or_update

Create or update any Kubernetes resource.

Parameters:

  • resource (string, required) - YAML or JSON representation of the resource
resources_delete

Delete a Kubernetes resource.

Parameters:

  • apiVersion (string, required) - API version (e.g., "v1", "apps/v1")
  • kind (string, required) - Resource kind (e.g., "Pod", "Deployment")
  • name (string, required) - Resource name
  • namespace (string, optional) - Resource namespace
resources_get

Get a Kubernetes resource.

Parameters:

  • apiVersion (string, required) - API version
  • kind (string, required) - Resource kind
  • name (string, required) - Resource name
  • namespace (string, optional) - Resource namespace
resources_list

List Kubernetes resources.

Parameters:

  • apiVersion (string, required) - API version
  • kind (string, required) - Resource kind
  • namespace (string, optional) - Resource namespace

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later