Skip to content

AI / Copilot Chat (MCP)

KubeGlass includes a built-in Model Context Protocol (MCP) server that exposes 95 Kubernetes tools to AI assistants. Instead of remembering kubectl flags or navigating dashboards, just ask a question in natural language.

The MCP server runs as a lightweight sidecar process (kubeglass mcp) that communicates over stdio and connects to a running KubeGlass instance via its REST API. No API keys, no cloud services, no data leaves your machine.

  • “What’s wrong with my cluster?”
  • “Show me pods that are crash-looping in production”
  • “Who has admin access in the default namespace?”
  • “Are there any expired certificates?”
  • “What are the most expensive namespaces?”
  • “Compare drift between staging and production”
  • “List all Helm releases that need upgrading”
  • KubeGlass installed (Installation guide)
  • VS Code with GitHub Copilot (or another MCP client)
Terminal window
kubeglass

KubeGlass will start on http://localhost:8090 and connect to your current kubeconfig context.

Create a .vscode/mcp.json file in your project root:

{
"servers": {
"kubeglass": {
"type": "stdio",
"command": "kubeglass",
"args": ["mcp"]
}
}
}

That’s it. VS Code will automatically detect the config and start the MCP server.

Open Copilot Chat in VS Code and ask any Kubernetes question. KubeGlass tools are automatically available - no special syntax needed.

The MCP server exposes 95 tools organized across these categories:

CategoryToolsExamples
Diagnostics6cluster_health, diagnose_workload, health_scan
Events & Logs2get_events, get_pod_logs
Resources6list_resources, get_resource, search_resources
Cluster Info4get_cluster_info, get_dashboard_summary
Dependencies3get_resource_dependencies, resolve_lineage
Nodes & Metrics7list_nodes, top_pods, get_cluster_metrics
Cost & Sizing3get_cost_estimation, get_rightsizing
Prometheus3query_prometheus, get_promql_presets
RBAC & Auth7rbac_who_can, rbac_access_matrix, authz_can_i
Security5get_vulnerabilities, get_certificates
Compliance5get_compliance_report, get_audit_events
Networking6list_services, list_ingresses, get_mesh_traffic
Storage4list_pvs, list_pvcs, list_storage_classes
Helm4list_helm_releases, get_helm_values
GitOps4list_gitops_apps, get_gitops_diff
Alerts & Drift6list_alerts, get_drift_results, trigger_drift_scan
Cloud5list_cloud_providers, get_cloud_cost
Apps5list_applications, get_app_topology

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
"mcpServers": {
"kubeglass": {
"command": "kubeglass",
"args": ["mcp"]
}
}
}

The MCP server uses stdio transport (stdin/stdout JSON-RPC). Any client that supports the MCP protocol can connect:

Terminal window
kubeglass mcp

If KubeGlass runs on a non-default address:

Terminal window
# Via flag
kubeglass mcp --url http://my-host:9090
# Via environment variable
KUBEGLASS_URL=http://my-host:9090 kubeglass mcp

In .vscode/mcp.json:

{
"servers": {
"kubeglass": {
"type": "stdio",
"command": "kubeglass",
"args": ["mcp", "--url", "http://my-host:9090"]
}
}
}

You can also set the URL via an environment variable in the MCP config:

{
"servers": {
"kubeglass": {
"type": "stdio",
"command": "kubeglass",
"args": ["mcp"],
"env": {
"KUBEGLASS_URL": "http://my-host:9090"
}
}
}
}

When developing KubeGlass itself, use go run instead of the installed binary:

{
"servers": {
"kubeglass": {
"type": "stdio",
"command": "go",
"args": ["run", "./cmd/kubeglass", "mcp"]
}
}
}
┌─────────────────┐ stdio ┌──────────────┐ HTTP ┌───────────────┐
│ VS Code │◄──────────────►│ kubeglass │◄────────────►│ KubeGlass │
│ Copilot Chat │ JSON-RPC │ mcp │ REST API │ Server │
└─────────────────┘ └──────────────┘ └───────┬───────┘
Watch / Exec
┌───────▼───────┐
│ Kubernetes │
│ API Server │
└───────────────┘

The MCP server is a thin adapter - it translates MCP tool calls into KubeGlass REST API requests. All the heavy lifting (API discovery, caching, WebSocket streams, RBAC enforcement) happens in the KubeGlass server.

The MCP server checks connectivity on startup. If you see this warning, ensure KubeGlass is running:

Terminal window
kubeglass
# Wait for "KubeGlass is ready" on http://localhost:8090

The MCP server will still start - individual tool calls will fail with descriptive errors until KubeGlass is reachable.

  1. Verify .vscode/mcp.json exists in your project root
  2. Open VS Code’s Output panel → select “MCP” from the dropdown
  3. Check for error messages (binary not found, connection refused, etc.)
  4. Reload VS Code window: Cmd+Shift+P → “Developer: Reload Window"

Ensure the binary is in your PATH:

Terminal window
# Homebrew
brew install kubeglass/tap/kubeglass
# Go install
go install github.com/kubeglass/kubeglass/cmd/kubeglass@latest
# From source
make build
export PATH=$PWD/bin:$PATH

If KubeGlass runs in Docker, the MCP server needs to reach it via the host network:

Terminal window
kubeglass mcp --url http://localhost:8090

If using Docker Desktop, localhost should work. On Linux, you may need the container’s IP or --network host.