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

Uploaded Python 3

File details

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

File metadata

  • Download URL: kube_lint_mcp-0.3.5.tar.gz
  • Upload date:
  • Size: 23.6 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.5.tar.gz
Algorithm Hash digest
SHA256 63c1857b326c4b66b20885ca1bd58c4b7b81d1cf42d86bef0284980b2fa65b42
MD5 5ae995e11f64f0ebac9e29af454ef5c8
BLAKE2b-256 73bb37a4680de6505f90d2e65658488a194d64df1c748a86fb26dbae12dd22fd

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kube_lint_mcp-0.3.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 68d904913f040fc5d9fa2e08e57856aca9717ae5e179ec6c5983946ef753eb9c
MD5 34995d8a0b3cab79e355afc77d5e0dce
BLAKE2b-256 1e9f571daedac5ee7d6203b5d89d28a2e72aeccd8fe20b81ae15158ae3e948e1

See more details on using hashes here.

Provenance

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