kubectl-mcp-server 1.14.0__tar.gz → 1.16.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. kubectl_mcp_server-1.16.0/PKG-INFO +1047 -0
  2. kubectl_mcp_server-1.16.0/README.md +989 -0
  3. kubectl_mcp_server-1.16.0/kubectl_mcp_server.egg-info/PKG-INFO +1047 -0
  4. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_server.egg-info/SOURCES.txt +12 -0
  5. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/__init__.py +1 -1
  6. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/crd_detector.py +247 -0
  7. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/k8s_config.py +530 -0
  8. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/mcp_server.py +27 -0
  9. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/__init__.py +20 -0
  10. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/backup.py +881 -0
  11. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/capi.py +727 -0
  12. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/certs.py +709 -0
  13. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/cilium.py +582 -0
  14. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/cluster.py +589 -0
  15. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/core.py +157 -60
  16. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/cost.py +97 -41
  17. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/deployments.py +173 -56
  18. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/diagnostics.py +40 -13
  19. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/gitops.py +552 -0
  20. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/helm.py +133 -46
  21. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/keda.py +464 -0
  22. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/kiali.py +652 -0
  23. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/kubevirt.py +803 -0
  24. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/networking.py +106 -32
  25. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/operations.py +176 -50
  26. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/pods.py +162 -50
  27. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/policy.py +554 -0
  28. kubectl_mcp_server-1.16.0/kubectl_mcp_tool/tools/rollouts.py +790 -0
  29. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/security.py +89 -36
  30. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/storage.py +35 -16
  31. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/setup.py +2 -2
  32. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_browser.py +2 -2
  33. kubectl_mcp_server-1.16.0/tests/test_ecosystem.py +331 -0
  34. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_tools.py +73 -10
  35. kubectl_mcp_server-1.14.0/PKG-INFO +0 -780
  36. kubectl_mcp_server-1.14.0/README.md +0 -722
  37. kubectl_mcp_server-1.14.0/kubectl_mcp_server.egg-info/PKG-INFO +0 -780
  38. kubectl_mcp_server-1.14.0/kubectl_mcp_tool/k8s_config.py +0 -289
  39. kubectl_mcp_server-1.14.0/kubectl_mcp_tool/tools/cluster.py +0 -315
  40. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/LICENSE +0 -0
  41. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_server.egg-info/dependency_links.txt +0 -0
  42. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_server.egg-info/entry_points.txt +0 -0
  43. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_server.egg-info/requires.txt +0 -0
  44. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_server.egg-info/top_level.txt +0 -0
  45. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/__main__.py +0 -0
  46. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/auth/__init__.py +0 -0
  47. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/auth/config.py +0 -0
  48. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/auth/scopes.py +0 -0
  49. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/auth/verifier.py +0 -0
  50. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/cli/__init__.py +0 -0
  51. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/cli/__main__.py +0 -0
  52. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/cli/cli.py +0 -0
  53. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/cli/errors.py +0 -0
  54. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/cli/output.py +0 -0
  55. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/diagnostics.py +0 -0
  56. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/prompts/__init__.py +0 -0
  57. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/prompts/prompts.py +0 -0
  58. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/resources/__init__.py +0 -0
  59. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/resources/resources.py +0 -0
  60. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/browser.py +0 -0
  61. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/tools/ui.py +0 -0
  62. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/utils/__init__.py +0 -0
  63. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/kubectl_mcp_tool/utils/helpers.py +0 -0
  64. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/setup.cfg +0 -0
  65. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/__init__.py +0 -0
  66. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/conftest.py +0 -0
  67. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_auth.py +0 -0
  68. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_cli.py +0 -0
  69. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_prompts.py +0 -0
  70. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_resources.py +0 -0
  71. {kubectl_mcp_server-1.14.0 → kubectl_mcp_server-1.16.0}/tests/test_server.py +0 -0
@@ -0,0 +1,1047 @@
1
+ Metadata-Version: 2.4
2
+ Name: kubectl-mcp-server
3
+ Version: 1.16.0
4
+ Summary: A Model Context Protocol (MCP) server for Kubernetes with 220+ tools, 8 resources, and 8 prompts
5
+ Home-page: https://github.com/rohitg00/kubectl-mcp-server
6
+ Author: Rohit Ghumare
7
+ Author-email: ghumare64@gmail.com
8
+ Project-URL: Bug Tracker, https://github.com/rohitg00/kubectl-mcp-server/issues
9
+ Project-URL: Documentation, https://github.com/rohitg00/kubectl-mcp-server#readme
10
+ Project-URL: Source, https://github.com/rohitg00/kubectl-mcp-server
11
+ Keywords: kubernetes,mcp,model-context-protocol,kubectl,helm,ai-assistant,claude,cursor,windsurf,fastmcp,devops,cloud-native,mcp-ui
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: System :: Systems Administration
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Intended Audience :: Developers
22
+ Classifier: Intended Audience :: System Administrators
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: fastmcp>=3.0.0b1
27
+ Requires-Dist: pydantic>=2.0.0
28
+ Requires-Dist: fastapi>=0.100.0
29
+ Requires-Dist: uvicorn>=0.22.0
30
+ Requires-Dist: starlette>=0.27.0
31
+ Requires-Dist: kubernetes>=28.1.0
32
+ Requires-Dist: PyYAML>=6.0.1
33
+ Requires-Dist: requests>=2.31.0
34
+ Requires-Dist: urllib3>=2.1.0
35
+ Requires-Dist: websocket-client>=1.7.0
36
+ Requires-Dist: jsonschema>=4.20.0
37
+ Requires-Dist: cryptography>=42.0.2
38
+ Requires-Dist: rich>=13.0.0
39
+ Requires-Dist: aiohttp>=3.8.0
40
+ Requires-Dist: aiohttp-sse>=2.1.0
41
+ Provides-Extra: ui
42
+ Requires-Dist: mcp-ui-server>=0.5.0; extra == "ui"
43
+ Provides-Extra: all
44
+ Requires-Dist: mcp-ui-server>=0.5.0; extra == "all"
45
+ Dynamic: author
46
+ Dynamic: author-email
47
+ Dynamic: classifier
48
+ Dynamic: description
49
+ Dynamic: description-content-type
50
+ Dynamic: home-page
51
+ Dynamic: keywords
52
+ Dynamic: license-file
53
+ Dynamic: project-url
54
+ Dynamic: provides-extra
55
+ Dynamic: requires-dist
56
+ Dynamic: requires-python
57
+ Dynamic: summary
58
+
59
+ # Kubectl MCP Server
60
+
61
+ **Control your entire Kubernetes infrastructure through natural language conversations with AI.**
62
+
63
+ Talk to your clusters like you talk to a DevOps expert. Debug crashed pods, optimize costs, deploy applications, audit security, manage Helm charts, and visualize dashboards, all through natural language in your favorite AI assistant or agents.
64
+
65
+ [![GitHub Stars](https://img.shields.io/github/stars/rohitg00/kubectl-mcp-server?style=flat&logo=github)](https://github.com/rohitg00/kubectl-mcp-server)
66
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
67
+ [![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/)
68
+ [![Kubernetes](https://img.shields.io/badge/kubernetes-%23326ce5.svg?style=flat&logo=kubernetes&logoColor=white)](https://kubernetes.io/)
69
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io)
70
+ [![PyPI](https://img.shields.io/pypi/v/kubectl-mcp-server?color=blue&label=PyPI)](https://pypi.org/project/kubectl-mcp-server/)
71
+ [![npm](https://img.shields.io/npm/v/kubectl-mcp-server?color=green&label=npm)](https://www.npmjs.com/package/kubectl-mcp-server)
72
+ [![Docker](https://img.shields.io/docker/pulls/rohitghumare64/kubectl-mcp-server.svg)](https://hub.docker.com/r/rohitghumare64/kubectl-mcp-server)
73
+ [![Tests](https://img.shields.io/badge/tests-234%20passed-success)](https://github.com/rohitg00/kubectl-mcp-server)
74
+ [![agentregistry](https://img.shields.io/badge/agentregistry-verified-blue?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTE1Ljk5MiA2LjAzN2wtMy4wMjEtLjQzOS0xLjM1LTIuNzM2Yy0uMzQ2LS43MDItMS41MDQtLjcwMi0xLjg1IDBMOC40MjEgNS41OTggNS40IDYuMDM3Yy0uNzc2LjExMy0xLjA4OCAxLjA1My0uNTI4IDEuNTkzbDIuMTg2IDIuMTI5LS41MTYgMy4wMWMtLjEzMy43NzUuNjgyIDEuMzY2IDEuMzc4Ljk5OGwyLjcwMi0xLjQyIDIuNzAyIDEuNDJjLjY5Ni4zNjggMS41MTEtLjIyMyAxLjM3OC0uOTk4bC0uNTE2LTMuMDEgMi4xODYtMi4xMjljLjU2LS41NCAwLjI0OC0xLjQ4LS41MjgtMS41OTN6Ii8+PC9zdmc+)](https://aregistry.ai)
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ### Quick Start with npx (Recommended - Zero Install)
81
+
82
+ ```bash
83
+ # Run directly without installation - works instantly!
84
+ npx -y kubectl-mcp-server
85
+
86
+ # Or install globally for faster startup
87
+ npm install -g kubectl-mcp-server
88
+ ```
89
+
90
+ ### Or install with pip (Python)
91
+
92
+ ```bash
93
+ # Standard installation
94
+ pip install kubectl-mcp-server
95
+
96
+ # With interactive UI dashboards (recommended)
97
+ pip install kubectl-mcp-server[ui]
98
+ ```
99
+ ---
100
+
101
+ ## 📑 Table of Contents
102
+
103
+ - [What Can You Do?](#what-can-you-do)
104
+ - [Why kubectl-mcp-server?](#why-kubectl-mcp-server)
105
+ - [Live Demos](#live-demos)
106
+ - [Installation](#installation)
107
+ - [Quick Start with npx](#quick-start-with-npx-recommended---zero-install)
108
+ - [Install with pip](#or-install-with-pip-python)
109
+ - [Docker](#docker)
110
+ - [Getting Started](#getting-started)
111
+ - [Quick Setup with Your AI Assistant](#quick-setup-with-your-ai-assistant)
112
+ - [All Supported AI Assistants](#all-supported-ai-assistants)
113
+ - [Complete Feature Set](#complete-feature-set)
114
+ - [Using the CLI](#using-the-cli)
115
+ - [Advanced Configuration](#advanced-configuration)
116
+ - [Optional Features](#optional-interactive-dashboards-6-ui-tools)
117
+ - [Interactive Dashboards](#optional-interactive-dashboards-6-ui-tools)
118
+ - [Browser Automation](#optional-browser-automation-26-tools)
119
+ - [Enterprise](#enterprise-oauth-21-authentication)
120
+ - [Integrations & Ecosystem](#integrations--ecosystem)
121
+ - [In-Cluster Deployment](#in-cluster-deployment)
122
+ - [Multi-Cluster Support](#multi-cluster-support)
123
+ - [Architecture](#architecture)
124
+ - [Development & Testing](#development--testing)
125
+ - [Contributing](#contributing)
126
+ - [Support & Community](#support--community)
127
+
128
+ ---
129
+
130
+ ## What Can You Do?
131
+
132
+ Simply ask your AI assistant in natural language:
133
+
134
+ 💬 **"Why is my pod crashing?"**
135
+ - Instant crash diagnosis with logs, events, and resource analysis
136
+ - Root cause identification with actionable recommendations
137
+
138
+ 💬 **"Deploy a Redis cluster with 3 replicas"**
139
+ - Creates deployment with best practices
140
+ - Configures services, persistent storage, and health checks
141
+
142
+ 💬 **"Show me which pods are wasting resources"**
143
+ - AI-powered cost optimization analysis
144
+ - Resource recommendations with potential savings
145
+
146
+ 💬 **"Which services can't reach the database?"**
147
+ - Network connectivity diagnostics with DNS resolution
148
+ - Service chain tracing from ingress to pods
149
+
150
+ 💬 **"Audit security across all namespaces"**
151
+ - RBAC permission analysis
152
+ - Secret security scanning and pod security policies
153
+
154
+ 💬 **"Show me the cluster dashboard"**
155
+ - Interactive HTML dashboards with live metrics
156
+ - Visual timeline of events and resource usage
157
+
158
+ **224 powerful tools** | **8 workflow prompts** | **8 data resources** | **Works with all major AI assistants**
159
+
160
+ ## Why kubectl-mcp-server?
161
+
162
+ - **🚀 Stop context-switching** - Manage Kubernetes directly from your AI assistant conversations
163
+ - **🧠 AI-powered diagnostics** - Get intelligent troubleshooting, not just raw data
164
+ - **💰 Built-in cost optimization** - Identify waste and get actionable savings recommendations
165
+ - **🔒 Enterprise-ready** - OAuth 2.1 auth, RBAC validation, non-destructive mode, secret masking
166
+ - **⚡ Zero learning curve** - Natural language instead of memorizing kubectl commands
167
+ - **🌐 Universal compatibility** - Works with Claude, Cursor, Windsurf, Copilot, and 15+ other AI tools
168
+ - **📊 Visual insights** - Interactive dashboards and browser automation for web-based tools
169
+ - **☸️ Production-grade** - Deploy in-cluster with kMCP, 216 passing tests, active maintenance
170
+
171
+ From debugging crashed pods to optimizing cluster costs, kubectl-mcp-server is your AI-powered DevOps companion.
172
+
173
+ ## Live Demos
174
+
175
+ ### Claude Desktop
176
+ ![Claude MCP](./docs/claude/claude-mcp.gif)
177
+
178
+ ### Cursor AI
179
+ ![Cursor MCP](./docs/cursor/cursor-mcp.gif)
180
+
181
+ ### Windsurf
182
+ ![Windsurf MCP](./docs/windsurf/windsurf-mcp.gif)
183
+
184
+ ## Installation
185
+
186
+ ### Quick Start with npx (Recommended - Zero Install)
187
+
188
+ ```bash
189
+ # Run directly without installation - works instantly!
190
+ npx -y kubectl-mcp-server
191
+
192
+ # Or install globally for faster startup
193
+ npm install -g kubectl-mcp-server
194
+ ```
195
+
196
+ ### Or install with pip (Python)
197
+
198
+ ```bash
199
+ # Standard installation
200
+ pip install kubectl-mcp-server
201
+
202
+ # With interactive UI dashboards (recommended)
203
+ pip install kubectl-mcp-server[ui]
204
+ ```
205
+
206
+ ### Prerequisites
207
+ - **Python 3.9+** (for pip installation)
208
+ - **Node.js 14+** (for npx installation)
209
+ - **kubectl** installed and configured
210
+ - Access to a Kubernetes cluster
211
+
212
+ ### Docker
213
+
214
+ ```bash
215
+ # Pull and run with Docker
216
+ docker pull rohitghumare64/kubectl-mcp-server:latest
217
+
218
+ # Run with stdio transport
219
+ docker run -i -v $HOME/.kube:/root/.kube:ro rohitghumare64/kubectl-mcp-server:latest
220
+
221
+ # Run with HTTP transport
222
+ docker run -p 8000:8000 -v $HOME/.kube:/root/.kube:ro rohitghumare64/kubectl-mcp-server:latest --transport sse
223
+ ```
224
+
225
+ ## Getting Started
226
+
227
+ ### 1. Test the Server (Optional)
228
+
229
+ Before integrating with your AI assistant, verify the installation:
230
+
231
+ ```bash
232
+ # Check if kubectl is configured
233
+ kubectl cluster-info
234
+
235
+ # Test the MCP server directly
236
+ kubectl-mcp-server info
237
+
238
+ # List all available tools
239
+ kubectl-mcp-server tools
240
+
241
+ # Try calling a tool
242
+ kubectl-mcp-server call get_pods '{"namespace": "kube-system"}'
243
+ ```
244
+
245
+ ### 2. Connect to Your AI Assistant
246
+
247
+ Choose your favorite AI assistant and add the configuration:
248
+
249
+ ## Quick Setup with Your AI Assistant
250
+
251
+ ### Claude Desktop
252
+
253
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
254
+
255
+ ```json
256
+ {
257
+ "mcpServers": {
258
+ "kubernetes": {
259
+ "command": "npx",
260
+ "args": ["-y", "kubectl-mcp-server"]
261
+ }
262
+ }
263
+ }
264
+ ```
265
+
266
+ ### Cursor AI
267
+
268
+ Add to `~/.cursor/mcp.json`:
269
+
270
+ ```json
271
+ {
272
+ "mcpServers": {
273
+ "kubernetes": {
274
+ "command": "npx",
275
+ "args": ["-y", "kubectl-mcp-server"]
276
+ }
277
+ }
278
+ }
279
+ ```
280
+
281
+ ### Windsurf
282
+
283
+ Add to `~/.config/windsurf/mcp.json`:
284
+
285
+ ```json
286
+ {
287
+ "mcpServers": {
288
+ "kubernetes": {
289
+ "command": "npx",
290
+ "args": ["-y", "kubectl-mcp-server"]
291
+ }
292
+ }
293
+ }
294
+ ```
295
+
296
+ ### Using Python Instead of npx
297
+
298
+ ```json
299
+ {
300
+ "mcpServers": {
301
+ "kubernetes": {
302
+ "command": "python",
303
+ "args": ["-m", "kubectl_mcp_tool.mcp_server"],
304
+ "env": {
305
+ "KUBECONFIG": "/path/to/.kube/config"
306
+ }
307
+ }
308
+ }
309
+ }
310
+ ```
311
+
312
+ **More integrations**: GitHub Copilot, Goose, Gemini CLI, Roo Code, and [15+ other clients](#mcp-client-compatibility) —> see [full configuration guide](#all-supported-ai-assistants) below.
313
+
314
+ ### 3. Restart Your AI Assistant
315
+
316
+ After adding the configuration, restart your AI assistant **(GitHub Copilot, Claude Code,Claude Desktop, Cursor, etc.)** to load the MCP server.
317
+
318
+ ### 4. Try These Commands
319
+
320
+ Start a conversation with your AI assistant and try these:
321
+
322
+ **Troubleshooting:**
323
+ ```
324
+ "Show me all pods in the kube-system namespace"
325
+ "Why is the nginx-deployment pod crashing?"
326
+ "Diagnose network connectivity issues in the default namespace"
327
+ ```
328
+
329
+ **Deployments:**
330
+ ```
331
+ "Create a deployment for nginx with 3 replicas"
332
+ "Scale my frontend deployment to 5 replicas"
333
+ "Roll back the api-server deployment to the previous version"
334
+ ```
335
+
336
+ **Cost & Optimization:**
337
+ ```
338
+ "Which pods are using the most resources?"
339
+ "Show me idle resources that are wasting money"
340
+ "Analyze cost optimization opportunities in the production namespace"
341
+ ```
342
+
343
+ **Security:**
344
+ ```
345
+ "Audit RBAC permissions in all namespaces"
346
+ "Check for insecure secrets and configurations"
347
+ "Show me pods running with privileged access"
348
+ ```
349
+
350
+ **Helm:**
351
+ ```
352
+ "List all Helm releases in the cluster"
353
+ "Install Redis from the Bitnami chart repository"
354
+ "Show me the values for my nginx-ingress Helm release"
355
+ ```
356
+
357
+ **Multi-Cluster:**
358
+ ```
359
+ "List all available Kubernetes contexts"
360
+ "Switch to the production cluster context"
361
+ "Show me cluster information and version"
362
+ ```
363
+
364
+ ## MCP Client Compatibility
365
+
366
+ Works seamlessly with **all MCP-compatible AI assistants**:
367
+
368
+ | Client | Status | Client | Status |
369
+ |--------|--------|--------|--------|
370
+ | Claude Desktop | ✅ Native | Claude Code | ✅ Native |
371
+ | Cursor | ✅ Native | Windsurf | ✅ Native |
372
+ | GitHub Copilot | ✅ Native | OpenAI Codex | ✅ Native |
373
+ | Gemini CLI | ✅ Native | Goose | ✅ Native |
374
+ | Roo Code | ✅ Native | Kilo Code | ✅ Native |
375
+ | Amp | ✅ Native | Trae | ✅ Native |
376
+ | OpenCode | ✅ Native | Kiro CLI | ✅ Native |
377
+ | Antigravity | ✅ Native | Clawdbot | ✅ Native |
378
+ | Droid (Factory) | ✅ Native | Any MCP Client | ✅ Compatible |
379
+
380
+ ## All Supported AI Assistants
381
+
382
+ ### Claude Code
383
+
384
+ Add to `~/.config/claude-code/mcp.json`:
385
+
386
+ ```json
387
+ {
388
+ "mcpServers": {
389
+ "kubernetes": {
390
+ "command": "npx",
391
+ "args": ["-y", "kubectl-mcp-server"]
392
+ }
393
+ }
394
+ }
395
+ ```
396
+
397
+ ### GitHub Copilot (VS Code)
398
+
399
+ Add to VS Code `settings.json`:
400
+
401
+ ```json
402
+ {
403
+ "mcp": {
404
+ "servers": {
405
+ "kubernetes": {
406
+ "command": "npx",
407
+ "args": ["-y", "kubectl-mcp-server"]
408
+ }
409
+ }
410
+ }
411
+ }
412
+ ```
413
+
414
+ ### Goose
415
+
416
+ Add to `~/.config/goose/config.yaml`:
417
+
418
+ ```yaml
419
+ extensions:
420
+ kubernetes:
421
+ command: npx
422
+ args:
423
+ - -y
424
+ - kubectl-mcp-server
425
+ ```
426
+
427
+ ### Gemini CLI
428
+
429
+ Add to `~/.gemini/settings.json`:
430
+
431
+ ```json
432
+ {
433
+ "mcpServers": {
434
+ "kubernetes": {
435
+ "command": "npx",
436
+ "args": ["-y", "kubectl-mcp-server"]
437
+ }
438
+ }
439
+ }
440
+ ```
441
+
442
+ ### Roo Code / Kilo Code
443
+
444
+ Add to `~/.config/roo-code/mcp.json` or `~/.config/kilo-code/mcp.json`:
445
+
446
+ ```json
447
+ {
448
+ "mcpServers": {
449
+ "kubernetes": {
450
+ "command": "npx",
451
+ "args": ["-y", "kubectl-mcp-server"]
452
+ }
453
+ }
454
+ }
455
+ ```
456
+
457
+ ## Complete Feature Set
458
+
459
+ ### 224 MCP Tools for Complete Kubernetes Management
460
+
461
+ | Category | Tools |
462
+ |----------|-------|
463
+ | **Pods** | `get_pods`, `get_logs`, `get_pod_events`, `check_pod_health`, `exec_in_pod`, `cleanup_pods`, `get_pod_conditions`, `get_previous_logs` |
464
+ | **Deployments** | `get_deployments`, `create_deployment`, `scale_deployment`, `kubectl_rollout`, `restart_deployment` |
465
+ | **Workloads** | `get_statefulsets`, `get_daemonsets`, `get_jobs`, `get_replicasets` |
466
+ | **Services & Networking** | `get_services`, `get_ingress`, `get_endpoints`, `diagnose_network_connectivity`, `check_dns_resolution`, `trace_service_chain` |
467
+ | **Storage** | `get_persistent_volumes`, `get_pvcs`, `get_storage_classes` |
468
+ | **Config** | `get_configmaps`, `get_secrets`, `get_resource_quotas`, `get_limit_ranges` |
469
+ | **Cluster** | `get_nodes`, `get_namespaces`, `get_cluster_info`, `get_cluster_version`, `health_check`, `get_node_metrics`, `get_pod_metrics` |
470
+ | **RBAC & Security** | `get_rbac_roles`, `get_cluster_roles`, `get_service_accounts`, `audit_rbac_permissions`, `check_secrets_security`, `get_pod_security_info`, `get_admission_webhooks` |
471
+ | **CRDs** | `get_crds`, `get_priority_classes` |
472
+ | **Helm Releases** | `helm_list`, `helm_status`, `helm_history`, `helm_get_values`, `helm_get_manifest`, `helm_get_notes`, `helm_get_hooks`, `helm_get_all` |
473
+ | **Helm Charts** | `helm_show_chart`, `helm_show_values`, `helm_show_readme`, `helm_show_crds`, `helm_show_all`, `helm_search_repo`, `helm_search_hub` |
474
+ | **Helm Repos** | `helm_repo_list`, `helm_repo_add`, `helm_repo_remove`, `helm_repo_update` |
475
+ | **Helm Operations** | `install_helm_chart`, `upgrade_helm_chart`, `uninstall_helm_chart`, `helm_rollback`, `helm_test`, `helm_template`, `helm_template_apply` |
476
+ | **Helm Development** | `helm_create`, `helm_lint`, `helm_package`, `helm_pull`, `helm_dependency_list`, `helm_dependency_update`, `helm_dependency_build`, `helm_version`, `helm_env` |
477
+ | **Context** | `get_current_context`, `switch_context`, `list_contexts`, `list_kubeconfig_contexts` |
478
+ | **Diagnostics** | `diagnose_pod_crash`, `detect_pending_pods`, `get_evicted_pods`, `compare_namespaces` |
479
+ | **Operations** | `kubectl_apply`, `kubectl_create`, `kubectl_describe`, `kubectl_patch`, `delete_resource`, `kubectl_cp`, `backup_resource`, `label_resource`, `annotate_resource`, `taint_node`, `wait_for_condition` |
480
+ | **Autoscaling** | `get_hpa`, `get_pdb` |
481
+ | **Cost Optimization** | `get_resource_recommendations`, `get_idle_resources`, `get_resource_quotas_usage`, `get_cost_analysis`, `get_overprovisioned_resources`, `get_resource_trends`, `get_namespace_cost_allocation`, `optimize_resource_requests` |
482
+ | **Advanced** | `kubectl_generic`, `kubectl_explain`, `get_api_resources`, `port_forward`, `get_resource_usage`, `node_management` |
483
+ | **UI Dashboards** | `show_pod_logs_ui`, `show_pods_dashboard_ui`, `show_resource_yaml_ui`, `show_cluster_overview_ui`, `show_events_timeline_ui`, `render_k8s_dashboard_screenshot` |
484
+ | **GitOps (Flux/Argo)** | `gitops_apps_list`, `gitops_app_get`, `gitops_app_sync`, `gitops_app_status`, `gitops_sources_list`, `gitops_source_get`, `gitops_detect_engine` |
485
+ | **Cert-Manager** | `certs_list`, `certs_get`, `certs_issuers_list`, `certs_issuer_get`, `certs_renew`, `certs_status_explain`, `certs_challenges_list`, `certs_requests_list`, `certs_detect` |
486
+ | **Policy (Kyverno/Gatekeeper)** | `policy_list`, `policy_get`, `policy_violations_list`, `policy_explain_denial`, `policy_audit`, `policy_detect` |
487
+ | **Backup (Velero)** | `backup_list`, `backup_get`, `backup_create`, `backup_delete`, `restore_list`, `restore_create`, `restore_get`, `backup_locations_list`, `backup_schedules_list`, `backup_schedule_create`, `backup_detect` |
488
+ | **KEDA Autoscaling** | `keda_scaledobjects_list`, `keda_scaledobject_get`, `keda_scaledjobs_list`, `keda_triggerauths_list`, `keda_triggerauth_get`, `keda_hpa_list`, `keda_detect` |
489
+ | **Cilium/Hubble** | `cilium_policies_list`, `cilium_policy_get`, `cilium_endpoints_list`, `cilium_identities_list`, `cilium_nodes_list`, `cilium_status`, `hubble_flows_query`, `cilium_detect` |
490
+ | **Argo Rollouts/Flagger** | `rollouts_list`, `rollout_get`, `rollout_status`, `rollout_promote`, `rollout_abort`, `rollout_retry`, `rollout_restart`, `analysis_runs_list`, `flagger_canaries_list`, `flagger_canary_get`, `rollouts_detect` |
491
+ | **Cluster API** | `capi_clusters_list`, `capi_cluster_get`, `capi_machines_list`, `capi_machine_get`, `capi_machinedeployments_list`, `capi_machinedeployment_scale`, `capi_machinesets_list`, `capi_machinehealthchecks_list`, `capi_clusterclasses_list`, `capi_cluster_kubeconfig`, `capi_detect` |
492
+ | **KubeVirt VMs** | `kubevirt_vms_list`, `kubevirt_vm_get`, `kubevirt_vmis_list`, `kubevirt_vm_start`, `kubevirt_vm_stop`, `kubevirt_vm_restart`, `kubevirt_vm_pause`, `kubevirt_vm_unpause`, `kubevirt_vm_migrate`, `kubevirt_datasources_list`, `kubevirt_instancetypes_list`, `kubevirt_datavolumes_list`, `kubevirt_detect` |
493
+ | **Istio/Kiali** | `istio_virtualservices_list`, `istio_virtualservice_get`, `istio_destinationrules_list`, `istio_gateways_list`, `istio_peerauthentications_list`, `istio_authorizationpolicies_list`, `istio_proxy_status`, `istio_analyze`, `istio_sidecar_status`, `istio_detect` |
494
+
495
+ ### MCP Resources
496
+
497
+ Access Kubernetes data as browsable resources:
498
+
499
+ | Resource URI | Description |
500
+ |--------------|-------------|
501
+ | `kubeconfig://contexts` | List all available kubectl contexts |
502
+ | `kubeconfig://current-context` | Get current active context |
503
+ | `namespace://current` | Get current namespace |
504
+ | `namespace://list` | List all namespaces |
505
+ | `cluster://info` | Get cluster information |
506
+ | `cluster://nodes` | Get detailed node information |
507
+ | `cluster://version` | Get Kubernetes version |
508
+ | `cluster://api-resources` | List available API resources |
509
+ | `manifest://deployments/{ns}/{name}` | Get deployment YAML |
510
+ | `manifest://services/{ns}/{name}` | Get service YAML |
511
+ | `manifest://pods/{ns}/{name}` | Get pod YAML |
512
+ | `manifest://configmaps/{ns}/{name}` | Get ConfigMap YAML |
513
+ | `manifest://secrets/{ns}/{name}` | Get secret YAML (data masked) |
514
+ | `manifest://ingresses/{ns}/{name}` | Get ingress YAML |
515
+
516
+ ### MCP Prompts
517
+
518
+ Pre-built workflow prompts for common Kubernetes operations:
519
+
520
+ | Prompt | Description |
521
+ |--------|-------------|
522
+ | `troubleshoot_workload` | Comprehensive troubleshooting guide for pods/deployments |
523
+ | `deploy_application` | Step-by-step deployment workflow |
524
+ | `security_audit` | Security scanning and RBAC analysis workflow |
525
+ | `cost_optimization` | Resource optimization and cost analysis workflow |
526
+ | `disaster_recovery` | Backup and recovery planning workflow |
527
+ | `debug_networking` | Network debugging for services and connectivity |
528
+ | `scale_application` | Scaling guide with HPA/VPA best practices |
529
+ | `upgrade_cluster` | Kubernetes cluster upgrade planning |
530
+
531
+ ### Key Capabilities
532
+
533
+ - 🤖 **224 Powerful Tools** - Complete Kubernetes management from pods to security
534
+ - 🎯 **8 AI Workflow Prompts** - Pre-built workflows for common operations
535
+ - 📊 **8 MCP Resources** - Browsable Kubernetes data exposure
536
+ - 🎨 **6 Interactive Dashboards** - HTML UI tools for visual cluster management
537
+ - 🌐 **26 Browser Tools** - Web automation with cloud provider support
538
+ - 🔄 **93 Ecosystem Tools** - GitOps, Cert-Manager, Policy, Backup, KEDA, Cilium, Rollouts, CAPI, KubeVirt, Istio
539
+ - ⚡ **Multi-Transport** - stdio, SSE, HTTP, streamable-http
540
+ - 🔐 **Security First** - Non-destructive mode, secret masking, RBAC validation
541
+ - 🏥 **Advanced Diagnostics** - AI-powered troubleshooting and cost optimization
542
+ - ☸️ **Multi-Cluster** - Target any cluster via context parameter in every tool
543
+ - 🎡 **Full Helm v3** - Complete chart lifecycle management
544
+ - 🔧 **Powerful CLI** - Shell-friendly tool discovery and direct calling
545
+ - 🐳 **Cloud Native** - Deploy in-cluster with kMCP or kagent
546
+
547
+ ## Using the CLI
548
+
549
+ The built-in CLI lets you explore and test tools without an AI assistant:
550
+
551
+ ```bash
552
+ # List all tools with descriptions
553
+ kubectl-mcp-server tools -d
554
+
555
+ # Search for pod-related tools
556
+ kubectl-mcp-server grep "*pod*"
557
+
558
+ # Show specific tool schema
559
+ kubectl-mcp-server tools get_pods
560
+
561
+ # Call a tool directly
562
+ kubectl-mcp-server call get_pods '{"namespace": "kube-system"}'
563
+
564
+ # Pipe JSON from stdin
565
+ echo '{"namespace": "default"}' | kubectl-mcp-server call get_pods
566
+
567
+ # Check dependencies
568
+ kubectl-mcp-server doctor
569
+
570
+ # Show/switch Kubernetes context
571
+ kubectl-mcp-server context
572
+ kubectl-mcp-server context minikube
573
+
574
+ # List resources and prompts
575
+ kubectl-mcp-server resources
576
+ kubectl-mcp-server prompts
577
+
578
+ # Show server info
579
+ kubectl-mcp-server info
580
+ ```
581
+
582
+ ### CLI Features
583
+
584
+ - **Structured errors**: Actionable error messages with suggestions
585
+ - **Colorized output**: Human-readable with JSON mode for scripting (`--json`)
586
+ - **NO_COLOR support**: Respects `NO_COLOR` environment variable
587
+ - **Stdin support**: Pipe JSON arguments to commands
588
+
589
+ ## Advanced Configuration
590
+
591
+ ### Transport Modes
592
+
593
+ The server supports multiple transport protocols:
594
+
595
+ ```bash
596
+ # stdio (default) - Best for Claude Desktop, Cursor, Windsurf
597
+ kubectl-mcp-server
598
+ # or: python -m kubectl_mcp_tool.mcp_server
599
+
600
+ # SSE - Server-Sent Events for web clients
601
+ kubectl-mcp-server --transport sse --port 8000
602
+
603
+ # HTTP - Standard HTTP for REST clients
604
+ kubectl-mcp-server --transport http --port 8000
605
+
606
+ # streamable-http - For agentgateway integration
607
+ kubectl-mcp-server --transport streamable-http --port 8000
608
+ ```
609
+
610
+ **Transport Options:**
611
+ - `--transport`: Choose from `stdio`, `sse`, `http`, `streamable-http` (default: `stdio`)
612
+ - `--host`: Bind address (default: `0.0.0.0`)
613
+ - `--port`: Port for network transports (default: `8000`)
614
+ - `--non-destructive`: Enable read-only mode (blocks delete, apply, create operations)
615
+
616
+ ### Environment Variables
617
+
618
+ **Core Settings:**
619
+
620
+ | Variable | Description | Default |
621
+ |----------|-------------|---------|
622
+ | `KUBECONFIG` | Path to kubeconfig file | `~/.kube/config` |
623
+ | `MCP_DEBUG` | Enable verbose logging | `false` |
624
+ | `MCP_LOG_FILE` | Log file path | None (stdout) |
625
+
626
+ **Authentication (Enterprise):**
627
+
628
+ | Variable | Description | Default |
629
+ |----------|-------------|---------|
630
+ | `MCP_AUTH_ENABLED` | Enable OAuth 2.1 authentication | `false` |
631
+ | `MCP_AUTH_ISSUER` | OAuth 2.0 Authorization Server URL | - |
632
+ | `MCP_AUTH_JWKS_URI` | JWKS endpoint URL | Auto-derived |
633
+ | `MCP_AUTH_AUDIENCE` | Expected token audience | `kubectl-mcp-server` |
634
+ | `MCP_AUTH_REQUIRED_SCOPES` | Required OAuth scopes | `mcp:tools` |
635
+
636
+ **Browser Automation (Optional):**
637
+
638
+ | Variable | Description | Default |
639
+ |----------|-------------|---------|
640
+ | `MCP_BROWSER_ENABLED` | Enable browser automation tools | `false` |
641
+ | `MCP_BROWSER_PROVIDER` | Cloud provider (browserbase/browseruse) | None |
642
+ | `MCP_BROWSER_PROFILE` | Persistent profile path | None |
643
+ | `MCP_BROWSER_CDP_URL` | Remote CDP WebSocket URL | None |
644
+ | `MCP_BROWSER_PROXY` | Proxy server URL | None |
645
+
646
+ ## Optional: Interactive Dashboards (6 UI Tools)
647
+
648
+ Get beautiful HTML dashboards for visual cluster management.
649
+
650
+ **Installation:**
651
+
652
+ ```bash
653
+ # Install with UI support
654
+ pip install kubectl-mcp-server[ui]
655
+ ```
656
+
657
+ **6 Dashboard Tools:**
658
+ - 📊 `show_pods_dashboard_ui` - Real-time pod status table
659
+ - 📝 `show_pod_logs_ui` - Interactive log viewer with search
660
+ - 🎯 `show_cluster_overview_ui` - Complete cluster dashboard
661
+ - ⚡ `show_events_timeline_ui` - Events timeline with filtering
662
+ - 📄 `show_resource_yaml_ui` - YAML viewer with syntax highlighting
663
+ - 📸 `render_k8s_dashboard_screenshot` - Export dashboards as PNG
664
+
665
+ **Features:**
666
+ - 🎨 Dark theme optimized for terminals (Catppuccin)
667
+ - 🔄 Graceful fallback to JSON for incompatible clients
668
+ - 🖼️ Screenshot rendering for universal compatibility
669
+ - 🚀 Zero external dependencies
670
+
671
+ **Works With**: Goose, LibreChat, Nanobot (full HTML UI) | Claude Desktop, Cursor, others (JSON + screenshots)
672
+
673
+ ## Optional: Browser Automation (26 Tools)
674
+
675
+ Automate web-based Kubernetes operations with [agent-browser](https://github.com/vercel-labs/agent-browser) integration.
676
+
677
+ **Quick Setup:**
678
+
679
+ ```bash
680
+ # Install agent-browser
681
+ npm install -g agent-browser
682
+ agent-browser install
683
+
684
+ # Enable browser tools
685
+ export MCP_BROWSER_ENABLED=true
686
+ kubectl-mcp-server
687
+ ```
688
+
689
+ **What You Can Do:**
690
+ - 🌐 Test deployed apps via Ingress URLs
691
+ - 📸 Screenshot Grafana, ArgoCD, or any K8s dashboard
692
+ - ☁️ Automate cloud console operations (EKS, GKE, AKS)
693
+ - 🏥 Health check web applications
694
+ - 📄 Export monitoring dashboards as PDF
695
+ - 🔐 Test authentication flows with persistent sessions
696
+
697
+ **26 Available Tools**: `browser_open`, `browser_screenshot`, `browser_click`, `browser_fill`, `browser_test_ingress`, `browser_screenshot_grafana`, `browser_health_check`, and [19 more](https://github.com/rohitg00/kubectl-mcp-server#browser-tools)
698
+
699
+ **Advanced Features**:
700
+ - Cloud providers: Browserbase, Browser Use
701
+ - Persistent browser profiles
702
+ - Remote CDP connections
703
+ - Session management
704
+
705
+ ## Enterprise: OAuth 2.1 Authentication
706
+
707
+ Secure your MCP server with OAuth 2.1 authentication (RFC 9728).
708
+
709
+ ```bash
710
+ export MCP_AUTH_ENABLED=true
711
+ export MCP_AUTH_ISSUER=https://your-idp.example.com
712
+ export MCP_AUTH_AUDIENCE=kubectl-mcp-server
713
+ kubectl-mcp-server --transport http --port 8000
714
+ ```
715
+
716
+ **Supported Identity Providers**: Okta, Auth0, Keycloak, Microsoft Entra ID, Google OAuth, and any OIDC-compliant provider.
717
+
718
+ **Use Case**: Multi-tenant environments, compliance requirements, audit logging.
719
+
720
+ ## Integrations & Ecosystem
721
+
722
+ ### Docker MCP Toolkit
723
+
724
+ Works with [Docker MCP Toolkit](https://docs.docker.com/ai/mcp-catalog-and-toolkit/toolkit/):
725
+
726
+ ```bash
727
+ docker mcp server add kubectl-mcp-server mcp/kubectl-mcp-server:latest
728
+ docker mcp server configure kubectl-mcp-server --volume "$HOME/.kube:/root/.kube:ro"
729
+ docker mcp server enable kubectl-mcp-server
730
+ docker mcp client connect claude
731
+ ```
732
+
733
+ ### agentregistry
734
+
735
+ Install from the centralized [agentregistry](https://aregistry.ai):
736
+
737
+ ```bash
738
+ # Install arctl CLI
739
+ curl -fsSL https://raw.githubusercontent.com/agentregistry-dev/agentregistry/main/scripts/install.sh | bash
740
+
741
+ # Install kubectl-mcp-server
742
+ arctl mcp install io.github.rohitg00/kubectl-mcp-server
743
+ ```
744
+
745
+ **Available via**: PyPI (`uvx`), npm (`npx`), OCI (`docker.io/rohitghumare64/kubectl-mcp-server`)
746
+
747
+ ### agentgateway
748
+
749
+ Route to multiple MCP servers through [agentgateway](https://github.com/agentgateway/agentgateway):
750
+
751
+ ```bash
752
+ # Start with streamable-http
753
+ kubectl-mcp-server --transport streamable-http --port 8000
754
+
755
+ # Configure gateway
756
+ cat > gateway.yaml <<EOF
757
+ binds:
758
+ - port: 3000
759
+ listeners:
760
+ - routes:
761
+ - backends:
762
+ - mcp:
763
+ targets:
764
+ - name: kubectl-mcp-server
765
+ mcp:
766
+ host: http://localhost:8000/mcp
767
+ EOF
768
+
769
+ # Start gateway
770
+ agentgateway --config gateway.yaml
771
+ ```
772
+
773
+ Connect clients to `http://localhost:3000/mcp` for unified access to all 224 tools.
774
+
775
+ ## In-Cluster Deployment
776
+
777
+ ### Option 1: kMCP (Recommended)
778
+
779
+ Deploy with [kMCP](https://github.com/kagent-dev/kmcp) - a control plane for MCP servers:
780
+
781
+ ```bash
782
+ # Install kMCP
783
+ curl -fsSL https://raw.githubusercontent.com/kagent-dev/kmcp/refs/heads/main/scripts/get-kmcp.sh | bash
784
+ kmcp install
785
+
786
+ # Deploy kubectl-mcp-server (easiest)
787
+ kmcp deploy package --deployment-name kubectl-mcp-server \
788
+ --manager npx --args kubectl-mcp-server
789
+
790
+ # Or with Docker image
791
+ kmcp deploy --file deploy/kmcp/kmcp.yaml --image rohitghumare64/kubectl-mcp-server:latest
792
+ ```
793
+
794
+ See [kMCP quickstart](https://kagent.dev/docs/kmcp/quickstart) for details.
795
+
796
+ ### Option 2: Standard Kubernetes
797
+
798
+ Deploy with kubectl/kustomize:
799
+
800
+ ```bash
801
+ # Using kustomize (recommended)
802
+ kubectl apply -k deploy/kubernetes/
803
+
804
+ # Or individual manifests
805
+ kubectl apply -f deploy/kubernetes/namespace.yaml
806
+ kubectl apply -f deploy/kubernetes/rbac.yaml
807
+ kubectl apply -f deploy/kubernetes/deployment.yaml
808
+ kubectl apply -f deploy/kubernetes/service.yaml
809
+
810
+ # Access via port-forward
811
+ kubectl port-forward -n kubectl-mcp svc/kubectl-mcp-server 8000:8000
812
+ ```
813
+
814
+ See [deploy/](deploy/) directory for all manifests and configuration options.
815
+
816
+ ### Option 3: kagent (AI Agent Framework)
817
+
818
+ Integrate with [kagent](https://github.com/kagent-dev/kagent) - a CNCF Kubernetes-native AI agent framework:
819
+
820
+ ```bash
821
+ # Install kagent
822
+ brew install kagent
823
+ kagent install --profile demo
824
+
825
+ # Register as ToolServer
826
+ kubectl apply -f deploy/kagent/toolserver-stdio.yaml
827
+
828
+ # Open dashboard
829
+ kagent dashboard
830
+ ```
831
+
832
+ Your AI agents now have access to all 224 Kubernetes tools. See [kagent quickstart](https://kagent.dev/docs/kagent/getting-started/quickstart).
833
+
834
+ ## Architecture
835
+
836
+ ```
837
+ ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
838
+ │ AI Assistant │────▶│ MCP Server │────▶│ Kubernetes API │
839
+ │ (Claude/Cursor) │◀────│ (kubectl-mcp) │◀────│ (kubectl) │
840
+ └─────────────────┘ └──────────────────┘ └─────────────────┘
841
+ ```
842
+
843
+ The MCP server implements the [Model Context Protocol](https://github.com/modelcontextprotocol/spec), translating natural language requests into kubectl operations.
844
+
845
+ ### Modular Structure
846
+
847
+ ```
848
+ kubectl_mcp_tool/
849
+ ├── mcp_server.py # Main server (FastMCP, transports)
850
+ ├── tools/ # 224 MCP tools organized by category
851
+ │ ├── pods.py # Pod management & diagnostics
852
+ │ ├── deployments.py # Deployments, StatefulSets, DaemonSets
853
+ │ ├── core.py # Namespaces, ConfigMaps, Secrets
854
+ │ ├── cluster.py # Context/cluster management
855
+ │ ├── networking.py # Services, Ingress, NetworkPolicies
856
+ │ ├── storage.py # PVCs, StorageClasses, PVs
857
+ │ ├── security.py # RBAC, ServiceAccounts, PodSecurity
858
+ │ ├── helm.py # Complete Helm v3 operations
859
+ │ ├── operations.py # kubectl apply/patch/describe/etc
860
+ │ ├── diagnostics.py # Metrics, namespace comparison
861
+ │ ├── cost.py # Resource optimization & cost analysis
862
+ │ ├── ui.py # MCP-UI interactive dashboards
863
+ │ ├── gitops.py # GitOps (Flux/ArgoCD)
864
+ │ ├── certs.py # Cert-Manager
865
+ │ ├── policy.py # Policy (Kyverno/Gatekeeper)
866
+ │ ├── backup.py # Backup (Velero)
867
+ │ ├── keda.py # KEDA autoscaling
868
+ │ ├── cilium.py # Cilium/Hubble network observability
869
+ │ ├── rollouts.py # Argo Rollouts/Flagger
870
+ │ ├── capi.py # Cluster API
871
+ │ ├── kubevirt.py # KubeVirt VMs
872
+ │ └── kiali.py # Istio/Kiali service mesh
873
+ ├── resources/ # 8 MCP Resources for data exposure
874
+ ├── prompts/ # 8 MCP Prompts for workflows
875
+ └── cli/ # CLI interface
876
+ ```
877
+
878
+ ## Multi-Cluster Support
879
+
880
+ Seamlessly manage multiple Kubernetes clusters through natural language. **Every tool** supports an optional `context` parameter to target any cluster without switching contexts.
881
+
882
+ ### Context Parameter (v1.15.0)
883
+
884
+ All 224 tools accept an optional `context` parameter to target specific clusters:
885
+
886
+ **Talk to your AI assistant:**
887
+ ```
888
+ "List pods in the production cluster"
889
+ "Get deployments from staging context"
890
+ "Show logs from the api-pod in the dev cluster"
891
+ "Compare namespaces between production and staging clusters"
892
+ ```
893
+
894
+ **Direct tool calls with context:**
895
+ ```bash
896
+ # Target a specific cluster context
897
+ kubectl-mcp-server call get_pods '{"namespace": "default", "context": "production"}'
898
+
899
+ # Get deployments from staging
900
+ kubectl-mcp-server call get_deployments '{"namespace": "app", "context": "staging"}'
901
+
902
+ # Install Helm chart to production cluster
903
+ kubectl-mcp-server call install_helm_chart '{"name": "redis", "chart": "bitnami/redis", "namespace": "cache", "context": "production"}'
904
+
905
+ # Compare resources across clusters
906
+ kubectl-mcp-server call compare_namespaces '{"namespace1": "prod-ns", "namespace2": "staging-ns", "context": "production"}'
907
+ ```
908
+
909
+ ### Context Management
910
+
911
+ **Talk to your AI assistant:**
912
+ ```
913
+ "List all available Kubernetes contexts"
914
+ "Switch to the production cluster"
915
+ "Show me details about the staging context"
916
+ "What's the current cluster I'm connected to?"
917
+ ```
918
+
919
+ **Or use the CLI directly:**
920
+ ```bash
921
+ kubectl-mcp-server context # Show current context
922
+ kubectl-mcp-server context production # Switch context
923
+ kubectl-mcp-server call list_contexts_tool # List all contexts via MCP
924
+ ```
925
+
926
+ ### How It Works
927
+
928
+ - If `context` is omitted, the tool uses your current kubectl context
929
+ - If `context` is specified, the tool targets that cluster directly
930
+ - Response includes `"context": "production"` or `"context": "current"` for clarity
931
+ - Works with all kubeconfig setups and respects `KUBECONFIG` environment variable
932
+ - No need to switch contexts for cross-cluster operations
933
+
934
+ ## Development & Testing
935
+
936
+ ### Setup Development Environment
937
+
938
+ ```bash
939
+ # Clone the repository
940
+ git clone https://github.com/rohitg00/kubectl-mcp-server.git
941
+ cd kubectl-mcp-server
942
+
943
+ # Create virtual environment
944
+ python -m venv venv
945
+ source venv/bin/activate # On Windows: venv\Scripts\activate
946
+
947
+ # Install development dependencies
948
+ pip install -r requirements-dev.txt
949
+ ```
950
+
951
+ ### Running Tests
952
+
953
+ ```bash
954
+ # Run all tests
955
+ pytest tests/ -v
956
+
957
+ # Run specific test file
958
+ pytest tests/test_tools.py -v
959
+
960
+ # Run with coverage
961
+ pytest tests/ --cov=kubectl_mcp_tool --cov-report=html
962
+
963
+ # Run only unit tests
964
+ pytest tests/ -v -m unit
965
+ ```
966
+
967
+ ### Test Structure
968
+
969
+ ```
970
+ tests/
971
+ ├── __init__.py # Test package
972
+ ├── conftest.py # Shared fixtures and mocks
973
+ ├── test_tools.py # Unit tests for 224 MCP tools
974
+ ├── test_resources.py # Tests for 8 MCP Resources
975
+ ├── test_prompts.py # Tests for 8 MCP Prompts
976
+ └── test_server.py # Server initialization tests
977
+ ```
978
+
979
+ **234 tests covering**: tool registration, resource exposure, prompt generation, server initialization, non-destructive mode, secret masking, error handling, transport methods, CLI commands, browser automation, and ecosystem tools.
980
+
981
+ ### Code Quality
982
+
983
+ ```bash
984
+ # Format code
985
+ black kubectl_mcp_tool tests
986
+
987
+ # Sort imports
988
+ isort kubectl_mcp_tool tests
989
+
990
+ # Lint
991
+ flake8 kubectl_mcp_tool tests
992
+
993
+ # Type checking
994
+ mypy kubectl_mcp_tool
995
+ ```
996
+
997
+ ## Contributing
998
+
999
+ We ❤️ contributions! Whether it's bug reports, feature requests, documentation improvements, or code contributions.
1000
+
1001
+ **Ways to contribute:**
1002
+ - 🐛 Report bugs via [GitHub Issues](https://github.com/rohitg00/kubectl-mcp-server/issues)
1003
+ - 💡 Suggest features or improvements
1004
+ - 📝 Improve documentation
1005
+ - 🔧 Submit pull requests
1006
+ - ⭐ Star the project if you find it useful!
1007
+
1008
+ **Development setup**: See [Development & Testing](#development--testing) section above.
1009
+
1010
+ **Before submitting a PR:**
1011
+ 1. Run tests: `pytest tests/ -v`
1012
+ 2. Format code: `black kubectl_mcp_tool tests`
1013
+ 3. Check linting: `flake8 kubectl_mcp_tool tests`
1014
+
1015
+ ## Support & Community
1016
+
1017
+ - 📖 [Documentation](https://github.com/rohitg00/kubectl-mcp-server#readme)
1018
+ - 💬 [GitHub Discussions](https://github.com/rohitg00/kubectl-mcp-server/discussions)
1019
+ - 🐛 [Issue Tracker](https://github.com/rohitg00/kubectl-mcp-server/issues)
1020
+ - 🎯 [Feature Requests](https://github.com/rohitg00/kubectl-mcp-server/issues/new)
1021
+ - 🌟 [agentregistry Profile](https://aregistry.ai)
1022
+
1023
+ ## License
1024
+
1025
+ MIT License - see [LICENSE](LICENSE) for details.
1026
+
1027
+ ## Links & Resources
1028
+
1029
+ **Package Repositories:**
1030
+ - 🐍 [PyPI Package](https://pypi.org/project/kubectl-mcp-server/)
1031
+ - 📦 [npm Package](https://www.npmjs.com/package/kubectl-mcp-server)
1032
+ - 🐳 [Docker Hub](https://hub.docker.com/r/rohitghumare64/kubectl-mcp-server)
1033
+
1034
+ **Project:**
1035
+ - 🔧 [GitHub Repository](https://github.com/rohitg00/kubectl-mcp-server)
1036
+ - 🐛 [Issue Tracker](https://github.com/rohitg00/kubectl-mcp-server/issues)
1037
+ - 📋 [Changelog](https://github.com/rohitg00/kubectl-mcp-server/releases)
1038
+
1039
+ **Ecosystem:**
1040
+ - 📚 [Model Context Protocol](https://modelcontextprotocol.io)
1041
+ - ☸️ [Kubernetes Documentation](https://kubernetes.io/docs)
1042
+
1043
+ ---
1044
+
1045
+ **Made with ❤️ for the Kubernetes and AI community**
1046
+
1047
+ If **kubectl-mcp-server** makes your DevOps life easier, give it a ⭐ on [GitHub](https://github.com/rohitg00/kubectl-mcp-server)!