kubectl-mcp-server 1.15.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.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/METADATA +34 -13
- {kubectl_mcp_server-1.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/RECORD +24 -12
- kubectl_mcp_tool/__init__.py +1 -1
- kubectl_mcp_tool/crd_detector.py +247 -0
- kubectl_mcp_tool/k8s_config.py +19 -0
- 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/gitops.py +552 -0
- 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/policy.py +554 -0
- kubectl_mcp_tool/tools/rollouts.py +790 -0
- tests/test_browser.py +2 -2
- tests/test_ecosystem.py +331 -0
- tests/test_tools.py +70 -8
- {kubectl_mcp_server-1.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/WHEEL +0 -0
- {kubectl_mcp_server-1.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/entry_points.txt +0 -0
- {kubectl_mcp_server-1.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/licenses/LICENSE +0 -0
- {kubectl_mcp_server-1.15.0.dist-info → kubectl_mcp_server-1.16.0.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kubectl-mcp-server
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: A Model Context Protocol (MCP) server for Kubernetes with
|
|
3
|
+
Version: 1.16.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) server for Kubernetes with 220+ tools, 8 resources, and 8 prompts
|
|
5
5
|
Home-page: https://github.com/rohitg00/kubectl-mcp-server
|
|
6
6
|
Author: Rohit Ghumare
|
|
7
7
|
Author-email: ghumare64@gmail.com
|
|
@@ -70,7 +70,7 @@ Talk to your clusters like you talk to a DevOps expert. Debug crashed pods, opti
|
|
|
70
70
|
[](https://pypi.org/project/kubectl-mcp-server/)
|
|
71
71
|
[](https://www.npmjs.com/package/kubectl-mcp-server)
|
|
72
72
|
[](https://hub.docker.com/r/rohitghumare64/kubectl-mcp-server)
|
|
73
|
-
[](https://github.com/rohitg00/kubectl-mcp-server)
|
|
74
74
|
[](https://aregistry.ai)
|
|
75
75
|
|
|
76
76
|
---
|
|
@@ -155,7 +155,7 @@ Simply ask your AI assistant in natural language:
|
|
|
155
155
|
- Interactive HTML dashboards with live metrics
|
|
156
156
|
- Visual timeline of events and resource usage
|
|
157
157
|
|
|
158
|
-
**
|
|
158
|
+
**224 powerful tools** | **8 workflow prompts** | **8 data resources** | **Works with all major AI assistants**
|
|
159
159
|
|
|
160
160
|
## Why kubectl-mcp-server?
|
|
161
161
|
|
|
@@ -456,7 +456,7 @@ Add to `~/.config/roo-code/mcp.json` or `~/.config/kilo-code/mcp.json`:
|
|
|
456
456
|
|
|
457
457
|
## Complete Feature Set
|
|
458
458
|
|
|
459
|
-
###
|
|
459
|
+
### 224 MCP Tools for Complete Kubernetes Management
|
|
460
460
|
|
|
461
461
|
| Category | Tools |
|
|
462
462
|
|----------|-------|
|
|
@@ -481,6 +481,16 @@ Add to `~/.config/roo-code/mcp.json` or `~/.config/kilo-code/mcp.json`:
|
|
|
481
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
482
|
| **Advanced** | `kubectl_generic`, `kubectl_explain`, `get_api_resources`, `port_forward`, `get_resource_usage`, `node_management` |
|
|
483
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` |
|
|
484
494
|
|
|
485
495
|
### MCP Resources
|
|
486
496
|
|
|
@@ -520,11 +530,12 @@ Pre-built workflow prompts for common Kubernetes operations:
|
|
|
520
530
|
|
|
521
531
|
### Key Capabilities
|
|
522
532
|
|
|
523
|
-
- 🤖 **
|
|
533
|
+
- 🤖 **224 Powerful Tools** - Complete Kubernetes management from pods to security
|
|
524
534
|
- 🎯 **8 AI Workflow Prompts** - Pre-built workflows for common operations
|
|
525
535
|
- 📊 **8 MCP Resources** - Browsable Kubernetes data exposure
|
|
526
536
|
- 🎨 **6 Interactive Dashboards** - HTML UI tools for visual cluster management
|
|
527
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
|
|
528
539
|
- ⚡ **Multi-Transport** - stdio, SSE, HTTP, streamable-http
|
|
529
540
|
- 🔐 **Security First** - Non-destructive mode, secret masking, RBAC validation
|
|
530
541
|
- 🏥 **Advanced Diagnostics** - AI-powered troubleshooting and cost optimization
|
|
@@ -759,7 +770,7 @@ EOF
|
|
|
759
770
|
agentgateway --config gateway.yaml
|
|
760
771
|
```
|
|
761
772
|
|
|
762
|
-
Connect clients to `http://localhost:3000/mcp` for unified access to all
|
|
773
|
+
Connect clients to `http://localhost:3000/mcp` for unified access to all 224 tools.
|
|
763
774
|
|
|
764
775
|
## In-Cluster Deployment
|
|
765
776
|
|
|
@@ -818,7 +829,7 @@ kubectl apply -f deploy/kagent/toolserver-stdio.yaml
|
|
|
818
829
|
kagent dashboard
|
|
819
830
|
```
|
|
820
831
|
|
|
821
|
-
Your AI agents now have access to all
|
|
832
|
+
Your AI agents now have access to all 224 Kubernetes tools. See [kagent quickstart](https://kagent.dev/docs/kagent/getting-started/quickstart).
|
|
822
833
|
|
|
823
834
|
## Architecture
|
|
824
835
|
|
|
@@ -836,7 +847,7 @@ The MCP server implements the [Model Context Protocol](https://github.com/modelc
|
|
|
836
847
|
```
|
|
837
848
|
kubectl_mcp_tool/
|
|
838
849
|
├── mcp_server.py # Main server (FastMCP, transports)
|
|
839
|
-
├── tools/ #
|
|
850
|
+
├── tools/ # 224 MCP tools organized by category
|
|
840
851
|
│ ├── pods.py # Pod management & diagnostics
|
|
841
852
|
│ ├── deployments.py # Deployments, StatefulSets, DaemonSets
|
|
842
853
|
│ ├── core.py # Namespaces, ConfigMaps, Secrets
|
|
@@ -848,7 +859,17 @@ kubectl_mcp_tool/
|
|
|
848
859
|
│ ├── operations.py # kubectl apply/patch/describe/etc
|
|
849
860
|
│ ├── diagnostics.py # Metrics, namespace comparison
|
|
850
861
|
│ ├── cost.py # Resource optimization & cost analysis
|
|
851
|
-
│
|
|
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
|
|
852
873
|
├── resources/ # 8 MCP Resources for data exposure
|
|
853
874
|
├── prompts/ # 8 MCP Prompts for workflows
|
|
854
875
|
└── cli/ # CLI interface
|
|
@@ -860,7 +881,7 @@ Seamlessly manage multiple Kubernetes clusters through natural language. **Every
|
|
|
860
881
|
|
|
861
882
|
### Context Parameter (v1.15.0)
|
|
862
883
|
|
|
863
|
-
All
|
|
884
|
+
All 224 tools accept an optional `context` parameter to target specific clusters:
|
|
864
885
|
|
|
865
886
|
**Talk to your AI assistant:**
|
|
866
887
|
```
|
|
@@ -949,13 +970,13 @@ pytest tests/ -v -m unit
|
|
|
949
970
|
tests/
|
|
950
971
|
├── __init__.py # Test package
|
|
951
972
|
├── conftest.py # Shared fixtures and mocks
|
|
952
|
-
├── test_tools.py # Unit tests for
|
|
973
|
+
├── test_tools.py # Unit tests for 224 MCP tools
|
|
953
974
|
├── test_resources.py # Tests for 8 MCP Resources
|
|
954
975
|
├── test_prompts.py # Tests for 8 MCP Prompts
|
|
955
976
|
└── test_server.py # Server initialization tests
|
|
956
977
|
```
|
|
957
978
|
|
|
958
|
-
**
|
|
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.
|
|
959
980
|
|
|
960
981
|
### Code Quality
|
|
961
982
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
kubectl_mcp_server-1.
|
|
2
|
-
kubectl_mcp_tool/__init__.py,sha256=
|
|
1
|
+
kubectl_mcp_server-1.16.0.dist-info/licenses/LICENSE,sha256=nH9Z0W0WNH2oQ4cPrBAU8ldDcHfeI6NUbkSGiazYWgQ,1070
|
|
2
|
+
kubectl_mcp_tool/__init__.py,sha256=lXt5nN5Weai2sekX8XGqgSgjZjVFf7FBG8xfvlbYruA,580
|
|
3
3
|
kubectl_mcp_tool/__main__.py,sha256=CE6cTD6PA71Ap0i5_gE17Pb9FcedOJmtGRNzZ5-TFSc,1490
|
|
4
|
+
kubectl_mcp_tool/crd_detector.py,sha256=xLZSyg3iIe_MjSMI3mESe2VK8wGJzu40rJ7F72fULBs,7139
|
|
4
5
|
kubectl_mcp_tool/diagnostics.py,sha256=uwolSoHadRkB-J8PAsabbexfj6sTNCIIRRrABBRXoTU,11776
|
|
5
|
-
kubectl_mcp_tool/k8s_config.py,sha256=
|
|
6
|
-
kubectl_mcp_tool/mcp_server.py,sha256=
|
|
6
|
+
kubectl_mcp_tool/k8s_config.py,sha256=tjP_VONsoqhd5qn0LPB25aKhiPw2qCYhJ_B52NbRYDo,15746
|
|
7
|
+
kubectl_mcp_tool/mcp_server.py,sha256=rHz8yuA-SlnuuajVytqeEOMryQAHCTL1CWrQw85CbMM,22674
|
|
7
8
|
kubectl_mcp_tool/auth/__init__.py,sha256=ot8ivZZkDtV8Rg0y1UYruwobKCPyxX1svqh35wWxKvY,347
|
|
8
9
|
kubectl_mcp_tool/auth/config.py,sha256=wi3wuJNMyDqMeluDHL0MaJyedIFv5CFVxiUaEVaTvzk,2267
|
|
9
10
|
kubectl_mcp_tool/auth/scopes.py,sha256=KPmuGO0SrTkjzlElWFOV29ie9apTdMklOCkiA-965lI,6147
|
|
@@ -17,17 +18,27 @@ kubectl_mcp_tool/prompts/__init__.py,sha256=BacBNfoVxow6aci8Zzcfam3m1oM7yYzM0IRT
|
|
|
17
18
|
kubectl_mcp_tool/prompts/prompts.py,sha256=ZfmTCio8NqOYYxF8VVo9f6VWGCS34J8tvmBfhNblr58,22942
|
|
18
19
|
kubectl_mcp_tool/resources/__init__.py,sha256=ERkn0ErlaGi9-dybv4wrAaT8WretvNp6K002h7Agjno,83
|
|
19
20
|
kubectl_mcp_tool/resources/resources.py,sha256=kvK4OM3Ox5cFvWDqJBTXOfBgnRYdoqdvvjsdCg0PJfY,12713
|
|
20
|
-
kubectl_mcp_tool/tools/__init__.py,sha256=
|
|
21
|
+
kubectl_mcp_tool/tools/__init__.py,sha256=DgFcaXxqMf7dgXcYWXl0-zKBJTUSF7Y__Cqsd79hRBA,1761
|
|
22
|
+
kubectl_mcp_tool/tools/backup.py,sha256=ToZABafXvrBQy-Hlc31xzVX5shWaB71JeqD3xq-4kh0,30423
|
|
21
23
|
kubectl_mcp_tool/tools/browser.py,sha256=OvXUHzEuciRQInnwLLC16iObOOdniu09b9RT81y7sdc,25338
|
|
24
|
+
kubectl_mcp_tool/tools/capi.py,sha256=mPCm6wUI3Sr5Mg9RjWSKBR5uwWn02Byyx42Cc1Fo7IE,25738
|
|
25
|
+
kubectl_mcp_tool/tools/certs.py,sha256=7Qdsx3IwCI3_mgcPrypzF6MFL5jZjKkVXsXUohAbfh8,25720
|
|
26
|
+
kubectl_mcp_tool/tools/cilium.py,sha256=ku5E-fQ9vS4MhSnaZA_rli6ebXXLCHBuKhZBrEo221c,19973
|
|
22
27
|
kubectl_mcp_tool/tools/cluster.py,sha256=Xyb18x7d1Eg3l0XZ2JMmCOb0c0IbtVCpk2RH2rKgKDY,20944
|
|
23
28
|
kubectl_mcp_tool/tools/core.py,sha256=67Cx1z4DqV0Qd26yXkF1eBXbUIlBB3Qj2W8rOInvb54,17801
|
|
24
29
|
kubectl_mcp_tool/tools/cost.py,sha256=fcFlIv-bsMdKESw-l-T6ECsUplDukNHaqM76JCYVHvQ,29629
|
|
25
30
|
kubectl_mcp_tool/tools/deployments.py,sha256=e138KV30DQhLCnvXntrofx1XdLH0dC0_mlODbzkluKk,18329
|
|
26
31
|
kubectl_mcp_tool/tools/diagnostics.py,sha256=LGpW-cx2ui40IIq4pZPT2O8nVzKCpOEVnnQ1OGUSVt0,7864
|
|
32
|
+
kubectl_mcp_tool/tools/gitops.py,sha256=YMsSL0vzzz-XtFXRgney3yKwVfIfuYTSOsLbbLUEI5w,20497
|
|
27
33
|
kubectl_mcp_tool/tools/helm.py,sha256=v_d1aH79VCKJmFi-kXG1LwzZRw6OFToyVC7D9tEp99A,61658
|
|
34
|
+
kubectl_mcp_tool/tools/keda.py,sha256=Et7NSRIH2FSIG2iJ0LyLcQTsFqdeVsKTUr1KKT4tmso,16155
|
|
35
|
+
kubectl_mcp_tool/tools/kiali.py,sha256=ThUF3d_PBEpu9aVSg8gVw9WtPGwkwJlmn6R8sj-BgqM,21932
|
|
36
|
+
kubectl_mcp_tool/tools/kubevirt.py,sha256=yN5ilsGEEFTKJ7h5iAONr4CVFqj_wKjHBcdijGx2DWU,26878
|
|
28
37
|
kubectl_mcp_tool/tools/networking.py,sha256=5I-2SHp2kK9OyGJJ9KUU0hetlYoREIfin1J6CJA6HVQ,14309
|
|
29
38
|
kubectl_mcp_tool/tools/operations.py,sha256=c7j1quXwRDoB9pMkmnLZ5Mk4QoCAuEzWVXJl_hmg2tc,24862
|
|
30
39
|
kubectl_mcp_tool/tools/pods.py,sha256=PsjqbudCUEgZdJmBBeHX3qg-mObn9mlVOCpJOU8XBd8,27271
|
|
40
|
+
kubectl_mcp_tool/tools/policy.py,sha256=T4zf6EvOdIOtqLfnn4wE1QR7nzIeYOkG-vIvXNcu4nc,21769
|
|
41
|
+
kubectl_mcp_tool/tools/rollouts.py,sha256=K1VpvnMIE36I0kWB0Bo338UNQhctkIdmtmcdkt3ddhE,26224
|
|
31
42
|
kubectl_mcp_tool/tools/security.py,sha256=d7WLj-JZwr-0opzkRNWyPdMykvBjdsDCBSZHovDIPLo,13971
|
|
32
43
|
kubectl_mcp_tool/tools/storage.py,sha256=ILI3X5GYXASCETqg3A7X33B7PjwD5UsxL-iDG7yTi_8,5676
|
|
33
44
|
kubectl_mcp_tool/tools/ui.py,sha256=HHi0KM2JTvZFpQjo5V6XkJf02hxFoasec7uyNY5wuuo,39702
|
|
@@ -36,14 +47,15 @@ kubectl_mcp_tool/utils/helpers.py,sha256=W--wiVSKKqmjpxxdLT0J6rmhOQcp1OFk9jLrtQU
|
|
|
36
47
|
tests/__init__.py,sha256=qZPXYXv3whkkWhi61Ngzj09GHnIFlVSZrajE0XRk55o,290
|
|
37
48
|
tests/conftest.py,sha256=6054YlpuGleV3Wg8BnVj4lnKWhGk-Eqc9JYTXxOmsXs,10782
|
|
38
49
|
tests/test_auth.py,sha256=PoESfWiN92wSGUdVwLL3Z1AP6C1zUsVmgTI7Q8ZdlxM,11074
|
|
39
|
-
tests/test_browser.py,sha256=
|
|
50
|
+
tests/test_browser.py,sha256=6rB6Atqq3b2-xWnKzFdCVFHbF2Q3nt2Dy8Rp4ZwIgNk,20621
|
|
40
51
|
tests/test_cli.py,sha256=G-f9uByWooe-yUOH0ahBdoft4uz8TC0R0OzDs1Lom-4,10014
|
|
52
|
+
tests/test_ecosystem.py,sha256=SkxDWAASELIxzaYWu0d-Rw1HaKSSlyMMenwwF2HWvSA,13227
|
|
41
53
|
tests/test_prompts.py,sha256=3TcJUvSNxhTqfySW6DCrW9MwiMDumciLQRjjbucwqlA,17803
|
|
42
54
|
tests/test_resources.py,sha256=Z0Ex8WdRz-B3VZa1s0eAaDDGbhy7dRdqy1uFVOe2Qbo,12689
|
|
43
55
|
tests/test_server.py,sha256=lLvgbqutnivSgQMNrki0O48whBQt0UXjdwT047nf0nw,14415
|
|
44
|
-
tests/test_tools.py,sha256=
|
|
45
|
-
kubectl_mcp_server-1.
|
|
46
|
-
kubectl_mcp_server-1.
|
|
47
|
-
kubectl_mcp_server-1.
|
|
48
|
-
kubectl_mcp_server-1.
|
|
49
|
-
kubectl_mcp_server-1.
|
|
56
|
+
tests/test_tools.py,sha256=g3moVSpiFgqC107M4tBAQ6xU600rlYMPhnknyYhnTIc,34792
|
|
57
|
+
kubectl_mcp_server-1.16.0.dist-info/METADATA,sha256=3WRkJkEGNeW15Xu_xJSlbp-NU1RVMYYsBIAVDFHhxJM,38116
|
|
58
|
+
kubectl_mcp_server-1.16.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
59
|
+
kubectl_mcp_server-1.16.0.dist-info/entry_points.txt,sha256=zeOxQGaNC4r58deEmqsLCU5hfMjF0VqFUt9P5wWsKEM,109
|
|
60
|
+
kubectl_mcp_server-1.16.0.dist-info/top_level.txt,sha256=o5IpfOGG-lqU8rVWJeK9aYC0r4f6qEX09QiBhZlYbkQ,23
|
|
61
|
+
kubectl_mcp_server-1.16.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.16.0"
|
|
11
11
|
|
|
12
12
|
from .mcp_server import MCPServer
|
|
13
13
|
from .diagnostics import run_diagnostics, check_kubectl_installation, check_cluster_connection
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"""CRD Auto-Discovery Framework for kubectl-mcp-server.
|
|
2
|
+
|
|
3
|
+
Detects installed CRDs in the cluster and enables/disables toolsets accordingly.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import subprocess
|
|
7
|
+
import json
|
|
8
|
+
from typing import Dict, List, Optional, Set
|
|
9
|
+
from functools import lru_cache
|
|
10
|
+
import time
|
|
11
|
+
|
|
12
|
+
from .k8s_config import _get_kubectl_context_args
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
CRD_GROUPS = {
|
|
16
|
+
"flux": [
|
|
17
|
+
"kustomizations.kustomize.toolkit.fluxcd.io",
|
|
18
|
+
"helmreleases.helm.toolkit.fluxcd.io",
|
|
19
|
+
"gitrepositories.source.toolkit.fluxcd.io",
|
|
20
|
+
"helmrepositories.source.toolkit.fluxcd.io",
|
|
21
|
+
],
|
|
22
|
+
"argocd": [
|
|
23
|
+
"applications.argoproj.io",
|
|
24
|
+
"applicationsets.argoproj.io",
|
|
25
|
+
"appprojects.argoproj.io",
|
|
26
|
+
],
|
|
27
|
+
"certmanager": [
|
|
28
|
+
"certificates.cert-manager.io",
|
|
29
|
+
"issuers.cert-manager.io",
|
|
30
|
+
"clusterissuers.cert-manager.io",
|
|
31
|
+
"certificaterequests.cert-manager.io",
|
|
32
|
+
"orders.acme.cert-manager.io",
|
|
33
|
+
"challenges.acme.cert-manager.io",
|
|
34
|
+
],
|
|
35
|
+
"kyverno": [
|
|
36
|
+
"clusterpolicies.kyverno.io",
|
|
37
|
+
"policies.kyverno.io",
|
|
38
|
+
"policyreports.wgpolicyk8s.io",
|
|
39
|
+
"clusterpolicyreports.wgpolicyk8s.io",
|
|
40
|
+
],
|
|
41
|
+
"gatekeeper": [
|
|
42
|
+
"constrainttemplates.templates.gatekeeper.sh",
|
|
43
|
+
"configs.config.gatekeeper.sh",
|
|
44
|
+
],
|
|
45
|
+
"velero": [
|
|
46
|
+
"backups.velero.io",
|
|
47
|
+
"restores.velero.io",
|
|
48
|
+
"schedules.velero.io",
|
|
49
|
+
"backupstoragelocations.velero.io",
|
|
50
|
+
],
|
|
51
|
+
"keda": [
|
|
52
|
+
"scaledobjects.keda.sh",
|
|
53
|
+
"scaledjobs.keda.sh",
|
|
54
|
+
"triggerauthentications.keda.sh",
|
|
55
|
+
],
|
|
56
|
+
"cilium": [
|
|
57
|
+
"ciliumnetworkpolicies.cilium.io",
|
|
58
|
+
"ciliumclusterwidenetworkpolicies.cilium.io",
|
|
59
|
+
"ciliumendpoints.cilium.io",
|
|
60
|
+
],
|
|
61
|
+
"istio": [
|
|
62
|
+
"virtualservices.networking.istio.io",
|
|
63
|
+
"destinationrules.networking.istio.io",
|
|
64
|
+
"gateways.networking.istio.io",
|
|
65
|
+
],
|
|
66
|
+
"argorollouts": [
|
|
67
|
+
"rollouts.argoproj.io",
|
|
68
|
+
"analysistemplates.argoproj.io",
|
|
69
|
+
],
|
|
70
|
+
"kubevirt": [
|
|
71
|
+
"virtualmachines.kubevirt.io",
|
|
72
|
+
"virtualmachineinstances.kubevirt.io",
|
|
73
|
+
],
|
|
74
|
+
"capi": [
|
|
75
|
+
"clusters.cluster.x-k8s.io",
|
|
76
|
+
"machines.cluster.x-k8s.io",
|
|
77
|
+
"machinedeployments.cluster.x-k8s.io",
|
|
78
|
+
],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
_crd_cache: Dict[str, Dict[str, bool]] = {}
|
|
83
|
+
_cache_timestamp: Dict[str, float] = {}
|
|
84
|
+
CACHE_TTL = 300
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _get_cluster_crds(context: str = "") -> Set[str]:
|
|
88
|
+
"""Get all CRDs installed in the cluster."""
|
|
89
|
+
try:
|
|
90
|
+
cmd = ["kubectl"] + _get_kubectl_context_args(context) + [
|
|
91
|
+
"get", "crds", "-o", "jsonpath={.items[*].metadata.name}"
|
|
92
|
+
]
|
|
93
|
+
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
|
|
94
|
+
if result.returncode == 0:
|
|
95
|
+
return set(result.stdout.split())
|
|
96
|
+
return set()
|
|
97
|
+
except Exception:
|
|
98
|
+
return set()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def detect_crds(context: str = "", force_refresh: bool = False) -> Dict[str, bool]:
|
|
102
|
+
"""Detect which CRD groups are installed in the cluster.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
context: Kubernetes context to use
|
|
106
|
+
force_refresh: Force refresh the cache
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Dict mapping CRD group name to installed status
|
|
110
|
+
"""
|
|
111
|
+
cache_key = context or "default"
|
|
112
|
+
|
|
113
|
+
if not force_refresh and cache_key in _crd_cache:
|
|
114
|
+
if time.time() - _cache_timestamp.get(cache_key, 0) < CACHE_TTL:
|
|
115
|
+
return _crd_cache[cache_key]
|
|
116
|
+
|
|
117
|
+
installed_crds = _get_cluster_crds(context)
|
|
118
|
+
|
|
119
|
+
result = {}
|
|
120
|
+
for group_name, crds in CRD_GROUPS.items():
|
|
121
|
+
result[group_name] = any(crd in installed_crds for crd in crds)
|
|
122
|
+
|
|
123
|
+
_crd_cache[cache_key] = result
|
|
124
|
+
_cache_timestamp[cache_key] = time.time()
|
|
125
|
+
|
|
126
|
+
return result
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def crd_exists(crd_name: str, context: str = "") -> bool:
|
|
130
|
+
"""Check if a specific CRD exists in the cluster.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
crd_name: Full CRD name (e.g., "certificates.cert-manager.io")
|
|
134
|
+
context: Kubernetes context to use
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
True if CRD exists, False otherwise
|
|
138
|
+
"""
|
|
139
|
+
try:
|
|
140
|
+
cmd = ["kubectl"] + _get_kubectl_context_args(context) + [
|
|
141
|
+
"get", "crd", crd_name, "-o", "name"
|
|
142
|
+
]
|
|
143
|
+
result = subprocess.run(cmd, capture_output=True, text=True, timeout=10)
|
|
144
|
+
return result.returncode == 0
|
|
145
|
+
except Exception:
|
|
146
|
+
return False
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def get_enabled_toolsets(context: str = "") -> List[str]:
|
|
150
|
+
"""Get list of toolsets that should be enabled based on detected CRDs.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
context: Kubernetes context to use
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
List of enabled toolset names
|
|
157
|
+
"""
|
|
158
|
+
crds = detect_crds(context)
|
|
159
|
+
enabled = []
|
|
160
|
+
|
|
161
|
+
if crds.get("flux") or crds.get("argocd"):
|
|
162
|
+
enabled.append("gitops")
|
|
163
|
+
if crds.get("certmanager"):
|
|
164
|
+
enabled.append("certs")
|
|
165
|
+
if crds.get("kyverno") or crds.get("gatekeeper"):
|
|
166
|
+
enabled.append("policy")
|
|
167
|
+
if crds.get("velero"):
|
|
168
|
+
enabled.append("backup")
|
|
169
|
+
if crds.get("keda"):
|
|
170
|
+
enabled.append("keda")
|
|
171
|
+
if crds.get("cilium"):
|
|
172
|
+
enabled.append("cilium")
|
|
173
|
+
if crds.get("argorollouts"):
|
|
174
|
+
enabled.append("rollouts")
|
|
175
|
+
if crds.get("kubevirt"):
|
|
176
|
+
enabled.append("kubevirt")
|
|
177
|
+
if crds.get("capi"):
|
|
178
|
+
enabled.append("capi")
|
|
179
|
+
if crds.get("istio"):
|
|
180
|
+
enabled.append("istio")
|
|
181
|
+
|
|
182
|
+
return enabled
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def get_crd_status_summary(context: str = "") -> Dict:
|
|
186
|
+
"""Get a summary of CRD detection status.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
context: Kubernetes context to use
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Summary dict with detected CRDs and enabled toolsets
|
|
193
|
+
"""
|
|
194
|
+
crds = detect_crds(context)
|
|
195
|
+
enabled = get_enabled_toolsets(context)
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
"context": context or "current",
|
|
199
|
+
"crd_groups": crds,
|
|
200
|
+
"enabled_toolsets": enabled,
|
|
201
|
+
"total_groups_detected": sum(1 for v in crds.values() if v),
|
|
202
|
+
"total_toolsets_enabled": len(enabled),
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class FeatureNotInstalledError(Exception):
|
|
207
|
+
"""Raised when required CRDs are not installed."""
|
|
208
|
+
|
|
209
|
+
def __init__(self, toolset: str, required_crds: List[str]):
|
|
210
|
+
self.toolset = toolset
|
|
211
|
+
self.required_crds = required_crds
|
|
212
|
+
super().__init__(
|
|
213
|
+
f"{toolset} toolset requires one of these CRDs: {', '.join(required_crds)}. "
|
|
214
|
+
f"Install the required operator to use this feature."
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def require_crd(crd_name: str, toolset: str, context: str = ""):
|
|
219
|
+
"""Check if a CRD exists and raise an error if not.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
crd_name: CRD name to check
|
|
223
|
+
toolset: Toolset name for error message
|
|
224
|
+
context: Kubernetes context
|
|
225
|
+
|
|
226
|
+
Raises:
|
|
227
|
+
FeatureNotInstalledError: If CRD is not installed
|
|
228
|
+
"""
|
|
229
|
+
if not crd_exists(crd_name, context):
|
|
230
|
+
raise FeatureNotInstalledError(toolset, [crd_name])
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def require_any_crd(crd_names: List[str], toolset: str, context: str = ""):
|
|
234
|
+
"""Check if any of the CRDs exist and raise an error if none are found.
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
crd_names: List of CRD names to check
|
|
238
|
+
toolset: Toolset name for error message
|
|
239
|
+
context: Kubernetes context
|
|
240
|
+
|
|
241
|
+
Raises:
|
|
242
|
+
FeatureNotInstalledError: If no CRDs are installed
|
|
243
|
+
"""
|
|
244
|
+
for crd in crd_names:
|
|
245
|
+
if crd_exists(crd, context):
|
|
246
|
+
return
|
|
247
|
+
raise FeatureNotInstalledError(toolset, crd_names)
|
kubectl_mcp_tool/k8s_config.py
CHANGED
|
@@ -509,3 +509,22 @@ def context_exists(context: str) -> bool:
|
|
|
509
509
|
"""
|
|
510
510
|
contexts = list_contexts()
|
|
511
511
|
return any(ctx["name"] == context for ctx in contexts)
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def _get_kubectl_context_args(context: str = "") -> list:
|
|
515
|
+
"""
|
|
516
|
+
Get kubectl command arguments for specifying a context.
|
|
517
|
+
|
|
518
|
+
This utility function returns the appropriate --context flag arguments
|
|
519
|
+
for kubectl commands when targeting a specific cluster.
|
|
520
|
+
|
|
521
|
+
Args:
|
|
522
|
+
context: Context name (empty string for default context)
|
|
523
|
+
|
|
524
|
+
Returns:
|
|
525
|
+
List of command arguments, e.g., ["--context", "my-cluster"]
|
|
526
|
+
or empty list if no context specified
|
|
527
|
+
"""
|
|
528
|
+
if context and context.strip():
|
|
529
|
+
return ["--context", context.strip()]
|
|
530
|
+
return []
|
kubectl_mcp_tool/mcp_server.py
CHANGED
|
@@ -45,6 +45,16 @@ from kubectl_mcp_tool.tools import (
|
|
|
45
45
|
is_browser_available,
|
|
46
46
|
register_ui_tools,
|
|
47
47
|
is_ui_available,
|
|
48
|
+
register_gitops_tools,
|
|
49
|
+
register_certs_tools,
|
|
50
|
+
register_policy_tools,
|
|
51
|
+
register_backup_tools,
|
|
52
|
+
register_keda_tools,
|
|
53
|
+
register_cilium_tools,
|
|
54
|
+
register_rollouts_tools,
|
|
55
|
+
register_capi_tools,
|
|
56
|
+
register_kubevirt_tools,
|
|
57
|
+
register_istio_tools,
|
|
48
58
|
)
|
|
49
59
|
from kubectl_mcp_tool.resources import register_resources
|
|
50
60
|
from kubectl_mcp_tool.prompts import register_prompts
|
|
@@ -196,6 +206,23 @@ class MCPServer:
|
|
|
196
206
|
else:
|
|
197
207
|
logger.debug("MCP-UI tools disabled (install mcp-ui-server to enable)")
|
|
198
208
|
|
|
209
|
+
# Register ecosystem tools (GitOps, Cert-Manager, Policy, Backup)
|
|
210
|
+
# These tools auto-detect installed CRDs and gracefully handle missing components
|
|
211
|
+
register_gitops_tools(self.server, self.non_destructive)
|
|
212
|
+
register_certs_tools(self.server, self.non_destructive)
|
|
213
|
+
register_policy_tools(self.server, self.non_destructive)
|
|
214
|
+
register_backup_tools(self.server, self.non_destructive)
|
|
215
|
+
logger.debug("Ecosystem tools registered (GitOps, Certs, Policy, Backup)")
|
|
216
|
+
|
|
217
|
+
# Register advanced ecosystem tools (KEDA, Cilium, Rollouts, CAPI, KubeVirt, Istio)
|
|
218
|
+
register_keda_tools(self.server, self.non_destructive)
|
|
219
|
+
register_cilium_tools(self.server, self.non_destructive)
|
|
220
|
+
register_rollouts_tools(self.server, self.non_destructive)
|
|
221
|
+
register_capi_tools(self.server, self.non_destructive)
|
|
222
|
+
register_kubevirt_tools(self.server, self.non_destructive)
|
|
223
|
+
register_istio_tools(self.server, self.non_destructive)
|
|
224
|
+
logger.debug("Advanced ecosystem tools registered (KEDA, Cilium, Rollouts, CAPI, KubeVirt, Istio)")
|
|
225
|
+
|
|
199
226
|
def setup_resources(self):
|
|
200
227
|
"""Set up MCP resources for Kubernetes data exposure."""
|
|
201
228
|
register_resources(self.server)
|
|
@@ -11,6 +11,16 @@ from .diagnostics import register_diagnostics_tools
|
|
|
11
11
|
from .cost import register_cost_tools
|
|
12
12
|
from .browser import register_browser_tools, is_browser_available
|
|
13
13
|
from .ui import register_ui_tools, is_ui_available
|
|
14
|
+
from .gitops import register_gitops_tools
|
|
15
|
+
from .certs import register_certs_tools
|
|
16
|
+
from .policy import register_policy_tools
|
|
17
|
+
from .backup import register_backup_tools
|
|
18
|
+
from .keda import register_keda_tools
|
|
19
|
+
from .cilium import register_cilium_tools
|
|
20
|
+
from .rollouts import register_rollouts_tools
|
|
21
|
+
from .capi import register_capi_tools
|
|
22
|
+
from .kubevirt import register_kubevirt_tools
|
|
23
|
+
from .kiali import register_istio_tools
|
|
14
24
|
|
|
15
25
|
__all__ = [
|
|
16
26
|
"register_helm_tools",
|
|
@@ -28,4 +38,14 @@ __all__ = [
|
|
|
28
38
|
"is_browser_available",
|
|
29
39
|
"register_ui_tools",
|
|
30
40
|
"is_ui_available",
|
|
41
|
+
"register_gitops_tools",
|
|
42
|
+
"register_certs_tools",
|
|
43
|
+
"register_policy_tools",
|
|
44
|
+
"register_backup_tools",
|
|
45
|
+
"register_keda_tools",
|
|
46
|
+
"register_cilium_tools",
|
|
47
|
+
"register_rollouts_tools",
|
|
48
|
+
"register_capi_tools",
|
|
49
|
+
"register_kubevirt_tools",
|
|
50
|
+
"register_istio_tools",
|
|
31
51
|
]
|