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.
The quickest way to set up kubernetes-mcp-server with Claude Desktop is using npx:
claude_desktop_config.json
filemcpServers
section:{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": [
"-y",
"kubernetes-mcp-server@latest"
]
}
}
}
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"]}'
To use kubernetes-mcp-server with Goose CLI:
config.yaml
fileextensions:
kubernetes:
command: npx
args:
- -y
- kubernetes-mcp-server@latest
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) |
configuration_view
View your current Kubernetes configuration as kubeconfig YAML.
Parameters:
minified
(boolean, optional, default: true
) - Returns minimal config with only current context if truepods_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 frompods_get
Get details of a specific pod.
Parameters:
name
(string, required) - Pod namenamespace
(string, required) - Pod namespacepods_delete
Delete a pod.
Parameters:
name
(string, required) - Pod namenamespace
(string, required) - Pod namespacepods_log
Get logs from a pod.
Parameters:
name
(string, required) - Pod namenamespace
(string, required) - Pod namespacecontainer
(string, optional) - Container name within podpods_exec
Execute a command in a pod.
Parameters:
command
(string[], required) - Command and arguments (e.g., ["ls", "-l", "/tmp"]
)name
(string, required) - Pod namenamespace
(string, required) - Pod namespacecontainer
(string, optional) - Container namepods_run
Run a container image in a pod.
Parameters:
image
(string, required) - Container imagenamespace
(string, required) - Namespace to run inname
(string, optional) - Pod name (random if not provided)port
(number, optional) - Port to exposenamespaces_list
List all Kubernetes namespaces.
projects_list
List all OpenShift projects.
events_list
List Kubernetes events.
Parameters:
namespace
(string, optional) - Namespace to get events from (all if not specified)helm_install
Install a Helm chart.
Parameters:
chart
(string, required) - Chart name or pathvalues
(object, optional) - Chart valuesname
(string, optional) - Release namenamespace
(string, optional) - Target namespacehelm_list
List Helm releases.
Parameters:
namespace
(string, optional) - Namespace to list fromall_namespaces
(boolean, optional) - List from all namespaces if trueresources_create_or_update
Create or update any Kubernetes resource.
Parameters:
resource
(string, required) - YAML or JSON representation of the resourceresources_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 namenamespace
(string, optional) - Resource namespaceresources_get
Get a Kubernetes resource.
Parameters:
apiVersion
(string, required) - API versionkind
(string, required) - Resource kindname
(string, required) - Resource namenamespace
(string, optional) - Resource namespaceresources_list
List Kubernetes resources.
Parameters:
apiVersion
(string, required) - API versionkind
(string, required) - Resource kindnamespace
(string, optional) - Resource namespaceThere 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.
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"
]
}
}
}
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.
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.