kubectl-mcp-server 1.22.0__py3-none-any.whl → 1.23.0__py3-none-any.whl
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.
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/METADATA +1 -1
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/RECORD +9 -9
- kubectl_mcp_tool/__init__.py +1 -1
- kubectl_mcp_tool/k8s_config.py +27 -4
- kubectl_mcp_tool/providers.py +30 -1
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/WHEEL +0 -0
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/entry_points.txt +0 -0
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/licenses/LICENSE +0 -0
- {kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kubectl-mcp-server
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.23.0
|
|
4
4
|
Summary: A Model Context Protocol (MCP) server for Kubernetes with 270+ tools, 8 resources, and 8 prompts
|
|
5
5
|
Home-page: https://github.com/rohitg00/kubectl-mcp-server
|
|
6
6
|
Author: Rohit Ghumare
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
kubectl_mcp_server-1.
|
|
2
|
-
kubectl_mcp_tool/__init__.py,sha256=
|
|
1
|
+
kubectl_mcp_server-1.23.0.dist-info/licenses/LICENSE,sha256=nH9Z0W0WNH2oQ4cPrBAU8ldDcHfeI6NUbkSGiazYWgQ,1070
|
|
2
|
+
kubectl_mcp_tool/__init__.py,sha256=VXHw0rDGepDETpgPBPmvZZLCso1PzghOb4xlwIexxhg,580
|
|
3
3
|
kubectl_mcp_tool/__main__.py,sha256=CE6cTD6PA71Ap0i5_gE17Pb9FcedOJmtGRNzZ5-TFSc,1490
|
|
4
4
|
kubectl_mcp_tool/crd_detector.py,sha256=xLZSyg3iIe_MjSMI3mESe2VK8wGJzu40rJ7F72fULBs,7139
|
|
5
5
|
kubectl_mcp_tool/diagnostics.py,sha256=uwolSoHadRkB-J8PAsabbexfj6sTNCIIRRrABBRXoTU,11776
|
|
6
|
-
kubectl_mcp_tool/k8s_config.py,sha256=
|
|
6
|
+
kubectl_mcp_tool/k8s_config.py,sha256=XePmWOS_cfFFaxG5HjmqGQrtEr8MWOVrYAB4eAipaPg,18950
|
|
7
7
|
kubectl_mcp_tool/mcp_server.py,sha256=bCNR_a_A9p3nctBmFCqnNghepEpYot_o1WcLIjYseYs,32691
|
|
8
|
-
kubectl_mcp_tool/providers.py,sha256=
|
|
8
|
+
kubectl_mcp_tool/providers.py,sha256=oAPWBNYs0KzqWJjUXYTjH1n0xIrMChLrTb8_-VAaHyY,12837
|
|
9
9
|
kubectl_mcp_tool/safety.py,sha256=7bx7tUH_hT4Y_eTnpH5knnHTsvnIZvI_0oo9MSBe_z8,5036
|
|
10
10
|
kubectl_mcp_tool/auth/__init__.py,sha256=ot8ivZZkDtV8Rg0y1UYruwobKCPyxX1svqh35wWxKvY,347
|
|
11
11
|
kubectl_mcp_tool/auth/config.py,sha256=wi3wuJNMyDqMeluDHL0MaJyedIFv5CFVxiUaEVaTvzk,2267
|
|
@@ -74,8 +74,8 @@ tests/test_safety.py,sha256=5IOBQbcH2r8tANQD7ymsR6pBc6O50IspcFsuwrnwh1M,8292
|
|
|
74
74
|
tests/test_server.py,sha256=lLvgbqutnivSgQMNrki0O48whBQt0UXjdwT047nf0nw,14415
|
|
75
75
|
tests/test_tools.py,sha256=qZsyaXV-US1O05hNsIDNXjZmeZlg-kIPStM1r8hxySo,36711
|
|
76
76
|
tests/test_vind.py,sha256=L3q6yOXlhbVXwjuH-5YRRnauEO8q4LBOUBB_RGqSTfk,19003
|
|
77
|
-
kubectl_mcp_server-1.
|
|
78
|
-
kubectl_mcp_server-1.
|
|
79
|
-
kubectl_mcp_server-1.
|
|
80
|
-
kubectl_mcp_server-1.
|
|
81
|
-
kubectl_mcp_server-1.
|
|
77
|
+
kubectl_mcp_server-1.23.0.dist-info/METADATA,sha256=zSUdGN45F44cKAsowJTcBl8imcoTmHgFHfMY5iI3SC0,43396
|
|
78
|
+
kubectl_mcp_server-1.23.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
79
|
+
kubectl_mcp_server-1.23.0.dist-info/entry_points.txt,sha256=zeOxQGaNC4r58deEmqsLCU5hfMjF0VqFUt9P5wWsKEM,109
|
|
80
|
+
kubectl_mcp_server-1.23.0.dist-info/top_level.txt,sha256=o5IpfOGG-lqU8rVWJeK9aYC0r4f6qEX09QiBhZlYbkQ,23
|
|
81
|
+
kubectl_mcp_server-1.23.0.dist-info/RECORD,,
|
kubectl_mcp_tool/__init__.py
CHANGED
|
@@ -7,7 +7,7 @@ with Kubernetes clusters through natural language commands.
|
|
|
7
7
|
For more information, see: https://github.com/rohitg00/kubectl-mcp-server
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
__version__ = "1.
|
|
10
|
+
__version__ = "1.23.0"
|
|
11
11
|
|
|
12
12
|
from .mcp_server import MCPServer
|
|
13
13
|
from .diagnostics import run_diagnostics, check_kubectl_installation, check_cluster_connection
|
kubectl_mcp_tool/k8s_config.py
CHANGED
|
@@ -203,6 +203,7 @@ try:
|
|
|
203
203
|
KubernetesProvider,
|
|
204
204
|
ProviderConfig,
|
|
205
205
|
ProviderType,
|
|
206
|
+
ProviderError,
|
|
206
207
|
UnknownContextError,
|
|
207
208
|
get_provider,
|
|
208
209
|
get_context_names,
|
|
@@ -262,9 +263,21 @@ def load_kubernetes_config(context: str = ""):
|
|
|
262
263
|
|
|
263
264
|
|
|
264
265
|
def _patched_load_kube_config(*args, **kwargs):
|
|
265
|
-
"""Patched version of load_kube_config that tries in-cluster first.
|
|
266
|
+
"""Patched version of load_kube_config that tries in-cluster first.
|
|
267
|
+
|
|
268
|
+
When called with explicit arguments (config_file, context, client_configuration),
|
|
269
|
+
always pass through to the original function. Only try in-cluster as a
|
|
270
|
+
fallback for bare calls during initial module loading.
|
|
271
|
+
"""
|
|
266
272
|
global _config_loaded, _original_load_kube_config
|
|
267
273
|
|
|
274
|
+
has_explicit_args = bool(args) or bool(kwargs)
|
|
275
|
+
|
|
276
|
+
if has_explicit_args and _original_load_kube_config:
|
|
277
|
+
_original_load_kube_config(*args, **kwargs)
|
|
278
|
+
_config_loaded = True
|
|
279
|
+
return
|
|
280
|
+
|
|
268
281
|
if _config_loaded:
|
|
269
282
|
return
|
|
270
283
|
|
|
@@ -326,7 +339,7 @@ def _load_config_for_context(context: str = "") -> Any:
|
|
|
326
339
|
try:
|
|
327
340
|
provider = get_provider()
|
|
328
341
|
return provider.get_api_client(context)
|
|
329
|
-
except UnknownContextError:
|
|
342
|
+
except (UnknownContextError, ProviderError):
|
|
330
343
|
raise
|
|
331
344
|
except Exception as e:
|
|
332
345
|
logger.warning(f"Provider failed, falling back to basic config: {e}")
|
|
@@ -338,11 +351,20 @@ def _load_config_for_context(context: str = "") -> Any:
|
|
|
338
351
|
config.load_incluster_config()
|
|
339
352
|
return client.ApiClient()
|
|
340
353
|
except ConfigException:
|
|
341
|
-
|
|
354
|
+
logger.debug("In-cluster config not available in fallback path")
|
|
342
355
|
|
|
343
356
|
kubeconfig_path = os.environ.get('KUBECONFIG', '~/.kube/config')
|
|
344
357
|
kubeconfig_path = os.path.expanduser(kubeconfig_path)
|
|
345
358
|
|
|
359
|
+
if not os.path.exists(kubeconfig_path):
|
|
360
|
+
raise RuntimeError(
|
|
361
|
+
f"No Kubernetes configuration found. "
|
|
362
|
+
f"In-cluster config not available and kubeconfig not found at '{kubeconfig_path}'. "
|
|
363
|
+
f"If running in a Kubernetes pod, ensure the ServiceAccount token is mounted "
|
|
364
|
+
f"and KUBERNETES_SERVICE_HOST/KUBERNETES_SERVICE_PORT env vars are set. "
|
|
365
|
+
f"Set MCP_K8S_PROVIDER=in-cluster for in-cluster deployments."
|
|
366
|
+
)
|
|
367
|
+
|
|
346
368
|
api_config = client.Configuration()
|
|
347
369
|
|
|
348
370
|
if context:
|
|
@@ -543,7 +565,8 @@ _BASE_EXPORTS = [
|
|
|
543
565
|
if _HAS_PROVIDER:
|
|
544
566
|
__all__ = _BASE_EXPORTS + [
|
|
545
567
|
"KubernetesProvider", "ProviderConfig", "ProviderType",
|
|
546
|
-
"
|
|
568
|
+
"ProviderError", "UnknownContextError",
|
|
569
|
+
"get_provider", "validate_context",
|
|
547
570
|
]
|
|
548
571
|
else:
|
|
549
572
|
__all__ = _BASE_EXPORTS
|
kubectl_mcp_tool/providers.py
CHANGED
|
@@ -150,8 +150,37 @@ class KubernetesProvider:
|
|
|
150
150
|
raise ProviderError(f"Failed to load context '{self.config.context}': {e}")
|
|
151
151
|
|
|
152
152
|
def _initialize_kubeconfig(self):
|
|
153
|
-
"""Initialize for multi-cluster kubeconfig provider.
|
|
153
|
+
"""Initialize for multi-cluster kubeconfig provider.
|
|
154
|
+
|
|
155
|
+
Falls back to in-cluster config if kubeconfig file is not found.
|
|
156
|
+
"""
|
|
154
157
|
from kubernetes import config
|
|
158
|
+
from kubernetes.config.config_exception import ConfigException
|
|
159
|
+
|
|
160
|
+
kubeconfig_exists = os.path.exists(self.config.kubeconfig_path)
|
|
161
|
+
|
|
162
|
+
if not kubeconfig_exists:
|
|
163
|
+
try:
|
|
164
|
+
config.load_incluster_config()
|
|
165
|
+
self._in_cluster = True
|
|
166
|
+
self._active_context = "in-cluster"
|
|
167
|
+
self._contexts_cache = []
|
|
168
|
+
logger.info(
|
|
169
|
+
f"Kubeconfig not found at {self.config.kubeconfig_path}, "
|
|
170
|
+
f"using in-cluster config"
|
|
171
|
+
)
|
|
172
|
+
return
|
|
173
|
+
except ConfigException:
|
|
174
|
+
raise ProviderError(
|
|
175
|
+
f"No Kubernetes configuration found. "
|
|
176
|
+
f"Kubeconfig not found at '{self.config.kubeconfig_path}' and "
|
|
177
|
+
f"in-cluster config is not available. "
|
|
178
|
+
f"Ensure a valid kubeconfig exists, or if running inside a "
|
|
179
|
+
f"Kubernetes pod, verify the ServiceAccount token is mounted "
|
|
180
|
+
f"and KUBERNETES_SERVICE_HOST/KUBERNETES_SERVICE_PORT env vars "
|
|
181
|
+
f"are set. For in-cluster deployments, set "
|
|
182
|
+
f"MCP_K8S_PROVIDER=in-cluster."
|
|
183
|
+
)
|
|
155
184
|
|
|
156
185
|
try:
|
|
157
186
|
contexts, active = config.list_kube_config_contexts(
|
|
File without changes
|
{kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{kubectl_mcp_server-1.22.0.dist-info → kubectl_mcp_server-1.23.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|