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.3.tar.gz (22.1 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.3-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kube_lint_mcp-0.3.3.tar.gz
  • Upload date:
  • Size: 22.1 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.3.tar.gz
Algorithm Hash digest
SHA256 703fccae797adc287404a72165794611b39246156af8f87abfc2c2b4948126e5
MD5 7e635ff8a5f0c9c5c9d8235b6363f4c5
BLAKE2b-256 80e824be5b1141db7cc3a4514cc891cfa8644bac30f8c904c37e5879726ad3b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kube_lint_mcp-0.3.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: kube_lint_mcp-0.3.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d6610f21c456e83c927268b0b66d00d34b34ebca50ec25aaed2a1d3de7c1e94e
MD5 49dd4ce2771229e1baf75d143aaa013c
BLAKE2b-256 5695102b5514e1c8a907a75e3200926c513336fb0faca5611118eeea3b6b78fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for kube_lint_mcp-0.3.3-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