# StacklokLabs/mkp [Health: Active]

**Category:** ☁️ Cloud Platforms  
**Repository:** https://github.com/StacklokLabs/mkp  
**GitHub Stars:** 59  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/stackloklabs-mkp

## Description
MKP is a Model Context Protocol (MCP) server for Kubernetes that allows LLM-powered applications to interact with Kubernetes clusters. It provides tools for listing and applying Kubernetes resources through the MCP protocol.

## Tools
Capabilities this server exposes over MCP:

- **group** — API group (e.g., apps, networking.k8s.io)
- **namespace** — Namespace (required for namespaced resources)
- **subresource** — Subresource to get (e.g., status, scale, logs)
- **parameters** — Optional parameters for the request (see examples below)
- **container** — Specify which container to get logs from
- **previous** — Get logs from previous container instance (true/false)
- **sinceSeconds** — Only return logs newer than a relative duration in seconds
- **sinceTime** — Only return logs after a specific time (RFC3339 format)
- **timestamps** — Include timestamps on each line (true/false)
- **limitBytes** — Maximum number of bytes to return
- **tailLines** — Number of lines to return from the end of the logs
- **resourceVersion** — When specified, shows the resource at that particular
- **label_selector** — Kubernetes label selector for filtering resources (optional)
- **include_annotations** — Whether to include annotations in the output (default:
- **exclude_annotation_keys** — List of annotation keys to exclude from output
- **include_annotation_keys** — List of annotation keys to include in output (if

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/StacklokLabs/mkp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/StacklokLabs/mkp.git
```

2. Run:

```sh
cd mkp
```

3. Install:

```sh
task install
```

4. Install:

```sh
task build
```

5. Start the server:

```sh
task run
```

6. Start the server:

```sh
KUBECONFIG=/path/to/kubeconfig task run-with-kubeconfig
```

## Documentation

## What StacklokLabs/mkp does

StacklokLabs/mkp gives MCP clients an interface to Kubernetes clusters. Agents can discover resource types supported by the API server, inspect individual objects, list resources, apply new or changed objects, and retrieve subresources such as status, scale, and pod logs. It also supports executing commands in pods with timeout control.

Operations cover both cluster-scoped and namespaced resources. Resource requests identify the API group, version, resource name, and, where applicable, namespace and object name. The implementation uses Kubernetes' unstructured client, allowing it to work with standard resources and Custom Resource Definitions without adding resource-specific handlers.

## How it works

MKP communicates directly with the Kubernetes API server through Kubernetes API machinery. It does not depend on kubectl, Helm, or another command-line client. MCP tools translate requests into Kubernetes resource operations and return the results to the calling application.

Resource listings can use Kubernetes label selectors. Output metadata can be controlled with annotation options: annotations may be disabled, limited to selected keys, or filtered with exclusion patterns. The default behavior excludes the `kubectl.kubernetes.io/last-applied-configuration` annotation, and trailing wildcard patterns such as `nvidia.com/*` can exclude groups of keys.

Pod log requests accept options for container selection, previous instances, relative or absolute time ranges, timestamps, byte limits, and tail-line limits. Logs default to the last 100 lines and 32 KB to reduce context size; request parameters can override those limits. Built-in rate limiting helps restrict excessive API calls.

## Setup and configuration

The project requires Go 1.24 or later, access to a Kubernetes cluster, and Task for its repository commands. A typical local setup clones the repository, runs `task install`, and builds with `task build`. `task run` starts the server using the default configuration.

Kubernetes configuration is selected in this order:

1. The `--kubeconfig` command-line flag
2. An in-cluster service account when running in Kubernetes
3. Files listed by `KUBECONFIG`
4. `~/.kube/config`

`KUBECONFIG=/path/to/kubeconfig task run-with-kubeconfig` runs with a specified kubeconfig. `MCP_PORT=9091 task run` selects a listening port. MKP can also be deployed through ToolHive, including its UI, CLI, or Kubernetes operator.

If no Kubernetes configuration is available, the process can still advertise its tools, but calls fail until it is restarted with valid configuration. A missing or invalid explicitly selected kubeconfig causes startup failure.

## Tools and capabilities

- `get_resource` retrieves clustered or namespaced resources and subresources, including status, scale, and logs.
- `list_resources` lists resources with optional namespace, label-selector, and annotation filtering.
- `apply_resource` creates or updates clustered and namespaced resources.
- Pod command execution supports timeout control.
- Resource handling works with arbitrary Kubernetes types through unstructured objects, including CRDs.
- Rate limiting provides protection against excessive API calls.

## Limitations and notes

Operations depend on the Kubernetes identity and permissions used by the server. Requests for namespaced resources require a namespace, while cluster-scoped requests use the clustered resource type. Agents should account for the default pod-log limits and explicitly provide log parameters when they need more output. Applying resources changes cluster state, so deployment permissions and tool access should be assigned accordingly.

_Full upstream README: https://allmcps.com/mcp/stackloklabs-mkp/readme_

