Skip to main content

MCP server for Kubernetes command execution, node inspection, and diagnostics

Project description

K8s MCP Server

MCP server for Kubernetes command execution, node inspection, and node-level diagnostics. Extension of k8s-mcp-server by alexei-led.

Features

  • validated wrappers around kubectl, helm, istioctl, and argocd
  • node-aware kubeconfig selection through K8S_NODE_PREFIX_MAPPING
  • run_checkup_on_node for kubectl node-shell ... checkup -n
  • get_logs_on_node for collecting dmesg, journalctl, /var/log/*, and /var/crash
  • Kubernetes node inspection tools for status, labels, pods, and resources

Configuration

Set K8S_NODE_PREFIX_MAPPING to a JSON object that maps a node prefix to a kubeconfig file name:

{
  "node-a": "cluster-a.config",
  "edge": "edge-cluster.config"
}

The kubeconfig files are resolved relative to K8S_KUBECONFIG_DIR, which defaults to ~/.kube.

Example MCP Client Configuration

When installing from PyPI, you can use the package-matched command name k8s-mcp-extension. The legacy k8s-mcp-server command remains available for backward compatibility.

{
  "mcpServers": {
    "k8s-server": {
      "command": "k8s-mcp-extension",
      "cwd": "/absolute/path/to/project",
      "env": {
        "K8S_KUBECONFIG_DIR": "/path/to/.kube",
        "K8S_NODE_PREFIX_MAPPING": "{\"node-a\": \"cluster-a.config\", \"edge\": \"edge-cluster.config\"}",
        "K8S_MCP_TIMEOUT": "600"
      }
    }
  }
}

Development

Create the environment and run checks:

uv sync --extra dev
.venv/bin/python -m pytest
.venv/bin/python -m ruff check

Run the server locally:

.venv/bin/python -m k8s_mcp_server

After installing the package, either console script works:

k8s-mcp-extension
k8s-mcp-server

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

k8s_mcp_extension-0.1.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

k8s_mcp_extension-0.1.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file k8s_mcp_extension-0.1.1.tar.gz.

File metadata

  • Download URL: k8s_mcp_extension-0.1.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for k8s_mcp_extension-0.1.1.tar.gz
Algorithm Hash digest
SHA256 09129c3be5d9f947ebed5282df6a155f2a7daef7c90f3a317c8abe8b888493fb
MD5 d012cac0cb6d0129a5f84957f95d0bdd
BLAKE2b-256 4622c6ab2fc6d3e9fe0e469cb841f92fa397a935ba47c398f8f99c16a9947331

See more details on using hashes here.

Provenance

The following attestation bundles were made for k8s_mcp_extension-0.1.1.tar.gz:

Publisher: publish-pypi.yml on CzSadykov/k8s_mcp_extension

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

File details

Details for the file k8s_mcp_extension-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for k8s_mcp_extension-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16694a6f072f982e7b231559c8bfefa9eabafdab72537fdbf138dc2e7a2ce0b3
MD5 1df24c8b72d882eede1835f9c1b62824
BLAKE2b-256 449d72259f964fd64d77beaad9c4f949806ee53874979c999f47ca0e8bc974c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for k8s_mcp_extension-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on CzSadykov/k8s_mcp_extension

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