kubectl-mcp-server 1.14.0__py3-none-any.whl → 1.16.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.16.0.dist-info/METADATA +1047 -0
- kubectl_mcp_server-1.16.0.dist-info/RECORD +61 -0
- kubectl_mcp_tool/__init__.py +1 -1
- kubectl_mcp_tool/crd_detector.py +247 -0
- kubectl_mcp_tool/k8s_config.py +304 -63
- kubectl_mcp_tool/mcp_server.py +27 -0
- kubectl_mcp_tool/tools/__init__.py +20 -0
- kubectl_mcp_tool/tools/backup.py +881 -0
- kubectl_mcp_tool/tools/capi.py +727 -0
- kubectl_mcp_tool/tools/certs.py +709 -0
- kubectl_mcp_tool/tools/cilium.py +582 -0
- kubectl_mcp_tool/tools/cluster.py +395 -121
- kubectl_mcp_tool/tools/core.py +157 -60
- kubectl_mcp_tool/tools/cost.py +97 -41
- kubectl_mcp_tool/tools/deployments.py +173 -56
- kubectl_mcp_tool/tools/diagnostics.py +40 -13
- kubectl_mcp_tool/tools/gitops.py +552 -0
- kubectl_mcp_tool/tools/helm.py +133 -46
- kubectl_mcp_tool/tools/keda.py +464 -0
- kubectl_mcp_tool/tools/kiali.py +652 -0
- kubectl_mcp_tool/tools/kubevirt.py +803 -0
- kubectl_mcp_tool/tools/networking.py +106 -32
- kubectl_mcp_tool/tools/operations.py +176 -50
- kubectl_mcp_tool/tools/pods.py +162 -50
- kubectl_mcp_tool/tools/policy.py +554 -0
- kubectl_mcp_tool/tools/rollouts.py +790 -0
- kubectl_mcp_tool/tools/security.py +89 -36
- kubectl_mcp_tool/tools/storage.py +35 -16
- tests/test_browser.py +2 -2
- tests/test_ecosystem.py +331 -0
- tests/test_tools.py +73 -10
- kubectl_mcp_server-1.14.0.dist-info/METADATA +0 -780
- kubectl_mcp_server-1.14.0.dist-info/RECORD +0 -49
- {kubectl_mcp_server-1.14.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/WHEEL +0 -0
- {kubectl_mcp_server-1.14.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/entry_points.txt +0 -0
- {kubectl_mcp_server-1.14.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/licenses/LICENSE +0 -0
- {kubectl_mcp_server-1.14.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/top_level.txt +0 -0
tests/test_tools.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Unit tests for all MCP tools in kubectl-mcp-server.
|
|
3
3
|
|
|
4
|
-
This module contains comprehensive tests for all
|
|
5
|
-
provided by the MCP server.
|
|
4
|
+
This module contains comprehensive tests for all Kubernetes tools
|
|
5
|
+
provided by the MCP server (224 total with ecosystem tools).
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
@@ -12,7 +12,7 @@ from unittest.mock import patch, MagicMock
|
|
|
12
12
|
from datetime import datetime
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
# Complete list of all
|
|
15
|
+
# Complete list of all 224 tools that must be registered (125 core + 6 UI + 93 ecosystem)
|
|
16
16
|
EXPECTED_TOOLS = [
|
|
17
17
|
# Pods (pods.py)
|
|
18
18
|
"get_pods", "get_logs", "get_pod_events", "check_pod_health", "exec_in_pod",
|
|
@@ -24,10 +24,11 @@ EXPECTED_TOOLS = [
|
|
|
24
24
|
# Core (core.py)
|
|
25
25
|
"get_namespaces", "get_configmaps", "get_secrets", "get_events",
|
|
26
26
|
"get_resource_quotas", "get_limit_ranges",
|
|
27
|
-
# Cluster (cluster.py)
|
|
28
|
-
"get_current_context", "switch_context", "
|
|
27
|
+
# Cluster (cluster.py) - includes multi-cluster config tools
|
|
28
|
+
"get_current_context", "switch_context", "list_contexts_tool",
|
|
29
29
|
"get_context_details", "set_namespace_for_context", "get_cluster_info",
|
|
30
30
|
"get_cluster_version", "get_nodes", "get_api_resources", "health_check",
|
|
31
|
+
"kubeconfig_view", "get_api_versions", "check_crd_exists", "list_crds", "get_nodes_summary",
|
|
31
32
|
# Networking (networking.py)
|
|
32
33
|
"get_services", "get_endpoints", "get_ingress", "port_forward",
|
|
33
34
|
"diagnose_network_connectivity", "check_dns_resolution", "trace_service_chain",
|
|
@@ -64,15 +65,55 @@ EXPECTED_TOOLS = [
|
|
|
64
65
|
# UI tools (ui.py) - 6 tools for MCP-UI interactive dashboards
|
|
65
66
|
"show_pod_logs_ui", "show_pods_dashboard_ui", "show_resource_yaml_ui",
|
|
66
67
|
"show_cluster_overview_ui", "show_events_timeline_ui", "render_k8s_dashboard_screenshot",
|
|
68
|
+
# GitOps tools (gitops.py) - 7 tools for Flux and ArgoCD
|
|
69
|
+
"gitops_apps_list_tool", "gitops_app_get_tool", "gitops_app_sync_tool", "gitops_app_status_tool",
|
|
70
|
+
"gitops_sources_list_tool", "gitops_source_get_tool", "gitops_detect_engine_tool",
|
|
71
|
+
# Cert-Manager tools (certs.py) - 9 tools
|
|
72
|
+
"certs_list_tool", "certs_get_tool", "certs_issuers_list_tool", "certs_issuer_get_tool",
|
|
73
|
+
"certs_renew_tool", "certs_status_explain_tool", "certs_challenges_list_tool",
|
|
74
|
+
"certs_requests_list_tool", "certs_detect_tool",
|
|
75
|
+
# Policy tools (policy.py) - 6 tools for Kyverno and Gatekeeper
|
|
76
|
+
"policy_list_tool", "policy_get_tool", "policy_violations_list_tool", "policy_explain_denial_tool",
|
|
77
|
+
"policy_audit_tool", "policy_detect_tool",
|
|
78
|
+
# Backup tools (backup.py) - 11 tools for Velero
|
|
79
|
+
"backup_list_tool", "backup_get_tool", "backup_create_tool", "backup_delete_tool",
|
|
80
|
+
"restore_list_tool", "restore_create_tool", "restore_get_tool", "backup_locations_list_tool",
|
|
81
|
+
"backup_schedules_list_tool", "backup_schedule_create_tool", "backup_detect_tool",
|
|
82
|
+
# KEDA tools (keda.py) - 7 tools for autoscaling
|
|
83
|
+
"keda_scaledobjects_list_tool", "keda_scaledobject_get_tool", "keda_scaledjobs_list_tool",
|
|
84
|
+
"keda_triggerauths_list_tool", "keda_triggerauth_get_tool", "keda_hpa_list_tool", "keda_detect_tool",
|
|
85
|
+
# Cilium tools (cilium.py) - 8 tools for network observability
|
|
86
|
+
"cilium_policies_list_tool", "cilium_policy_get_tool", "cilium_endpoints_list_tool",
|
|
87
|
+
"cilium_identities_list_tool", "cilium_nodes_list_tool", "cilium_status_tool",
|
|
88
|
+
"hubble_flows_query_tool", "cilium_detect_tool",
|
|
89
|
+
# Rollouts tools (rollouts.py) - 11 tools for progressive delivery
|
|
90
|
+
"rollouts_list_tool", "rollout_get_tool", "rollout_status_tool", "rollout_promote_tool",
|
|
91
|
+
"rollout_abort_tool", "rollout_retry_tool", "rollout_restart_tool", "analysis_runs_list_tool",
|
|
92
|
+
"flagger_canaries_list_tool", "flagger_canary_get_tool", "rollouts_detect_tool",
|
|
93
|
+
# Cluster API tools (capi.py) - 11 tools for cluster lifecycle
|
|
94
|
+
"capi_clusters_list_tool", "capi_cluster_get_tool", "capi_machines_list_tool",
|
|
95
|
+
"capi_machine_get_tool", "capi_machinedeployments_list_tool", "capi_machinedeployment_scale_tool",
|
|
96
|
+
"capi_machinesets_list_tool", "capi_machinehealthchecks_list_tool", "capi_clusterclasses_list_tool",
|
|
97
|
+
"capi_cluster_kubeconfig_tool", "capi_detect_tool",
|
|
98
|
+
# KubeVirt tools (kubevirt.py) - 13 tools for VM management
|
|
99
|
+
"kubevirt_vms_list_tool", "kubevirt_vm_get_tool", "kubevirt_vmis_list_tool",
|
|
100
|
+
"kubevirt_vm_start_tool", "kubevirt_vm_stop_tool", "kubevirt_vm_restart_tool",
|
|
101
|
+
"kubevirt_vm_pause_tool", "kubevirt_vm_unpause_tool", "kubevirt_vm_migrate_tool",
|
|
102
|
+
"kubevirt_datasources_list_tool", "kubevirt_instancetypes_list_tool",
|
|
103
|
+
"kubevirt_datavolumes_list_tool", "kubevirt_detect_tool",
|
|
104
|
+
# Istio/Kiali tools (kiali.py) - 10 tools for service mesh
|
|
105
|
+
"istio_virtualservices_list_tool", "istio_virtualservice_get_tool", "istio_destinationrules_list_tool",
|
|
106
|
+
"istio_gateways_list_tool", "istio_peerauthentications_list_tool", "istio_authorizationpolicies_list_tool",
|
|
107
|
+
"istio_proxy_status_tool", "istio_analyze_tool", "istio_sidecar_status_tool", "istio_detect_tool",
|
|
67
108
|
]
|
|
68
109
|
|
|
69
110
|
|
|
70
111
|
class TestAllToolsRegistered:
|
|
71
|
-
"""Comprehensive tests to verify all
|
|
112
|
+
"""Comprehensive tests to verify all 224 tools are registered (125 core + 6 UI + 93 ecosystem)."""
|
|
72
113
|
|
|
73
114
|
@pytest.mark.unit
|
|
74
|
-
def
|
|
75
|
-
"""Verify all
|
|
115
|
+
def test_all_164_tools_registered(self):
|
|
116
|
+
"""Verify all 224 expected tools are registered (excluding optional browser tools)."""
|
|
76
117
|
import os
|
|
77
118
|
from kubectl_mcp_tool.mcp_server import MCPServer
|
|
78
119
|
|
|
@@ -93,8 +134,8 @@ class TestAllToolsRegistered:
|
|
|
93
134
|
tools = asyncio.run(get_tools())
|
|
94
135
|
tool_names = {t.name for t in tools}
|
|
95
136
|
|
|
96
|
-
# Verify count (
|
|
97
|
-
assert len(tools) ==
|
|
137
|
+
# Verify count (224 tools = 125 core + 6 UI + 93 ecosystem, browser tools disabled)
|
|
138
|
+
assert len(tools) == 224, f"Expected 224 tools, got {len(tools)}"
|
|
98
139
|
|
|
99
140
|
# Check for missing tools
|
|
100
141
|
missing_tools = set(EXPECTED_TOOLS) - tool_names
|
|
@@ -119,6 +160,16 @@ class TestAllToolsRegistered:
|
|
|
119
160
|
register_operations_tools,
|
|
120
161
|
register_diagnostics_tools,
|
|
121
162
|
register_cost_tools,
|
|
163
|
+
register_gitops_tools,
|
|
164
|
+
register_certs_tools,
|
|
165
|
+
register_policy_tools,
|
|
166
|
+
register_backup_tools,
|
|
167
|
+
register_keda_tools,
|
|
168
|
+
register_cilium_tools,
|
|
169
|
+
register_rollouts_tools,
|
|
170
|
+
register_capi_tools,
|
|
171
|
+
register_kubevirt_tools,
|
|
172
|
+
register_istio_tools,
|
|
122
173
|
)
|
|
123
174
|
# All imports should succeed
|
|
124
175
|
assert callable(register_helm_tools)
|
|
@@ -132,6 +183,18 @@ class TestAllToolsRegistered:
|
|
|
132
183
|
assert callable(register_operations_tools)
|
|
133
184
|
assert callable(register_diagnostics_tools)
|
|
134
185
|
assert callable(register_cost_tools)
|
|
186
|
+
# Ecosystem tools
|
|
187
|
+
assert callable(register_gitops_tools)
|
|
188
|
+
assert callable(register_certs_tools)
|
|
189
|
+
assert callable(register_policy_tools)
|
|
190
|
+
assert callable(register_backup_tools)
|
|
191
|
+
# Advanced ecosystem tools
|
|
192
|
+
assert callable(register_keda_tools)
|
|
193
|
+
assert callable(register_cilium_tools)
|
|
194
|
+
assert callable(register_rollouts_tools)
|
|
195
|
+
assert callable(register_capi_tools)
|
|
196
|
+
assert callable(register_kubevirt_tools)
|
|
197
|
+
assert callable(register_istio_tools)
|
|
135
198
|
|
|
136
199
|
@pytest.mark.unit
|
|
137
200
|
def test_all_tools_have_descriptions(self):
|