SuperAPI AI Directory

mkp

MKP is a Model Context Protocol (MCP) server for Kubernetes, developed by StacklokLabs. It enables LLM-driven applications to interact directly with Kubernetes clusters, providing tools via the MCP protocol such as listing and getting resources, creating and updating, deleting, and executing commands in Pods, without relying on external CLIs such as kubectl and helm. MKP is implemented in Go, calls the Kubernetes API directly, supports any resource type and CRDs, has built-in rate limiting, defaults to read-only, and can enable write operations via --read-write.

Open website

About this tool

Purpose

MKP is a Model Context Protocol (MCP) server for Kubernetes, used to enable LLM-driven applications to interact with Kubernetes clusters. It exposes tools for operating Kubernetes resources via the MCP protocol, enabling AI applications to list, get, create, or update resources within a controlled scope, and to execute commands in Pods.

Main Capabilities

  • List the resources supported by the Kubernetes API server, including cluster-scoped resources and namespace-scoped resources.
  • Get resources and their subresources (including status, scale, logs, etc.).
  • Apply (create or update) cluster-scoped resources and namespace-scoped resources.
  • Execute commands in Pods, with timeout control support.
  • Implement generic, pluggable resource operations based on the API Machinery unstructured client, without hardcoding resource schemas, and automatically support custom resource definitions (CRDs).
  • Built-in rate limiting to prevent excessive API calls.
  • Provide MCP resource access, with URI formats: cluster-scoped resources k8s://clustered/{group}/{version}/{resource}/{name}; namespace-scoped resources k8s://namespaced/{namespace}/{group}/{version}/{resource}/{name}.

Tool Descriptions

MKP provides the following MCP tools:

  • get_resource: Get a Kubernetes resource or its subresource. Required parameters include resource_type, version, resource, name; optional parameters include group, namespace, subresource, parameters. For Pod logs, parameters such as container, previous, sinceSeconds, sinceTime, timestamps, limitBytes, tailLines are supported; by default only the last 100 lines are returned and no more than 32KB, which can be overridden via parameters. Regular resources support the resourceVersion parameter.
  • list_resources: List the specified type of Kubernetes resources. Required parameter resource_type; optional parameters include label_selector, include_annotations (default true), exclude_annotation_keys, include_annotation_keys. Annotation filtering is supported; by default kubectl.kubernetes.io/last-applied-configuration is excluded; exclude_annotation_keys supports a trailing wildcard *; when include_annotation_keys is specified, only those annotations are included; setting include_annotations to false completely removes annotations.
  • apply_resource: Apply (create or update) a Kubernetes resource. Required parameters resource_type, manifest.
  • post_resource: Send a POST request to a Kubernetes resource or its subresource, especially suitable for executing commands in Pods. Required parameters resource_type, name, body; optional parameters subresource, parameters. For Pod exec, body supports command (required, string or string array), container (optional, defaults to the first container), timeout (optional, default 15 seconds, maximum 60 seconds). Timed-out commands are terminated and a timeout error is returned; the response includes stdout, stderr, and error information.
  • delete_resource: The detailed parameters of this tool are not separately listed in the materials, but it is mentioned in the rate limiting description.

Usage

Prerequisites: Go 1.24 or later; a Kubernetes cluster and kubeconfig; Task for running tasks.

Build steps:

  1. Clone the repository: git clone https://github.com/StacklokLabs/mkp.git && cd mkp
  2. Install dependencies: task install
  3. Build the server: task build

When running the server, you can use the default kubeconfig, specify a kubeconfig, or specify a port (the available materials do not provide a complete example of the specific command).

MKP can also be run as an MCP server through ToolHive, which simplifies the deployment and management of MCP servers; for specific setup, refer to the UI, CLI, or Kubernetes operator instructions in the ToolHive documentation.

Transport protocols: supports Streamable HTTP (default, suitable for most scenarios) and SSE (legacy transport protocol, mainly used for compatibility with older clients). It can be configured through CLI flags or environment variables; when running MKP in a ToolHive environment, the MCP_TRANSPORT environment variable is set automatically by ToolHive.

By default, MKP exposes all Kubernetes resources as MCP resources, providing context for the LLM; in large clusters this may consume a large amount of context space, and resource discovery can be disabled with the --serve-resources flag. Even if resource discovery is disabled, MCP tools can still be used normally.

By default, it runs in read-only mode and does not allow write operations; the apply_resource, delete_resource, and post_resource tools are unavailable; write operations can be enabled with the --read-write flag.

Rate limiting: built-in token bucket algorithm, with limits differentiated by operation type - read operations (list_resources, get_resource) 120 times per minute; write operations (apply_resource, delete_resource) 30 times per minute; other operations default to 60 times per minute. Rate limiting is applied per client session and can be enabled or disabled through command-line flags, and can also be customized through environment variables: MKP_RATE_LIMIT_DEFAULT (default 60), MKP_RATE_LIMIT_READ (default 120), MKP_RATE_LIMIT_WRITE (default 30).

Applicable scenarios

  • Scenarios where an LLM application needs to safely and controllably read Kubernetes cluster resource information.
  • Scenarios where it is necessary in an AI workflow toview Pod logs and execute commands within a Pod (with timeout control).
  • Scenarios where it is necessary in a large cluster to filter annotation output to avoid LLM context overflow.
  • Scenarios where it is necessary to provide cluster context to an LLM through MCP resources, or where compatibility with older MCP clients is needed.

Limitations

  • Read-only by default; write operations require explicitly enabling --read-write.
  • Pod exec command timeout is a maximum of 60 seconds, and it will be terminated on timeout.
  • By default, Pod logs return only the last 100 lines and no more than 32KB.
  • Rate limiting takes effect per client session, and calls exceeding the limit will be throttled.
  • In large clusters, providing all resources as MCP resources by default may consume a large amount of LLM context, and resource discovery needs to be disabled manually.
  • The materials do not provide specific installation packages, pricing plans, prices, platform support scope, or usage performance data.

License and Contributions

Licensed under Apache v2. Contributions are welcome; see the CONTRIBUTING guide. For problems or feature requests, you can submit an issue in the repository or join the #mcp-servers channel in the community Discord.