Skip to main content

MCP server for Kubernetes manifest and Helm chart validation

Project description

kube-lint-mcp

CI codecov PyPI Docker Python 3.12+ License: MIT MCP

MCP server that validates Kubernetes manifests and Helm charts with kubectl dry-run before you commit — preventing deployment and GitOps reconciliation failures.

Works with Claude Code, Claude Desktop, and any MCP-compatible client.

How it works

You: "Validate the flux manifests in ./k8s/infrastructure/"

Claude: calls list_kube_contexts → presents list → you confirm "staging"
        calls select_kube_context → flux_dryrun

  FluxCD Dry-Run Validation
  Context: staging
  ================================================
  File: infrastructure/redis.yaml
    Client dry-run: PASS
    Server dry-run: PASS

  File: infrastructure/postgres.yaml
    Client dry-run: PASS
    Server dry-run: FAIL
      Error: namespace "db" not found
  ================================================
  Summary: 1 passed, 1 failed

  DO NOT COMMIT - Fix errors first!

No flags, no CLI args — the AI agent picks the right tool automatically.

Prerequisites

  • Python 3.12+
  • kubectl configured with cluster access
  • helm (for Helm chart validation)
  • flux (for Flux operations)

Installation

pip (requires CLI tools installed separately)

pip install kube-lint-mcp

Docker (batteries included)

The Docker image ships with kubectl, helm, flux, and kubeconform — no local installs needed.

docker pull ghcr.io/sophotechlabs/kube-lint-mcp:latest

Note: If your kubeconfig uses external auth plugins (e.g. gke-gcloud-auth-plugin, aws-iam-authenticator), those binaries are not included in the image. Use the pip install method for those clusters, or embed tokens directly in your kubeconfig.

Configuration

Claude Code (pip)

Add to your project's .mcp.json:

{
  "mcpServers": {
    "kube-lint": {
      "command": "python",
      "args": ["-m", "kube_lint_mcp"]
    }
  }
}

Claude Code (Docker)

{
  "mcpServers": {
    "kube-lint": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-v", "${HOME}:${HOME}:ro",
        "-e", "KUBECONFIG=${HOME}/.kube/config",
        "ghcr.io/sophotechlabs/kube-lint-mcp:latest"
      ]
    }
  }
}

The $HOME:$HOME:ro mount preserves absolute paths that MCP clients send to the server. The read-only flag ensures the container cannot modify your files.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%/Claude/claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "kube-lint": {
      "command": "python",
      "args": ["-m", "kube_lint_mcp"]
    }
  }
}

Tools

Tool Description
select_kube_context Pick a cluster context (held in memory, no kubeconfig mutation). Call first.
list_kube_contexts Show available kubectl contexts and which is selected
flux_dryrun Validate FluxCD YAML with client + server dry-run
kustomize_dryrun Build and dry-run a Kustomize overlay end-to-end
helm_dryrun Lint, render, and dry-run a Helm chart end-to-end
flux_check Verify Flux installation health
flux_status Show Flux reconciliation status across namespaces

Workflow

  1. list_kube_contexts — see available clusters
  2. select_kube_context — target a cluster (in-memory only, never mutates kubeconfig)
  3. flux_dryrun, kustomize_dryrun, or helm_dryrun — validate before committing
  4. Only commit when all checks pass

Safety

The server never mutates your kubeconfig. Context is held in memory and passed via --context flag on every subprocess call. This is a deliberate safety choice for agentic use — the AI cannot accidentally switch your global kubectl context.

Development

pip install -e ".[dev]"
make test    # 126 tests, 100% coverage
make lint    # flake8

Contributing

  1. Fork the repo
  2. Create a feature branch
  3. Make sure make test and make lint pass
  4. Open a PR

License

MIT


If this tool saves you from a bad deploy, consider sponsoring.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kube_lint_mcp-0.3.7.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kube_lint_mcp-0.3.7-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file kube_lint_mcp-0.3.7.tar.gz.

File metadata

  • Download URL: kube_lint_mcp-0.3.7.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kube_lint_mcp-0.3.7.tar.gz
Algorithm Hash digest
SHA256 19f8c73c8641e74dc896d5b23b33d0b43667e8e2acafc462eba2749f6d70b191
MD5 07b9a164e1f963f5e2ab854f474f77c5
BLAKE2b-256 3934b5fd86244aaaa1c785749d9556684bd095345adfdda93c50cd03748ed70a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kube_lint_mcp-0.3.7.tar.gz:

Publisher: release-on-merge.yml on sophotechlabs/kube-lint-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kube_lint_mcp-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: kube_lint_mcp-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kube_lint_mcp-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 02ee35b0b089eeba229ca57390c26a1a15932a84603a5aa8d692a9a21cee11b3
MD5 b4039530c620bb992d780b40b3c26735
BLAKE2b-256 3aaa2aa8ce03335b92934eb7432874da961e8a989ae038cd437b814b02afc96a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kube_lint_mcp-0.3.7-py3-none-any.whl:

Publisher: release-on-merge.yml on sophotechlabs/kube-lint-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page