### Start MCP Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/KEYCLOAK_OIDC_SETUP.md Command to start the MCP server after the local environment setup is complete. Ensure to use the generated configuration file. ```bash ./kubernetes-mcp-server --port 8008 --config _output/config.toml ``` -------------------------------- ### vm_guest_info Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Get guest operating system information from a VirtualMachine's QEMU guest agent. Requires the guest agent to be installed and running inside the VM. Provides detailed information about the OS, filesystems, network interfaces, and logged-in users. ```APIDOC ## vm_guest_info ### Description Get guest operating system information from a VirtualMachine's QEMU guest agent. Requires the guest agent to be installed and running inside the VM. Provides detailed information about the OS, filesystems, network interfaces, and logged-in users. ### Parameters #### Query Parameters - **info_type** (string) - Optional - Type of information to retrieve: 'all' (default - all available info), 'os' (operating system details), 'filesystem' (disk and filesystem info), 'users' (logged-in users), 'network' (network interfaces and IPs) - **name** (string) - Required - The name of the virtual machine - **namespace** (string) - Required - The namespace of the virtual machine ``` -------------------------------- ### MCP Server Instructions Example Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Provide hints to MCP clients about the server's capabilities. This example outlines tasks related to Kubernetes and OpenShift cluster management. ```toml server_instructions = """ Use this server for Kubernetes and OpenShift cluster management tasks including: - Pods: list, get details, logs, exec commands, delete - Resources: get, list, create, update, delete any Kubernetes resource - Namespaces and projects: list, create, switch context - Nodes: list, view logs, get resource usage statistics - Events: view cluster events for debugging - Helm: install, upgrade, uninstall charts and releases - KubeVirt: create and manage virtual machines - Cluster config: view and switch kubeconfig contexts """ ``` -------------------------------- ### Example Drop-in Configuration Files Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Illustrates how to use drop-in TOML files to override specific server configurations. The first example overrides the toolsets, and the second shows local development overrides for log level and read-only mode. ```toml toolsets = ["core", "config", "helm", "kubevirt"] ``` ```toml log_level = 9 read_only = true ``` -------------------------------- ### Install Kubernetes MCP Server Chart Source: https://github.com/containers/kubernetes-mcp-server/blob/main/charts/kubernetes-mcp-server/README.md Installs the Kubernetes MCP Server Helm chart. Ensure to replace with your desired host. ```shell helm upgrade -i -n kubernetes-mcp-server --create-namespace kubernetes-mcp-server oci://ghcr.io/containers/charts/kubernetes-mcp-server --set ingress.host= ``` -------------------------------- ### Setup Local Development Environment Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Initializes a complete local development environment using a Kind cluster. ```bash make local-env-setup ``` -------------------------------- ### Setup Kiali Infrastructure Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/README.md Command to set up the necessary Kiali infrastructure for running Kiali-specific tasks. ```bash make setup-kiali ``` -------------------------------- ### Install Kubernetes MCP Server for VS Code Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Install the Kubernetes MCP server extension for VS Code using the command line. ```shell # For VS Code code --add-mcp '{"name":"kubernetes","command":"npx","args":["-y","kubernetes-mcp-server@latest"]}' ``` -------------------------------- ### Install Kubernetes MCP Server for VS Code Insiders Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Install the Kubernetes MCP server extension for VS Code Insiders using the command line. ```shell # For VS Code Insiders code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["-y","kubernetes-mcp-server@latest"]}' ``` -------------------------------- ### tekton_pipeline_start Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Start a Tekton Pipeline by creating a PipelineRun that references it. ```APIDOC ## tekton_pipeline_start ### Description Start a Tekton Pipeline by creating a PipelineRun that references it. ### Parameters #### Query Parameters - **name** (string) - Required - Name of the Pipeline to start - **namespace** (string) - Optional - Namespace of the Pipeline - **params** (object) - Optional - Parameter values to pass to the Pipeline. Keys are parameter names; values can be a string, an array of strings, or an object (map of string to string) depending on the parameter type defined in the Pipeline spec ``` -------------------------------- ### Install Kubernetes MCP Server with Helm Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Use this Helm command to install the Kubernetes MCP server. Refer to the chart README and values.yaml for configuration options. ```shell helm install kubernetes-mcp-server oci://ghcr.io/containers/charts/kubernetes-mcp-server ``` -------------------------------- ### Run Local Environment Setup Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/KEYCLOAK_OIDC_SETUP.md Execute this command to set up the complete local development environment, including Kind cluster, Keycloak, and MCP server. ```bash make local-env-setup ``` -------------------------------- ### Install Tekton Pipelines Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/tekton/README.md Installs Tekton Pipelines in the cluster. This is a prerequisite for running any Tekton-related evaluation tasks. ```shell make tekton-install ``` -------------------------------- ### Run the MCP Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/ENTRA_ID_SETUP.md Start the MCP server using the specified configuration file. Ensure the configuration is correctly set up before running. ```bash ./kubernetes-mcp-server --config config.toml ``` -------------------------------- ### Example Test Helper Function Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Provides an example of a reusable test helper function for retrieving string fields from an unstructured object using JSONPath-like notation. ```go // FieldString retrieves a string field from an unstructured object using JSONPath-like notation. // Examples: // - "spec.runStrategy" // - "spec.template.spec.volumes[0].containerDisk.image" func FieldString(obj *unstructured.Unstructured, path string) string { // implementation } ``` -------------------------------- ### Start Tekton Pipeline Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/tekton/README.md Initiates a Tekton Pipeline named 'hello-pipeline' by creating a new PipelineRun in the 'tekton-eval' namespace. ```shell tkn pipeline start hello-pipeline --namespace tekton-eval ``` -------------------------------- ### tekton_task_start Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Start a Tekton Task by creating a TaskRun that references it. ```APIDOC ## tekton_task_start ### Description Start a Tekton Task by creating a TaskRun that references it. ### Parameters #### Query Parameters - **name** (string) - Required - Name of the Task to start - **namespace** (string) - Optional - Namespace of the Task - **params** (object) - Optional - Parameter values to pass to the Task. Keys are parameter names; values can be a string, an array of strings, or an object (map of string to string) depending on the parameter type defined in the Task spec ``` -------------------------------- ### helm_install Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Install (deploy) a Helm chart to create a release in the current or provided namespace. ```APIDOC ## POST helm_install ### Description Installs a Helm chart to create a new release. ### Method POST ### Endpoint /helm/install ### Parameters #### Request Body - **chart** (string) - Required - Chart reference to install (e.g., 'stable/grafana', 'oci://ghcr.io/nginxinc/charts/nginx-ingress') - **name** (string) - Optional - Name of the Helm release. A random name is generated if not provided. - **namespace** (string) - Optional - Namespace to install the Helm chart in. Defaults to the current namespace if not provided. - **values** (object) - Optional - Key-value pairs for values to pass to the Helm chart. ``` -------------------------------- ### Configure Production Sampling Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Implement ratio-based sampling for production environments to manage trace volume. This example samples 10% of traces. ```bash # Sample 10% of traces export OTEL_TRACES_SAMPLER=traceidratio export OTEL_TRACES_SAMPLER_ARG=0.1 ``` -------------------------------- ### Complete MCP Server Configuration Example Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md A comprehensive TOML configuration file demonstrating various server settings, security, Kubernetes connection, access control, toolset configurations, and denied resources. ```toml # Server settings log_level = 2 log_file = "/var/log/kubernetes-mcp-server.log" port = "8080" list_output = "table" stateless = false # HTTP server security [http] read_header_timeout = "10s" # Slowloris protection max_body_bytes = 16777216 # 16 MB for large K8s manifests rate_limit_rps = 5 # Per-session rate limiting rate_limit_burst = 10 # Kubernetes connection kubeconfig = "/home/user/.kube/config" cluster_provider_strategy = "kubeconfig" # Access control read_only = false disable_destructive = true # Toolsets toolsets = ["core", "config", "helm", "kubevirt"] # Tool filtering disabled_tools = ["resources_delete"] # Tool overrides [tool_overrides.pods_list] description = "List pods in the cluster. Prefer using label selectors over listing all pods when the namespace has many workloads." # Denied resources [[denied_resources]] group = "" version = "v1" kind = "Secret" # Server instructions for MCP clients server_instructions = """ Use this server for Kubernetes cluster management including pods, deployments, services, and Helm releases. This server is configured with read-only access to Secrets. """ ``` -------------------------------- ### Example MCP Tool Call Trace Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md This is an example of a trace generated for an MCP tool call, showing details like tool name, status, and duration. ```text Trace ID: abc123def456789 Duration: 145ms └─ tools/call resources_get [145ms] ├─ mcp.method.name: tools/call ├─ gen_ai.tool.name: resources_get ├─ gen_ai.operation.name: execute_tool ├─ rpc.jsonrpc.version: 2.0 ├─ network.transport: pipe └─ Status: OK ``` -------------------------------- ### vm_lifecycle Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Manage KubeVirt VirtualMachine lifecycle: start, stop, or restart a VM. ```APIDOC ## vm_lifecycle ### Description Manage KubeVirt VirtualMachine lifecycle: start, stop, or restart a VM. ### Parameters #### Query Parameters - **action** (string) - Required - The lifecycle action to perform: 'start' (changes runStrategy to Always), 'stop' (changes runStrategy to Halted), or 'restart' (stops then starts the VM) - **name** (string) - Required - The name of the virtual machine - **namespace** (string) - Required - The namespace of the virtual machine ``` -------------------------------- ### Example Output of MCP Server List Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/getting-started-claude-code.md This is the expected output when listing MCP servers, showing the connection status for 'kubernetes-mcp-server'. ```text Checking MCP server health... kubernetes-mcp-server: npx -y kubernetes-mcp-server@latest --read-only - ✓ Connected ``` -------------------------------- ### Install Kubernetes MCP Server in VS Code/Insiders Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Manually install the Kubernetes MCP server extension for VS Code or VS Code Insiders using the command line. ```shell # For VS Code code --add-mcp '{"name":"kubernetes","command":"npx","args":["-y","kubernetes-mcp-server@latest"]}' # For VS Code Insiders code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["-y","kubernetes-mcp-server@latest"]}' ``` -------------------------------- ### Kubernetes MCP Server Command-Line Usage Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Examples of how to use the kubernetes-mcp-server command with different configuration file options. This includes specifying a main configuration file, using only drop-in configuration files, or a combination of both. ```bash kubernetes-mcp-server --config /etc/kubernetes-mcp-server/config.toml ``` ```bash kubernetes-mcp-server --config-dir /etc/kubernetes-mcp-server/conf.d/ ``` ```bash kubernetes-mcp-server --config /etc/kubernetes-mcp-server/config.toml \ --config-dir /etc/kubernetes-mcp-server/config.d/ ``` -------------------------------- ### Configure MCP Server via .mcp.json Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Integrate the MCP server into your project by defining its command, arguments, and environment variables in a .mcp.json configuration file. This example sets the OTLP endpoint and sampler. ```json { "mcpServers": { "kubernetes": { "command": "npx", "args": ["-y", "kubernetes-mcp-server@latest"], "env": { "OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317", "OTEL_TRACES_SAMPLER": "always_on" } } } } ``` -------------------------------- ### KCP Cluster Provider Configuration Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Example configuration for the KCP cluster provider. This section is for KCP-specific settings. ```toml [cluster_provider_configs.kcp] # kcp-specific configuration ``` -------------------------------- ### Build Kubernetes MCP Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Formats source code and builds the Kubernetes MCP server executable. Ensure Go is installed and dependencies are managed. ```bash make build ``` -------------------------------- ### Example HTTP Request Trace with Tool Call Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md This trace illustrates an HTTP request that also triggered an MCP tool call, showing details for both operations. ```text Trace ID: abc123def456789 Duration: 150ms ├─ POST /message [150ms] │ ├─ http.request.method: POST │ ├─ url.path: /message │ ├─ http.response.status_code: 200 │ ├─ client.address: 192.168.1.100 │ │ │ └─ tools/call resources_get [145ms] ├─ mcp.method.name: tools/call ├─ gen_ai.tool.name: resources_get ├─ gen_ai.operation.name: execute_tool ├─ rpc.jsonrpc.version: 2.0 ├─ network.transport: tcp └─ Status: OK ``` -------------------------------- ### Configure Kubernetes MCP Server in Cursor Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Manually install the Kubernetes MCP server by editing the mcp.json file in Cursor. ```json { "mcpServers": { "kubernetes-mcp-server": { "command": "npx", "args": ["-y", "kubernetes-mcp-server@latest"] } } } ``` -------------------------------- ### vm_create Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Create a KubeVirt VirtualMachine in the cluster with the specified configuration, automatically resolving instance types, preferences, and container disk images. VM will be created in Halted state by default; use autostart parameter to start it immediately. ```APIDOC ## vm_create ### Description Create a KubeVirt VirtualMachine in the cluster with the specified configuration, automatically resolving instance types, preferences, and container disk images. VM will be created in Halted state by default; use autostart parameter to start it immediately. ### Parameters #### Query Parameters - **autostart** (boolean) - Optional - Optional flag to automatically start the VM after creation (sets runStrategy to Always instead of Halted). Defaults to false. - **instancetype** (string) - Optional - Optional instance type name for the VM (e.g. 'u1.small', 'u1.medium', 'u1.large') - **name** (string) - Required - The name of the virtual machine - **namespace** (string) - Required - The namespace for the virtual machine - **networks** (array) - Optional - Optional secondary network interfaces to attach to the VM. Each item specifies a Multus NetworkAttachmentDefinition to attach. Accepts either simple strings (NetworkAttachmentDefinition names) or objects with 'name' (interface name in VM) and 'networkName' (NetworkAttachmentDefinition name) properties. Each network creates a bridge interface on the VM. - **performance** (string) - Optional - Optional performance family hint for the VM instance type (e.g. 'u1' for general-purpose, 'o1' for overcommitted, 'c1' for compute-optimized, 'm1' for memory-optimized). Defaults to 'u1' (general-purpose) if not specified. - **preference** (string) - Optional - Optional preference name for the VM - **size** (string) - Optional - Optional workload size hint for the VM (e.g. 'small', 'medium', 'large', 'xlarge'). Used to auto-select an appropriate instance type if not explicitly specified. - **storage** (string) - Optional - Optional storage size for the VM's root disk when using DataSources (e.g. '30Gi', '50Gi', '100Gi'). Defaults to 30Gi. Ignored when using container disks. - **workload** (string) - Optional - The workload for the VM. Accepts OS names (e.g. 'fedora' (default), 'ubuntu', 'centos', 'centos-stream', 'debian', 'rhel', 'opensuse', 'opensuse-tumbleweed', 'opensuse-leap') or full container disk image URLs ``` -------------------------------- ### Run Kubernetes MCP Server with uvx Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Execute the Kubernetes MCP server using uvx, assuming uv and python are installed. ```shell # Run the Kubernetes MCP server using uvx (in case you have uv and python installed) uvx kubernetes-mcp-server@latest --help ``` -------------------------------- ### Run Kubernetes MCP Server with uvx Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Execute the Kubernetes MCP server using uvx, assuming uv and python are installed. ```shell uvx kubernetes-mcp-server@latest --help ``` -------------------------------- ### Start MCP Inspector for Testing Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/ENTRA_ID_SETUP.md Launch MCP Inspector to test authentication with the MCP server. This command requires the path to the MCP server executable and its configuration file. ```bash npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server --config config.toml ``` -------------------------------- ### Run All Kiali MCP Contract Tests Source: https://github.com/containers/kubernetes-mcp-server/blob/main/pkg/kiali/tests/README.md Execute all Kiali MCP contract tests using the 'kiali_contract' build tag. Ensure you are in the correct directory and have Go 1.24+ installed. ```bash cd pkg/kiali/tests/backend go test -tags kiali_contract -v ./... ``` -------------------------------- ### Example TOML Configuration for Kubernetes MCP Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md This TOML file demonstrates various configuration options including log level, read-only mode, enabled toolsets, and denied resources. It also shows telemetry settings. ```toml log_level = 2 read_only = true toolsets = ["core", "config", "helm", "kubevirt"] # Deny access to sensitive resources [[denied_resources]] group = "" version = "v1" kind = "Secret" [telemetry] endpoint = "http://localhost:4317" ``` -------------------------------- ### Enable Telemetry with OTLP Endpoint Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Configure OpenTelemetry to send traces and metrics to a specified OTLP endpoint. This example enables telemetry and sets the endpoint for trace collection. ```toml [telemetry] endpoint = "http://localhost:4317" traces_sampler = "traceidratio" traces_sampler_arg = 0.1 # 10% sampling ``` -------------------------------- ### TOML Telemetry Configuration: Production with Sampling Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Example TOML configuration for a production environment, including a specific OTLP endpoint and a 5% trace sampling rate. ```toml [telemetry] endpoint = "http://tempo-distributor:4317" traces_sampler = "traceidratio" traces_sampler_arg = 0.05 # 5% sampling ``` -------------------------------- ### Clone and Set Up Local Repository Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CONTRIBUTING.md Clone your forked repository and navigate into the project directory. This is the initial step for making any code changes. ```bash git clone https://github.com//kubernetes-mcp-server.git cd kubernetes-mcp-server ``` -------------------------------- ### Verify Tekton Installation Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/tekton/README.md Checks if Tekton Pipelines are successfully installed and available in the cluster. ```shell make tekton-status ``` -------------------------------- ### TOML Telemetry Configuration Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Configure OpenTelemetry settings using a TOML file. This example shows enabling telemetry, setting the endpoint, protocol, and trace sampling. ```toml [telemetry] # Optional: explicitly enable/disable (omit to auto-enable when endpoint is set) enabled = true endpoint = "http://localhost:4317" # Protocol: "grpc" (default) or "http/protobuf" protocol = "grpc" # Trace sampling strategy # Options: "always_on", "always_off", "traceidratio", "parentbased_always_on", "parentbased_always_off", "parentbased_traceidratio" traces_sampler = "traceidratio" # Sampling ratio for ratio-based samplers (0.0 to 1.0) traces_sampler_arg = 0.1 ``` -------------------------------- ### Verify OIDC Configuration with kubectl Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/ENTRA_ID_SETUP.md Test your OIDC setup by using kubectl with an Entra ID access token. A successful response listing namespaces indicates correct configuration. ```bash kubectl --token="" get namespaces ``` -------------------------------- ### Display Kubernetes MCP Server Help Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Use the --help flag to display all available command-line options for the Kubernetes MCP server. ```bash ./kubernetes-mcp-server --help ``` -------------------------------- ### Basic Test Suite Structure with Testify Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Demonstrates the basic structure for organizing Go tests using testify/suite. Embed suite.Suite and use suite.Run() to execute test suites. ```go type MyTestSuite struct { suite.Suite } func (s *MyTestSuite) TestSomething() { s.Run("descriptive scenario name", func() { // test implementation }) } func TestMyFeature(t *testing.T) { suite.Run(t, new(MyTestSuite)) } ``` -------------------------------- ### Example Stats Endpoint Response Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Provides an example JSON response from the `/stats` endpoint, showing aggregated metrics like total tool calls and HTTP requests. ```json { "total_tool_calls": 42, "tool_call_errors": 2, "tool_calls_by_name": { "resources_list": 15, "pods_get": 12, "helm_list": 10, "resources_get": 5 }, "total_http_requests": 100, "http_requests_by_path": { "/mcp": 50, "/sse": 30, "/message": 20 }, "uptime_seconds": 3600.5 } ``` -------------------------------- ### Configure MCP Server Settings Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Set logging verbosity, specify a log file path, configure the HTTP port, and define the output format for resource lists. This example also shows how to enable TLS for HTTPS and enforce TLS connections. ```toml log_level = 2 log_file = "/var/log/kubernetes-mcp-server.log" port = "8080" list_output = "yaml" stateless = true # Enable TLS for HTTPS tls_cert = "/etc/tls/tls.crt" tls_key = "/etc/tls/tls.key" # Enforce TLS for all connections (requires tls_cert and tls_key) require_tls = true ``` -------------------------------- ### Enable Tracing and Run Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Set the OTLP endpoint environment variable and then run the kubernetes-mcp-server. This enables tracing and metrics export. ```bash export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 # Run the server npx -y kubernetes-mcp-server@latest ``` -------------------------------- ### Run Tests Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CONTRIBUTING.md Execute the test suite. The first run may require network access to download the `envtest` environment binaries. ```bash make test ``` -------------------------------- ### kiali_manage_istio_config_read Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Read-only Istio config: list or get objects. ```APIDOC ## kiali_manage_istio_config_read ### Description Read-only Istio config: list or get objects. For action 'list', returns an array of objects with {name, namespace, type, validation}. For create, patch, or delete use manage_istio_config. ### Method Not specified (assumed to be a command-line or SDK call) ### Endpoint Not applicable ### Parameters #### Query Parameters - **action** (string) - Required - Action to perform (read-only) - **clusterName** (string) - Optional - Optional cluster name. Defaults to the cluster name in the Kiali configuration. - **group** (string) - Optional - API group of the Istio object. Required for 'get' action. - **kind** (string) - Optional - Kind of the Istio object. Required for 'get' action. - **namespace** (string) - Optional - Namespace containing the Istio object. For 'list', if not provided, returns objects across all namespaces. For 'get', required. - **object** (string) - Optional - Name of the Istio object. Required for 'get' action. - **serviceName** (string) - Optional - Filter Istio configurations (VirtualServices, DestinationRules, and their referenced Gateways) that affect a specific service. Only applicable for 'list' action - **version** (string) - Optional - API version. Use 'v1' for VirtualService, DestinationRule, and Gateway. Required for 'get' action. ``` -------------------------------- ### kiali_manage_istio_config_read Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Read-only Istio config: list or get objects. ```APIDOC ## kiali_manage_istio_config_read ### Description Read-only Istio config: list or get objects. For action 'list', returns an array of objects with {name, namespace, type, validation}. For create, patch, or delete use manage_istio_config. ### Method Not specified (assumed to be a command-line tool or SDK function) ### Endpoint Not applicable ### Parameters #### Query Parameters - **action** (string) - Required - Action to perform (read-only) - **clusterName** (string) - Optional - Optional cluster name. Defaults to the cluster name in the Kiali configuration. - **group** (string) - Optional - API group of the Istio object. Required for 'get' action. - **kind** (string) - Optional - Kind of the Istio object. Required for 'get' action. - **namespace** (string) - Optional - Namespace containing the Istio object. For 'list', if not provided, returns objects across all namespaces. For 'get', required. - **object** (string) - Optional - Name of the Istio object. Required for 'get' action. - **serviceName** (string) - Optional - Filter Istio configurations (VirtualServices, DestinationRules, and their referenced Gateways) that affect a specific service. Only applicable for 'list' action - **version** (string) - Optional - API version. Use 'v1' for VirtualService, DestinationRule, and Gateway. Required for 'get' action. ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### kcp_workspace_describe Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Get detailed information about a specific kcp workspace. ```APIDOC ## kcp_workspace_describe ### Description Get detailed information about a specific kcp workspace. ### Method Not specified (assumed to be a command-line tool or SDK function) ### Endpoint Not applicable ### Parameters #### Path Parameters - **workspace** (string) - Required - Name or path of the workspace to describe ### Request Example Not applicable ### Response Not specified ``` -------------------------------- ### Set Sampler for Production Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Configure ratio-based sampling for production, setting it to 5% to handle high-traffic services efficiently. ```bash # Production: 5% sampling (good for high-traffic services) export OTEL_TRACES_SAMPLER=traceidratio export OTEL_TRACES_SAMPLER_ARG=0.05 ``` -------------------------------- ### Build the Project Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CONTRIBUTING.md This command cleans, tidies, formats, and lints the code before building the binary. The resulting executable is named `kubernetes-mcp-server`. ```bash # Clean, tidy, format, lint, and build the binary make build ``` -------------------------------- ### configuration_view Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Get the current Kubernetes configuration content as a kubeconfig YAML. ```APIDOC ## configuration_view ### Description Get the current Kubernetes configuration content as a kubeconfig YAML. ### Method Not specified (Tool command) ### Endpoint Not specified (Tool command) ### Parameters #### Query Parameters - **minified** (boolean) - Optional - Return a minified version of the configuration. If set to true, keeps only the current-context and the relevant pieces of the configuration for that context. If set to false, all contexts, clusters, auth-infos, and users are returned in the configuration. (Optional, default true) ``` -------------------------------- ### pods_get Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Get a Kubernetes Pod in the current or provided namespace with the provided name. ```APIDOC ## pods_get ### Description Get a Kubernetes Pod in the current or provided namespace with the provided name. ### Parameters #### Path Parameters - **name** (string) - Required - Name of the Pod - **namespace** (string) - Optional - Namespace to get the Pod from ``` -------------------------------- ### Get Pod Logs Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Retrieves the logs from a specified Kubernetes Pod container. ```APIDOC ## GET /pods/{name}/logs ### Description Get the logs of a Kubernetes Pod in the current or provided namespace with the provided name. ### Method GET ### Endpoint /pods/{name}/logs ### Parameters #### Path Parameters - **name** (string) - Required - Name of the Pod to get the logs from #### Query Parameters - **container** (string) - Optional - Name of the Pod container to get the logs from - **namespace** (string) - Optional - Namespace to get the Pod logs from - **previous** (boolean) - Optional - Return previous terminated container logs - **tail** (integer) - Optional - Number of lines to retrieve from the end of the logs (default: 100) ``` -------------------------------- ### pods_log Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Get the logs of a Kubernetes Pod in the current or provided namespace with the provided name. ```APIDOC ## pods_log ### Description Get the logs of a Kubernetes Pod in the current or provided namespace with the provided name. ### Parameters #### Path Parameters - **name** (string) - Required - Name of the Pod to get the logs from - **namespace** (string) - Optional - Namespace to get the Pod logs from - **container** (string) - Optional - Name of the Pod container to get the logs from (Optional). - **previous** (boolean) - Optional - Return previous terminated container logs (Optional). - **tail** (integer) - Optional - Number of lines to retrieve from the end of the logs (Optional, default: 100). ``` -------------------------------- ### Get Pod Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Retrieves a specific Kubernetes Pod by its name in the current or provided namespace. ```APIDOC ## GET /pods/{name} ### Description Get a Kubernetes Pod in the current or provided namespace with the provided name. ### Method GET ### Endpoint /pods/{name} ### Parameters #### Path Parameters - **name** (string) - Required - Name of the Pod #### Query Parameters - **namespace** (string) - Optional - Namespace to get the Pod from ``` -------------------------------- ### Run GolangCI-Lint Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Executes the static analysis tool golangci-lint. It automatically downloads the specified version if not present. ```bash make lint ``` -------------------------------- ### Enable Kiali Toolset Configuration Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/KIALI.md Configure the server to enable the Kiali toolset by specifying it in the `toolsets` array and providing the Kiali URL in the `[toolset_configs.kiali]` section. Ensure the URL is valid and consider setting `insecure` or `certificate_authority` for HTTPS connections. ```toml toolsets = ["core", "kiali"] [toolset_configs.kiali] url = "https://kiali.example" # Endpoint/route to reach Kiali console # insecure = true # optional: allow insecure TLS (not recommended in production) # certificate_authority = "/path/to/ca.crt" # File path to CA certificate # When url is https and insecure is false, certificate_authority is required. ``` -------------------------------- ### Start Tekton Task Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/tekton/README.md Executes a Tekton Task named 'echo-task' by creating a TaskRun in the 'tekton-eval' namespace. ```shell tkn task start echo-task --namespace tekton-eval ``` -------------------------------- ### Source and Use KubeVirt VM Verification Helpers Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/kubevirt/helpers/README.md Source the helper script to use various verification functions in your test scripts. Ensure the path to the script is correct relative to your test file. ```bash #!/usr/bin/env bash source "$(dirname "${BASH_SOURCE[0]}")/../../helpers/verify-vm.sh" # Use helper functions verify_vm_exists "test-vm" "vm-test" || exit 1 verify_container_disk "test-vm" "vm-test" "fedora" || exit 1 verify_run_strategy "test-vm" "vm-test" || exit 1 verify_no_deprecated_running_field "test-vm" "vm-test" || exit 1 ``` -------------------------------- ### resources_get Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name. ```APIDOC ## GET resources_get ### Description Retrieves a specific Kubernetes resource based on its apiVersion, kind, name, and optionally namespace. ### Method GET ### Endpoint /resources ### Parameters #### Query Parameters - **apiVersion** (string) - Required - apiVersion of the resource (e.g., v1, apps/v1, networking.k8s.io/v1) - **kind** (string) - Required - kind of the resource (e.g., Pod, Service, Deployment, Ingress) - **name** (string) - Required - Name of the resource - **namespace** (string) - Optional - Namespace to retrieve the namespaced resource from. Ignored for cluster-scoped resources. Defaults to the configured namespace if not provided. ``` -------------------------------- ### Get Pod Resource Consumption Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Lists the resource consumption (CPU and memory) for specified Kubernetes Pods. ```APIDOC ## GET /pods/top ### Description List the resource consumption (CPU and memory) as recorded by the Kubernetes Metrics Server for the specified Kubernetes Pods in the all namespaces, the provided namespace, or the current namespace. ### Method GET ### Endpoint /pods/top ### Parameters #### Query Parameters - **all_namespaces** (boolean) - Optional - If true, list the resource consumption for all Pods in all namespaces. If false, list the resource consumption for Pods in the provided namespace or the current namespace - **label_selector** (string) - Optional - Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label (Optional, only applicable when name is not provided) - **name** (string) - Optional - Name of the Pod to get the resource consumption from (Optional, all Pods in the namespace if not provided) - **namespace** (string) - Optional - Namespace to get the Pods resource consumption from (Optional, current namespace if not provided and all_namespaces is false) ``` -------------------------------- ### configuration_contexts_list Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md List all available context names and associated server URLs from the kubeconfig file. ```APIDOC ## configuration_contexts_list ### Description List all available context names and associated server URLs from the kubeconfig file. ### Method Not specified (Tool command) ### Endpoint Not specified (Tool command) ``` -------------------------------- ### kiali_get_logs Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Get the logs of a Kubernetes Pod (or workload name that will be resolved to a pod) in a namespace. Output is plain text. ```APIDOC ## kiali_get_logs ### Description Get the logs of a Kubernetes Pod (or workload name that will be resolved to a pod) in a namespace. Output is plain text, matching kubernetes-mcp-server pods_log. ### Parameters #### Query Parameters - **clusterName** (string) - Optional - Name of the cluster to get the logs from. If not provided, will use the default cluster name in the Kiali KubeConfig. - **container** (string) - Optional - Name of the Pod container to get the logs from. - **format** (string) - Optional - Output formatting for chat. 'codeblock' wraps logs in ~~~ fences (recommended). 'plain' returns raw text like kubernetes-mcp-server pods_log. - **name** (string) - Required - Name of the Pod to get the logs from. If it does not exist, it will be treated as a workload name and a running pod will be selected. - **namespace** (string) - Required - Namespace to get the Pod logs from. - **previous** (boolean) - Optional - Return previous terminated container logs. - **severity** (string) - Optional - Severity filter applied client-side. Accepts 'ERROR', 'WARN' or combinations like 'ERROR,WARN'. - **tail** (integer) - Optional - Number of lines to retrieve from the end of the logs (Optional, defaults to 50). Cannot exceed 200 lines. - **workload** (string) - Optional - Workload name override (used when name lookup fails). ``` -------------------------------- ### resources_scale Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Get or update the scale of a Kubernetes resource. If the scale is set, it will be updated; otherwise, the current scale is returned. ```APIDOC ## GET/PUT resources_scale ### Description Retrieves or updates the scale of a Kubernetes resource (e.g., Deployment, StatefulSet). ### Method GET/PUT ### Endpoint /resources/scale ### Parameters #### Query Parameters - **apiVersion** (string) - Required - apiVersion of the resource (e.g., apps/v1) - **kind** (string) - Required - kind of the resource (e.g., StatefulSet, Deployment) - **name** (string) - Required - Name of the resource - **namespace** (string) - Optional - Namespace of the namespaced resource. Ignored for cluster-scoped resources. Defaults to the configured namespace if not provided. - **scale** (integer) - Optional - The desired scale value to update the resource to. If omitted, the current scale is returned. ``` -------------------------------- ### Run All Go Tests Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Execute all Go tests in the project. This command may require network access on the first run to download testing environment dependencies. ```bash make test ``` -------------------------------- ### nodes_stats_summary Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Gets detailed resource usage statistics from a Kubernetes node via the kubelet's Summary API. ```APIDOC ## nodes_stats_summary ### Description Get detailed resource usage statistics from a Kubernetes node via the kubelet's Summary API. Provides comprehensive metrics including CPU, memory, filesystem, and network usage at the node, pod, and container levels. On systems with cgroup v2 and kernel 4.20+, also includes PSI (Pressure Stall Information) metrics that show resource pressure for CPU, memory, and I/O. See https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/ for details on PSI metrics. ### Method Not specified (assumed to be a tool command) ### Endpoint Not applicable (tool command) ### Parameters #### Path Parameters - **name** (string) - Required - Name of the node to get stats from ``` -------------------------------- ### Verify Instancetype Prefix Source: https://github.com/containers/kubernetes-mcp-server/blob/main/evals/tasks/kubevirt/helpers/README.md Verifies that the VirtualMachine's instancetype name starts with a specific prefix, useful for categorizing families like performance or compute-optimized. This function returns success even if the prefix doesn't match, printing only a warning. ```bash verify_instancetype_prefix "my-vm" "vm-test" "c1" "compute-optimized" ``` ```bash verify_instancetype_prefix "my-vm" "vm-test" "u1" "general-purpose" ``` -------------------------------- ### Prometheus Scrape Configuration Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Example Prometheus scrape configuration to collect metrics from the MCP server's `/metrics` endpoint. ```yaml scrape_configs: - job_name: 'kubernetes-mcp-server' static_configs: - targets: ['localhost:8080'] metrics_path: /metrics ``` -------------------------------- ### Use Built-in `cluster-health-check` Prompt Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/prompts.md Example usage of the built-in `cluster-health-check` prompt. You can check the entire cluster or specify a namespace. ```bash Check the health of my cluster ``` ```bash Check the health of namespace production ``` ```bash Check the health of my cluster without events ``` -------------------------------- ### Creating a ServiceAccount Kubeconfig for MCP Server Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/ENTRA_ID_SETUP.md This bash script demonstrates how to create a ServiceAccount, grant it permissions, generate a token, and construct a kubeconfig file for the MCP server. Adjust the token duration based on your security requirements. ```bash # Create ServiceAccount kubectl create sa mcp-server -n default # Grant permissions (adjust role as needed) kubectl create clusterrolebinding mcp-server-reader \ --clusterrole=view \ --serviceaccount=default:mcp-server # Create a token (adjust duration to your security requirements) kubectl create token mcp-server -n default --duration=720h > sa-token # Create kubeconfig with the token export SA_TOKEN=$(cat sa-token) export CLUSTER_URL=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}') export CLUSTER_CA=$(kubectl config view --raw --minify -o jsonpath='{.clusters[0].cluster.certificate-authority-data}') cat > mcp-kubeconfig << EOF apiVersion: v1 kind: Config clusters: - cluster: certificate-authority-data: ${CLUSTER_CA} server: ${CLUSTER_URL} name: cluster contexts: - context: cluster: cluster user: mcp-server name: mcp-context current-context: mcp-context users: - name: mcp-server user: token: ${SA_TOKEN} EOF ``` ```bash ./kubernetes-mcp-server --config config.toml ``` -------------------------------- ### configuration_contexts_list Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Lists all available context names and their associated server URLs from the kubeconfig file. ```APIDOC ## configuration_contexts_list ### Description List all available context names and associated server urls from the kubeconfig file. ### Method Not specified (assumed to be a tool command) ### Endpoint Not applicable (tool command) ### Parameters None ``` -------------------------------- ### Reloading Kubernetes MCP Server Configuration Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md Demonstrates how to reload the server's configuration at runtime by sending a SIGHUP signal. This requires the server to be started with configuration file flags. It includes finding the process ID and sending the signal. ```bash # Find the process ID ps aux | grep kubernetes-mcp-server # Send SIGHUP to reload configuration kill -HUP # Or use pkill pkill -HUP kubernetes-mcp-server ``` -------------------------------- ### Run Kubernetes MCP Server with npx Source: https://github.com/containers/kubernetes-mcp-server/blob/main/README.md Execute the Kubernetes MCP server using npx, assuming npm and node are installed. ```shell # Run the Kubernetes MCP server using npx (in case you have npm and node installed) npx kubernetes-mcp-server@latest --help ``` -------------------------------- ### Run Kubernetes MCP Server with npx Source: https://github.com/containers/kubernetes-mcp-server/blob/main/python/README.md Execute the Kubernetes MCP server using npx, assuming npm and node are installed. ```shell npx kubernetes-mcp-server@latest --help ``` -------------------------------- ### Check OpenTelemetry Sampler Settings Source: https://github.com/containers/kubernetes-mcp-server/blob/main/docs/OTEL.md Verify the configured trace sampler and its arguments. Ensure sampling is not set to 0% or 'always_off'. ```bash echo $OTEL_TRACES_SAMPLER echo $OTEL_TRACES_SAMPLER_ARG ``` -------------------------------- ### View All Makefile Targets Source: https://github.com/containers/kubernetes-mcp-server/blob/main/CLAUDE.md Displays a list of all available Makefile targets along with their descriptions. ```bash make help ```