npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

kubemcp

v1.2.0

Published

MCP server for managing MicroK8s clusters via Cursor IDE

Downloads

162

Readme

KubeMCP - Kubernetes MCP Server for Cursor/VSCode IDE

A Model Context Protocol (MCP) server for managing Kubernetes clusters directly from Cursor IDE. Manage deployments, pods, services, logs, metrics, and more through AI-powered conversations.

Features

  • Full K8s Management: Deployments, Pods, Services, ConfigMaps, Secrets, Namespaces
  • Advanced Logging: Severity filtering, time-based queries, log summarization
  • Real-time Metrics: CPU/memory usage for pods, nodes, and deployments
  • Event Monitoring: Track cluster events and troubleshoot issues
  • Token Optimization: TOON format support for 50-60% token reduction
  • Flexible Config: Local kubeconfig or dynamic Multipass VM support

Quick Start

Installation

# Use with npx (no installation)
npx kubemcp

# Or install globally
npm install -g kubemcp

Cursor IDE Setup

Add to your Cursor MCP settings (Settings → Features → MCP):

Using npx (recommended):

{
  "mcpServers": {
    "kubemcp": {
      "command": "npx",
      "args": ["-y", "kubemcp"],
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "local"
      }
    }
  }
}

Using global install:

{
  "mcpServers": {
    "kubemcp": {
      "command": "kubemcp",
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "local"
      }
    }
  }
}

For Multipass/VM mode:

{
  "mcpServers": {
    "kubemcp": {
      "command": "npx",
      "args": ["-y", "kubemcp"],
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "multipass",
        "KUBEMCP_VM_NAME": "microk8s-vm"
      }
    }
  }
}

For Custom Kubeconfig Path (Network/Remote):

{
  "mcpServers": {
    "kubemcp": {
      "command": "npx",
      "args": ["-y", "kubemcp"],
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "custom",
        "KUBEMCP_KUBECONFIG_PATH": "/path/to/custom/kubeconfig"
      }
    }
  }
}

Windows Network Path Example:

{
  "mcpServers": {
    "kubemcp": {
      "command": "npx",
      "args": ["-y", "kubemcp"],
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "custom",
        "KUBEMCP_KUBECONFIG_PATH": "\\\\server\\share\\kubeconfig"
      }
    }
  }
}

Configuration

Environment Variables

| Variable | Default | Description | |----------|---------|-------------| | KUBEMCP_CONFIG_SOURCE | local | Kubeconfig source: local, multipass, or custom | | KUBEMCP_KUBECONFIG_PATH | - | Custom kubeconfig path (required if configSource=custom) | | KUBEMCP_VM_NAME | microk8s-vm | VM name for multipass mode | | KUBEMCP_DEFAULT_NAMESPACE | default | Default namespace | | KUBEMCP_RESPONSE_FORMAT | auto | Response format: auto, json, or toon | | KUBEMCP_LOG_MAX_LINES | 100 | Max log lines per request | | KUBEMCP_LOG_DEFAULT_SEVERITY | INFO | Default log severity filter |

Kubeconfig Modes

Local Mode: Uses ~/.kube/config

KUBEMCP_CONFIG_SOURCE=local

Multipass Mode: Fetches from MicroK8s VM dynamically

KUBEMCP_CONFIG_SOURCE=multipass
KUBEMCP_VM_NAME=microk8s-vm

Custom Path Mode: Use custom kubeconfig from any location (network, remote, etc.)

KUBEMCP_CONFIG_SOURCE=custom
KUBEMCP_KUBECONFIG_PATH=/path/to/kubeconfig

Examples of Custom Paths:

  • Linux/Mac: /mnt/network-share/kubeconfig
  • Windows UNC: \\server\share\kubeconfig
  • Windows Mapped Drive: Z:\configs\kubeconfig
  • Remote config: /remote/cluster/config

Available Tools

Deployments

  • k8s_list_deployments - List all deployments
  • k8s_get_deployment - Get deployment details
  • k8s_scale_deployment - Scale deployment replicas
  • k8s_restart_deployment - Rolling restart
  • k8s_get_deployment_status - Check rollout status

Pods

  • k8s_list_pods - List pods (supports label selectors)
  • k8s_get_pod - Get pod details
  • k8s_delete_pod - Delete pod
  • k8s_get_pod_logs - Get logs with filtering
  • k8s_get_pod_status - Get pod status
  • k8s_summarize_pod_logs - Log summary (90% token reduction)

Services

  • k8s_list_services - List services
  • k8s_get_service - Get service details
  • k8s_get_service_endpoints - Get endpoints

ConfigMaps & Secrets

  • k8s_list_configmaps / k8s_list_secrets
  • k8s_get_configmap / k8s_get_secret
  • k8s_create_configmap / k8s_create_secret
  • k8s_update_configmap / k8s_update_secret
  • k8s_delete_configmap / k8s_delete_secret

Namespaces

  • k8s_list_namespaces - List all namespaces
  • k8s_get_namespace - Get namespace details
  • k8s_create_namespace - Create namespace
  • k8s_delete_namespace - Delete namespace

Metrics

  • k8s_get_pod_metrics - Pod CPU/memory usage
  • k8s_get_node_metrics - Node resource usage
  • k8s_get_deployment_metrics - Deployment aggregated metrics

Events

  • k8s_get_events - Get cluster events
  • k8s_get_resource_events - Events for specific resource
  • k8s_get_recent_events - Recent events by timestamp

Token Optimization

TOON Format

Automatically uses TOON for 50-60% token reduction on list operations.

Log Filtering

Reduce log tokens by 80-95%:

  • Severity filtering: severityFilter: "ERROR"
  • Time filtering: sinceSeconds: 3600
  • Pattern matching: grep: "error|timeout"
  • Size limits: tail: 100, maxBytes: 50000

Log Summarization

Use k8s_summarize_pod_logs for 90%+ token reduction - get error counts, patterns, and samples without fetching full logs.

Troubleshooting

Cannot connect to cluster:

  • Local: Verify ~/.kube/config exists
  • Multipass: Check multipass list and VM name

Metrics not available:

multipass exec <vm-name> -- sudo microk8s enable metrics-server

Development

git clone https://github.com/icy-r/kubemcp.git
cd kubemcp
pnpm install
pnpm run build
pnpm start

Scripts

  • pnpm run dev - Development with auto-reload
  • pnpm run build - Build TypeScript
  • pnpm test - Run tests
  • pnpm run lint - Lint code
  • pnpm run audit - Run security audit
  • pnpm run security:check - Full security check (audit + outdated packages)

Security

Automated Security Monitoring

This project implements multiple layers of security protection:

  1. GitHub Dependabot - Automatically creates PRs for security updates weekly
  2. GitHub Actions - Runs security audits on every push and weekly scheduled scans
  3. Pre-commit Hooks - Blocks commits with high/critical vulnerabilities
  4. Manual Audits - Run pnpm run audit anytime to check for vulnerabilities

Security Best Practices

  • Dependencies are regularly audited for known vulnerabilities
  • Lockfile (pnpm-lock.yaml) is committed to ensure consistent builds
  • Security updates are reviewed and applied promptly
  • Only essential dependencies are included to minimize attack surface

Reporting Security Issues

If you discover a security vulnerability, please email the maintainer directly rather than opening a public issue.

Requirements

  • Node.js >= 18.0.0
  • kubectl configured (local mode)
  • Multipass + MicroK8s (VM mode)

License

MIT


Report Issues | NPM Package