AI / Copilot Chat (MCP)
Overview
Section titled “Overview”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 you can ask
Section titled “What you can ask”- “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”
Quick start
Section titled “Quick start”Prerequisites
Section titled “Prerequisites”- KubeGlass installed (Installation guide)
- VS Code with GitHub Copilot (or another MCP client)
Step 1: Start KubeGlass
Section titled “Step 1: Start KubeGlass”kubeglassKubeGlass will start on http://localhost:8090 and connect to your current kubeconfig context.
Step 2: Add MCP config
Section titled “Step 2: Add MCP config”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.
Step 3: Start chatting
Section titled “Step 3: Start chatting”Open Copilot Chat in VS Code and ask any Kubernetes question. KubeGlass tools are automatically available - no special syntax needed.
Tool categories
Section titled “Tool categories”The MCP server exposes 95 tools organized across these categories:
| Category | Tools | Examples |
|---|---|---|
| Diagnostics | 6 | cluster_health, diagnose_workload, health_scan |
| Events & Logs | 2 | get_events, get_pod_logs |
| Resources | 6 | list_resources, get_resource, search_resources |
| Cluster Info | 4 | get_cluster_info, get_dashboard_summary |
| Dependencies | 3 | get_resource_dependencies, resolve_lineage |
| Nodes & Metrics | 7 | list_nodes, top_pods, get_cluster_metrics |
| Cost & Sizing | 3 | get_cost_estimation, get_rightsizing |
| Prometheus | 3 | query_prometheus, get_promql_presets |
| RBAC & Auth | 7 | rbac_who_can, rbac_access_matrix, authz_can_i |
| Security | 5 | get_vulnerabilities, get_certificates |
| Compliance | 5 | get_compliance_report, get_audit_events |
| Networking | 6 | list_services, list_ingresses, get_mesh_traffic |
| Storage | 4 | list_pvs, list_pvcs, list_storage_classes |
| Helm | 4 | list_helm_releases, get_helm_values |
| GitOps | 4 | list_gitops_apps, get_gitops_diff |
| Alerts & Drift | 6 | list_alerts, get_drift_results, trigger_drift_scan |
| Cloud | 5 | list_cloud_providers, get_cloud_cost |
| Apps | 5 | list_applications, get_app_topology |
Other MCP clients
Section titled “Other MCP clients”Claude Desktop
Section titled “Claude Desktop”Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{ "mcpServers": { "kubeglass": { "command": "kubeglass", "args": ["mcp"] } }}Any MCP client
Section titled “Any MCP client”The MCP server uses stdio transport (stdin/stdout JSON-RPC). Any client that supports the MCP protocol can connect:
kubeglass mcpConfiguration
Section titled “Configuration”Custom KubeGlass URL
Section titled “Custom KubeGlass URL”If KubeGlass runs on a non-default address:
# Via flagkubeglass mcp --url http://my-host:9090
# Via environment variableKUBEGLASS_URL=http://my-host:9090 kubeglass mcpIn .vscode/mcp.json:
{ "servers": { "kubeglass": { "type": "stdio", "command": "kubeglass", "args": ["mcp", "--url", "http://my-host:9090"] } }}Environment variable
Section titled “Environment variable”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" } } }}Development mode
Section titled “Development mode”When developing KubeGlass itself, use go run instead of the installed binary:
{ "servers": { "kubeglass": { "type": "stdio", "command": "go", "args": ["run", "./cmd/kubeglass", "mcp"] } }}Architecture
Section titled “Architecture”┌─────────────────┐ 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.
Troubleshooting
Section titled “Troubleshooting””Cannot reach KubeGlass” warning
Section titled “”Cannot reach KubeGlass” warning”The MCP server checks connectivity on startup. If you see this warning, ensure KubeGlass is running:
kubeglass# Wait for "KubeGlass is ready" on http://localhost:8090The MCP server will still start - individual tool calls will fail with descriptive errors until KubeGlass is reachable.
Tools not appearing in Copilot Chat
Section titled “Tools not appearing in Copilot Chat”- Verify
.vscode/mcp.jsonexists in your project root - Open VS Code’s Output panel → select “MCP” from the dropdown
- Check for error messages (binary not found, connection refused, etc.)
- Reload VS Code window:
Cmd+Shift+P→ “Developer: Reload Window"
"kubeglass: command not found”
Section titled “"kubeglass: command not found””Ensure the binary is in your PATH:
# Homebrewbrew install kubeglass/tap/kubeglass
# Go installgo install github.com/kubeglass/kubeglass/cmd/kubeglass@latest
# From sourcemake buildexport PATH=$PWD/bin:$PATHDocker users
Section titled “Docker users”If KubeGlass runs in Docker, the MCP server needs to reach it via the host network:
kubeglass mcp --url http://localhost:8090If using Docker Desktop, localhost should work. On Linux, you may need the container’s IP or --network host.