kubeview-mcp 1.5.1 → 1.7.0
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.
- package/CHANGELOG.md +22 -0
- package/README.md +44 -12
- package/SKILL.md +272 -0
- package/TODO.md +11 -0
- package/dist/src/kubernetes/resources/HelmReleaseOperations.d.ts +62 -0
- package/dist/src/kubernetes/resources/HelmReleaseOperations.d.ts.map +1 -0
- package/dist/src/kubernetes/resources/HelmReleaseOperations.js +381 -0
- package/dist/src/kubernetes/resources/HelmReleaseOperations.js.map +1 -0
- package/dist/src/plugins/HelmToolsPlugin.d.ts +3 -1
- package/dist/src/plugins/HelmToolsPlugin.d.ts.map +1 -1
- package/dist/src/plugins/HelmToolsPlugin.js +43 -6
- package/dist/src/plugins/HelmToolsPlugin.js.map +1 -1
- package/dist/src/server/MCPServer.d.ts +11 -0
- package/dist/src/server/MCPServer.d.ts.map +1 -1
- package/dist/src/server/MCPServer.js +70 -23
- package/dist/src/server/MCPServer.js.map +1 -1
- package/dist/src/tools/helm/BaseTool.d.ts +2 -1
- package/dist/src/tools/helm/BaseTool.d.ts.map +1 -1
- package/dist/src/tools/helm/BaseTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetHooksTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmGetHooksTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetHooksTool.js +1 -1
- package/dist/src/tools/helm/HelmGetHooksTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetManifestTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmGetManifestTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetManifestTool.js +1 -1
- package/dist/src/tools/helm/HelmGetManifestTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetNotesTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmGetNotesTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetNotesTool.js +1 -1
- package/dist/src/tools/helm/HelmGetNotesTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetResourcesTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmGetResourcesTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetResourcesTool.js +1 -1
- package/dist/src/tools/helm/HelmGetResourcesTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetTool.d.ts +4 -2
- package/dist/src/tools/helm/HelmGetTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetTool.js +179 -91
- package/dist/src/tools/helm/HelmGetTool.js.map +1 -1
- package/dist/src/tools/helm/HelmGetValuesTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmGetValuesTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmGetValuesTool.js +1 -1
- package/dist/src/tools/helm/HelmGetValuesTool.js.map +1 -1
- package/dist/src/tools/helm/HelmHistoryTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmHistoryTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmHistoryTool.js +1 -1
- package/dist/src/tools/helm/HelmHistoryTool.js.map +1 -1
- package/dist/src/tools/helm/HelmListTool.d.ts +3 -1
- package/dist/src/tools/helm/HelmListTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmListTool.js +42 -10
- package/dist/src/tools/helm/HelmListTool.js.map +1 -1
- package/dist/src/tools/helm/HelmListWithResourcesTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmListWithResourcesTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmListWithResourcesTool.js +1 -1
- package/dist/src/tools/helm/HelmListWithResourcesTool.js.map +1 -1
- package/dist/src/tools/helm/HelmStatusTool.d.ts +2 -1
- package/dist/src/tools/helm/HelmStatusTool.d.ts.map +1 -1
- package/dist/src/tools/helm/HelmStatusTool.js +1 -1
- package/dist/src/tools/helm/HelmStatusTool.js.map +1 -1
- package/dist/src/tools/meta/PlanStepTool.d.ts +70 -0
- package/dist/src/tools/meta/PlanStepTool.d.ts.map +1 -0
- package/dist/src/tools/meta/PlanStepTool.js +109 -0
- package/dist/src/tools/meta/PlanStepTool.js.map +1 -0
- package/dist/src/utils/HelmDataParser.d.ts +51 -0
- package/dist/src/utils/HelmDataParser.d.ts.map +1 -0
- package/dist/src/utils/HelmDataParser.js +144 -0
- package/dist/src/utils/HelmDataParser.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/tests/compat/McpSdkCompatibility.test.d.ts +2 -0
- package/dist/tests/compat/McpSdkCompatibility.test.d.ts.map +1 -0
- package/dist/tests/compat/McpSdkCompatibility.test.js +72 -0
- package/dist/tests/compat/McpSdkCompatibility.test.js.map +1 -0
- package/dist/tests/helm/HelmGetTool.test.d.ts +2 -0
- package/dist/tests/helm/HelmGetTool.test.d.ts.map +1 -0
- package/dist/tests/helm/HelmGetTool.test.js +78 -0
- package/dist/tests/helm/HelmGetTool.test.js.map +1 -0
- package/dist/tests/kubernetes/HelmReleaseOperations.test.d.ts +2 -0
- package/dist/tests/kubernetes/HelmReleaseOperations.test.d.ts.map +1 -0
- package/dist/tests/kubernetes/HelmReleaseOperations.test.js +218 -0
- package/dist/tests/kubernetes/HelmReleaseOperations.test.js.map +1 -0
- package/dist/tests/server/MCPServer.integration.test.js +91 -0
- package/dist/tests/server/MCPServer.integration.test.js.map +1 -1
- package/dist/tests/server/MCPServer.test.js +14 -0
- package/dist/tests/server/MCPServer.test.js.map +1 -1
- package/dist/tests/tools/meta/PlanStepTool.test.d.ts +2 -0
- package/dist/tests/tools/meta/PlanStepTool.test.d.ts.map +1 -0
- package/dist/tests/tools/meta/PlanStepTool.test.js +78 -0
- package/dist/tests/tools/meta/PlanStepTool.test.js.map +1 -0
- package/dist/tests/utils/HelmDataParser.test.d.ts +2 -0
- package/dist/tests/utils/HelmDataParser.test.d.ts.map +1 -0
- package/dist/tests/utils/HelmDataParser.test.js +81 -0
- package/dist/tests/utils/HelmDataParser.test.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.7.0] - 2026-02-17
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **feat(helm): add API-first backend support for Helm commands**
|
|
14
|
+
- **feat(helm): add CLI fallback support for Helm v4 commands**
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- **Refactor CLI run-command.js to simplify Kubernetes and Helm tool class handling**
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [1.6.0] - 2026-02-04
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- **MCP SDK compatibility hardening**: Pin `@modelcontextprotocol/sdk` to `^1.25.3`.
|
|
24
|
+
- **Type import policy**: Disallow removed loose type exports (`Tools`, `Prompts`, `Resources`, `Roots`, `Sampling`) from `@modelcontextprotocol/sdk/types.js`.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- Introduced the plan_step tool for structured planning and tracking during investigations.
|
|
28
|
+
- Added detailed skills documentation for debugging Kubernetes clusters in SKILL.md.
|
|
29
|
+
- Improved error handling for malformed JSON-RPC payloads in MCPServer.
|
|
30
|
+
- Added tests for the new plan_step tool and ensured compatibility with the updated SDK.
|
|
31
|
+
|
|
10
32
|
## [1.5.1] - 2026-01-14
|
|
11
33
|
|
|
12
34
|
### Changed
|
package/README.md
CHANGED
|
@@ -14,18 +14,26 @@ Learn more about the benefits of code mode and implementation in [Evicting MCP t
|
|
|
14
14
|
- **🧠 Code Mode**: Sandboxed TypeScript environment for complex reasoning and multi-step workflows.
|
|
15
15
|
- **🛡️ Read-Only & Safe**: Designed for production safety with zero write access and sensitive data masking.
|
|
16
16
|
- **☸️ Kubernetes Integration**: List/get resources, fetch metrics, stream logs and events, execute commands, and tools to diagnose network issues.
|
|
17
|
-
- **📦 Helm Support**: Inspect releases, values, manifests, and history.
|
|
17
|
+
- **📦 Helm Support (API-first)**: Inspect releases, values, manifests, and history via Kubernetes API first, with the CLI fallback.
|
|
18
18
|
- **🐙 Argo Ecosystem**: Manage Argo Workflows and Argo CD applications using direct Kubernetes API or CLI.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## MCP SDK Compatibility
|
|
23
|
+
|
|
24
|
+
- This project is pinned to `@modelcontextprotocol/sdk@^1.25.3`.
|
|
25
|
+
- Legacy loose type imports (`Tools`, `Prompts`, `Resources`, `Roots`, `Sampling`) are disallowed.
|
|
26
|
+
- This compatibility pass intentionally excludes Streamable HTTP transport migration and icon metadata rollout.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
22
30
|
## 🚀 Quick Start
|
|
23
31
|
|
|
24
32
|
### Prerequisites
|
|
25
33
|
|
|
26
34
|
- Node.js ≥ 18
|
|
27
35
|
- Access to a Kubernetes cluster
|
|
28
|
-
- Optionally, CLIs installed in current $PATH: `helm
|
|
36
|
+
- Optionally, CLIs installed in current $PATH: `helm` (fallback only), `argo`, `argocd`
|
|
29
37
|
|
|
30
38
|
### Installation
|
|
31
39
|
|
|
@@ -56,18 +64,19 @@ Add to your `mcpServers` configuration (e.g., in Cursor or Claude Desktop):
|
|
|
56
64
|
|
|
57
65
|
Configure the server using environment variables:
|
|
58
66
|
|
|
59
|
-
| Variable
|
|
60
|
-
|
|
61
|
-
| `KUBECONFIG`
|
|
62
|
-
| `MCP_MODE`
|
|
63
|
-
| `MCP_LOG_LEVEL`
|
|
64
|
-
| `MCP_HIDE_SENSITIVE` | Enable global sensitive data masking
|
|
67
|
+
| Variable | Description | Default |
|
|
68
|
+
| -------------------- | -------------------------------------------- | ---------------- |
|
|
69
|
+
| `KUBECONFIG` | Path to kubeconfig file | `~/.kube/config` |
|
|
70
|
+
| `MCP_MODE` | Server mode: `all`, `code`, or `tools` | `all` |
|
|
71
|
+
| `MCP_LOG_LEVEL` | Log level (`error`, `warn`, `info`, `debug`) | `info` |
|
|
72
|
+
| `MCP_HIDE_SENSITIVE` | Enable global sensitive data masking | `false` |
|
|
65
73
|
|
|
66
74
|
---
|
|
67
75
|
|
|
68
76
|
## 🛠️ Tools Overview
|
|
69
77
|
|
|
70
78
|
### Kubernetes
|
|
79
|
+
|
|
71
80
|
- **`kube_list`**: List resources or get cluster diagnostics.
|
|
72
81
|
- **`kube_get`**: Describe specific resources (supports all K8s types).
|
|
73
82
|
- **`kube_metrics`**: Fetch CPU/memory metrics for nodes and pods.
|
|
@@ -77,15 +86,36 @@ Configure the server using environment variables:
|
|
|
77
86
|
- **`kube_net`**: Run in-cluster network diagnostics.
|
|
78
87
|
|
|
79
88
|
### Helm
|
|
80
|
-
|
|
81
|
-
- **`
|
|
89
|
+
|
|
90
|
+
- **`helm_list`**: List Helm releases (Kubernetes API first, CLI fallback).
|
|
91
|
+
- **`helm_get`**: Fetch release values, manifests, notes, hooks, resources, status, and history (Kubernetes API first, CLI fallback).
|
|
92
|
+
|
|
93
|
+
### Helm Execution Strategy
|
|
94
|
+
|
|
95
|
+
- Helm tools are **API-first by default** and read Helm release metadata from Kubernetes storage backends (Secrets and ConfigMaps).
|
|
96
|
+
- Helm CLI is retained as a compatibility fallback path.
|
|
97
|
+
- In normal read-only scenarios with Kubernetes API access, Helm operations do not require the `helm` binary.
|
|
98
|
+
- If Helm is configured with a non-Kubernetes storage backend (for example SQL), CLI fallback may be required.
|
|
99
|
+
- For `helm_get`/`helm_list`, JSON/default behavior uses API first; non-JSON formatting may use CLI fallback.
|
|
82
100
|
|
|
83
101
|
### Argo
|
|
102
|
+
|
|
84
103
|
- **`argo_list` / `argo_get`**: Manage Argo Workflows.
|
|
85
104
|
- **`argocd_app`**: Inspect Argo CD applications and resources.
|
|
86
105
|
|
|
87
106
|
### Utilities
|
|
107
|
+
|
|
88
108
|
- **`run_code`**: Execute sandboxed TypeScript code for complex tasks.
|
|
109
|
+
- **`plan_step`**: Record step-by-step planning state for long, complex investigations.
|
|
110
|
+
|
|
111
|
+
### Why `plan_step` really helps:
|
|
112
|
+
|
|
113
|
+
1. **Stable multi-step planning without bloating chat context.**
|
|
114
|
+
Instead of dumping a massive plan into the conversation, the agent can store step-by-step progress in `plan_step` and keep user-facing responses clean.
|
|
115
|
+
2. **A consistent state machine for long tasks.**
|
|
116
|
+
Complex workflows usually need: plan -> execute step 1 -> verify -> step 2 -> backtrack -> branch -> finalize. `plan_step` gives the agent a structured way to follow that lifecycle without losing track.
|
|
117
|
+
3. **Better tool routing.**
|
|
118
|
+
Good agents alternate between thinking and acting. `plan_step` encourages that rhythm: log intent, call real tools, capture outcome, decide next step.
|
|
89
119
|
|
|
90
120
|
---
|
|
91
121
|
|
|
@@ -108,9 +138,9 @@ For complex tasks requiring logic, loops, or data processing, use **Code Mode**:
|
|
|
108
138
|
"env": { "MCP_MODE": "code" }
|
|
109
139
|
```
|
|
110
140
|
|
|
111
|
-
### 💡 Pro Tip:
|
|
141
|
+
### 💡 Pro Tip: `code-mode` MCP Prompt
|
|
112
142
|
|
|
113
|
-
The server includes a built-in prompt named **`code-mode`** that injects the full TypeScript API documentation, tool overview, and examples into the context.
|
|
143
|
+
The server includes a built-in MCP server prompt named **`code-mode`** that injects the full TypeScript API documentation, tool overview, and examples into the context.
|
|
114
144
|
|
|
115
145
|
**In Cursor IDE**:
|
|
116
146
|
Simply type `/kubeview/code-mode` in the prompt (or select it from the `/` prompt menu). This gives the AI the exact context it needs to write correct `run_code` scripts immediately.
|
|
@@ -120,6 +150,7 @@ Simply type `/kubeview/code-mode` in the prompt (or select it from the `/` promp
|
|
|
120
150
|
## 💻 Local Development
|
|
121
151
|
|
|
122
152
|
1. **Clone & Install**:
|
|
153
|
+
|
|
123
154
|
```bash
|
|
124
155
|
git clone https://github.com/mikhae1/kubeview-mcp.git
|
|
125
156
|
cd kubeview-mcp
|
|
@@ -127,6 +158,7 @@ Simply type `/kubeview/code-mode` in the prompt (or select it from the `/` promp
|
|
|
127
158
|
```
|
|
128
159
|
|
|
129
160
|
2. **Build & Run**:
|
|
161
|
+
|
|
130
162
|
```bash
|
|
131
163
|
npm run build
|
|
132
164
|
npm start
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kubeview-debug
|
|
3
|
+
description: Debug and diagnose Kubernetes clusters using KubeView MCP server tools. Use when investigating cluster issues (pod crashes, deployment failures, service connectivity problems, node issues, resource constraints), performing cluster health checks, or troubleshooting any Kubernetes workload. Trigger phrases include "cluster health", "pod won't start", "CrashLoopBackOff", "service unreachable", "deployment stuck", "node pressure", "OOMKilled", "ImagePullBackOff".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kubernetes Cluster Debugging
|
|
7
|
+
|
|
8
|
+
Reusable investigation playbooks for debugging Kubernetes clusters using KubeView MCP.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
- **Read-Only**: Avoid state changes unless explicitly authorized.
|
|
13
|
+
- **Prefer MCP Tools**: Use `kube_*` tools over `kubectl` commands.
|
|
14
|
+
- **Security First**: Treat output as potentially sensitive.
|
|
15
|
+
- **Declarative Fixes**: Provide YAML snippets rather than imperative `kubectl` commands.
|
|
16
|
+
|
|
17
|
+
## Tool Quick Reference
|
|
18
|
+
|
|
19
|
+
- **Cluster & Workloads**: `kube_list`, `kube_get`, `kube_metrics`
|
|
20
|
+
- **Logs**: `kube_logs` (single pod), `kube_log` (multi-pod with filters + events)
|
|
21
|
+
- **Network**: `kube_net`, `kube_exec`, `kube_port`
|
|
22
|
+
- **Discovery**: `search_tools` (tools-mode), `run_code` (code-mode)
|
|
23
|
+
|
|
24
|
+
In code-mode, tools become `tools.kubernetes.*` (e.g., `tools.kubernetes.list`).
|
|
25
|
+
|
|
26
|
+
## Debugging Decision Tree
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Issue reported
|
|
30
|
+
│
|
|
31
|
+
├─ Pod not running? ──────────► Skill: Debug Pod Failures
|
|
32
|
+
│
|
|
33
|
+
├─ Service unreachable? ──────► Skill: Debug Service Connectivity
|
|
34
|
+
│
|
|
35
|
+
├─ Deployment stuck? ─────────► Skill: Debug Deployment Rollout
|
|
36
|
+
│
|
|
37
|
+
├─ Node issues? ──────────────► Skill: Node Debugging
|
|
38
|
+
│
|
|
39
|
+
└─ Performance/Resources? ────► Skill: Resource Debugging
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Skill: Cluster Triage
|
|
45
|
+
|
|
46
|
+
**When**: Get high-level cluster health overview, identify problem areas.
|
|
47
|
+
|
|
48
|
+
**Trigger**: "cluster health", "triage the cluster", "what's wrong"
|
|
49
|
+
|
|
50
|
+
**Steps**:
|
|
51
|
+
|
|
52
|
+
1. **Cluster diagnostics**
|
|
53
|
+
```json
|
|
54
|
+
{ "tool": "kube_list", "args": {} }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. **Metrics + top consumers**
|
|
58
|
+
```json
|
|
59
|
+
{ "tool": "kube_metrics", "args": { "diagnostics": true, "includeSummary": true, "topN": 5 } }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. **Drill into problem namespaces**
|
|
63
|
+
- Identify namespaces with high `CrashLoopBackOff` or `Pending` counts
|
|
64
|
+
```json
|
|
65
|
+
{ "tool": "kube_list", "args": { "namespace": "<ns>" } }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Skill: Debug Pod Failures
|
|
71
|
+
|
|
72
|
+
**When**: Pod is Pending, CrashLoopBackOff, ImagePullBackOff, or OOMKilled.
|
|
73
|
+
|
|
74
|
+
**Trigger**: "pod won't start", "CrashLoopBackOff", "ImagePullBackOff", "OOMKilled"
|
|
75
|
+
|
|
76
|
+
**Steps**:
|
|
77
|
+
|
|
78
|
+
1. **Describe pod with events**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"tool": "kube_get",
|
|
82
|
+
"args": {
|
|
83
|
+
"resourceType": "pod",
|
|
84
|
+
"name": "<pod>",
|
|
85
|
+
"namespace": "<ns>",
|
|
86
|
+
"includeEvents": true,
|
|
87
|
+
"includeDiagnostics": true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. **Check logs (current & previous)**
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"tool": "kube_logs",
|
|
96
|
+
"args": { "podName": "<pod>", "namespace": "<ns>", "tailLines": 100, "previous": true }
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. **Common causes**:
|
|
101
|
+
- **CrashLoopBackOff**:
|
|
102
|
+
- Exit 1: App error (check logs)
|
|
103
|
+
- Exit 137: OOMKilled (memory limit too low)
|
|
104
|
+
- Exit 143: SIGTERM timeout
|
|
105
|
+
- **ImagePullBackOff**: Check image name/tag, verify ImagePullSecrets
|
|
106
|
+
- **Pending**: Insufficient resources, node affinity issues, or PVC binding failure
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Skill: Debug Deployment Rollout
|
|
111
|
+
|
|
112
|
+
**When**: Deployment has 0 ready replicas or rollout not progressing.
|
|
113
|
+
|
|
114
|
+
**Trigger**: "deployment stuck", "rollout not progressing", "0/1 ready"
|
|
115
|
+
|
|
116
|
+
**Steps**:
|
|
117
|
+
|
|
118
|
+
1. **Check deployment status**
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"tool": "kube_get",
|
|
122
|
+
"args": {
|
|
123
|
+
"resourceType": "deployment",
|
|
124
|
+
"name": "<deploy>",
|
|
125
|
+
"namespace": "<ns>",
|
|
126
|
+
"includeEvents": true
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. **Inspect ReplicaSets** (Is new RS failing to create pods?)
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"tool": "kube_list",
|
|
135
|
+
"args": { "resourceType": "replicaset", "namespace": "<ns>", "labelSelector": "<k=v>" }
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
3. **Aggregate logs** (Are new pods failing immediately?)
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"tool": "kube_log",
|
|
143
|
+
"args": {
|
|
144
|
+
"namespace": "<ns>",
|
|
145
|
+
"ownerKind": "Deployment",
|
|
146
|
+
"ownerName": "<deploy>",
|
|
147
|
+
"since": "30m",
|
|
148
|
+
"includeEvents": true
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Common issues**:
|
|
154
|
+
- New ReplicaSet can't create pods (quota/errors?)
|
|
155
|
+
- Pods running but failing readiness probe
|
|
156
|
+
- Old ReplicaSets not cleaning up (strategy issue)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Skill: Debug Service Connectivity
|
|
161
|
+
|
|
162
|
+
**When**: Service has no traffic, endpoints missing, or unreachable.
|
|
163
|
+
|
|
164
|
+
**Trigger**: "service unreachable", "no endpoints", "can't reach service"
|
|
165
|
+
|
|
166
|
+
**Steps**:
|
|
167
|
+
|
|
168
|
+
1. **Verify endpoints exist**
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"tool": "kube_get",
|
|
172
|
+
"args": { "resourceType": "endpoints", "name": "<svc>", "namespace": "<ns>" }
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
- Empty? Check Service selector vs Pod labels. Are pods Ready?
|
|
176
|
+
|
|
177
|
+
2. **Test connectivity from cluster**
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"tool": "kube_net",
|
|
181
|
+
"args": {
|
|
182
|
+
"sourcePod": "<debug-pod>",
|
|
183
|
+
"namespace": "<ns>",
|
|
184
|
+
"targetService": "<svc>",
|
|
185
|
+
"runServiceConnectivityTest": true,
|
|
186
|
+
"runDnsTest": true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Skill: Node Debugging
|
|
194
|
+
|
|
195
|
+
**When**: Node-level issues causing pod failures.
|
|
196
|
+
|
|
197
|
+
**Trigger**: "node not ready", "node pressure", "taints blocking pods"
|
|
198
|
+
|
|
199
|
+
**Steps**:
|
|
200
|
+
|
|
201
|
+
1. **List nodes**
|
|
202
|
+
```json
|
|
203
|
+
{ "tool": "kube_list", "args": { "resourceType": "node" } }
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
2. **Describe specific node**
|
|
207
|
+
```json
|
|
208
|
+
{ "tool": "kube_get", "args": { "resourceType": "node", "name": "<node>", "includeEvents": true } }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Key conditions**:
|
|
212
|
+
- **Ready**: Must be `True`
|
|
213
|
+
- **MemoryPressure/DiskPressure/PIDPressure**: If `True`, node is evicting pods
|
|
214
|
+
- **NetworkUnavailable**: CNI plugin failure
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Skill: Resource Debugging
|
|
219
|
+
|
|
220
|
+
**When**: Detecting resource bottlenecks (CPU throttling, OOM).
|
|
221
|
+
|
|
222
|
+
**Trigger**: "CPU throttling", "memory pressure", "high CPU/memory"
|
|
223
|
+
|
|
224
|
+
**Steps**:
|
|
225
|
+
|
|
226
|
+
1. **Top consumers**
|
|
227
|
+
```json
|
|
228
|
+
{ "tool": "kube_metrics", "args": { "topN": 10, "includeSummary": true } }
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
2. **OOMKilled investigation**
|
|
232
|
+
- Check `kube_get` pod status for `LastState: OOMKilled`
|
|
233
|
+
- Solution: Increase memory limit or fix leak
|
|
234
|
+
|
|
235
|
+
3. **CPU throttling**
|
|
236
|
+
- App slow but no errors? Check if usage near CPU limit
|
|
237
|
+
- Solution: Increase CPU limit or remove limit (keep request)
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Advanced: Code Mode Bulk Analysis
|
|
242
|
+
|
|
243
|
+
**When**: Complex queries requiring logic (e.g., "find all pods without resource limits").
|
|
244
|
+
|
|
245
|
+
**Trigger**: "bulk analysis", "find pods without limits", "code mode"
|
|
246
|
+
|
|
247
|
+
**Example**:
|
|
248
|
+
```typescript
|
|
249
|
+
const pods = await tools.kubernetes.list({ resourceType: 'pod' });
|
|
250
|
+
const noLimits = pods.items.filter(p =>
|
|
251
|
+
p.spec.containers.some(c => !c.resources?.limits)
|
|
252
|
+
);
|
|
253
|
+
return { count: noLimits.length, names: noLimits.map(p => p.metadata.name) };
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Multi-Step Investigation Hygiene
|
|
259
|
+
|
|
260
|
+
For complex investigations spanning multiple steps, use `plan_step` to maintain clear progress tracking:
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"tool": "plan_step",
|
|
265
|
+
"args": {
|
|
266
|
+
"step": "Triage cluster health, then drill into failing namespace workloads",
|
|
267
|
+
"stepNumber": 1,
|
|
268
|
+
"totalSteps": 4,
|
|
269
|
+
"nextStepNeeded": true
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
package/TODO.md
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
- Generate SKILL.md with all the tools and their descriptions for ease of use by the agent.
|
|
2
|
+
Make your MCP server “skill-friendly” with a few small technical tweaks
|
|
3
|
+
• Ensure tool names and schemas are stable and descriptive, because Skills rely on predictable interfaces.
|
|
4
|
+
• Provide a single “diagnostics snapshot” tool (even if it internally calls others) so Skills can start with one cheap probe.
|
|
5
|
+
• Include golden examples in your docs/prompts that Skills can copy, and keep them updated as your toolset evolves. This aligns with how Skills are described across Claude/Cursor/Codex: instructions + resources that steer behavior reliably. 
|
|
6
|
+
|
|
7
|
+
- A major trend in 2026 is giving agents tools to "think" before they act.
|
|
8
|
+
Sequential Thinking: Add a tool called `plan_step` that allows the agent to output its reasoning process into a structured format before calling a "real" tool. This improves reliability for complex DevOps tasks.
|
|
9
|
+
https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
- kube_logs (multiple log streams + events, selectors support)
|
|
2
13
|
- add support for k8s context selector
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { KubernetesClient } from '../KubernetesClient.js';
|
|
2
|
+
import { HelmHook, HelmReleaseData } from '../../utils/HelmDataParser.js';
|
|
3
|
+
export interface HelmListReleasesOptions {
|
|
4
|
+
namespace?: string;
|
|
5
|
+
selector?: string;
|
|
6
|
+
statuses?: string[];
|
|
7
|
+
maxReleases?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface HelmGetReleaseOptions {
|
|
10
|
+
releaseName: string;
|
|
11
|
+
namespace?: string;
|
|
12
|
+
revision?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface HelmReleaseSummary {
|
|
15
|
+
name: string;
|
|
16
|
+
namespace: string;
|
|
17
|
+
revision: number;
|
|
18
|
+
updated: string;
|
|
19
|
+
status: string;
|
|
20
|
+
chart: string;
|
|
21
|
+
app_version: string;
|
|
22
|
+
}
|
|
23
|
+
export interface HelmReleaseHistoryEntry {
|
|
24
|
+
revision: number;
|
|
25
|
+
updated: string;
|
|
26
|
+
status: string;
|
|
27
|
+
chart: string;
|
|
28
|
+
app_version: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
export interface HelmReleaseRecord {
|
|
32
|
+
storageBackend: HelmStorageKind;
|
|
33
|
+
storageObjectName: string;
|
|
34
|
+
labels: Record<string, string>;
|
|
35
|
+
release: HelmReleaseData;
|
|
36
|
+
summary: HelmReleaseSummary;
|
|
37
|
+
}
|
|
38
|
+
type HelmStorageKind = 'secret' | 'configmap';
|
|
39
|
+
export declare class HelmReleaseOperations {
|
|
40
|
+
private readonly secretOps;
|
|
41
|
+
private readonly configMapOps;
|
|
42
|
+
constructor(client: KubernetesClient);
|
|
43
|
+
listReleases(options?: HelmListReleasesOptions): Promise<HelmReleaseSummary[]>;
|
|
44
|
+
getRelease(options: HelmGetReleaseOptions): Promise<HelmReleaseRecord>;
|
|
45
|
+
getReleaseHistory(options: HelmGetReleaseOptions & {
|
|
46
|
+
maxRevisions?: number;
|
|
47
|
+
}): Promise<HelmReleaseHistoryEntry[]>;
|
|
48
|
+
getReleaseValues(options: HelmGetReleaseOptions, allValues?: boolean): Promise<any>;
|
|
49
|
+
getReleaseManifest(options: HelmGetReleaseOptions): Promise<string>;
|
|
50
|
+
getReleaseNotes(options: HelmGetReleaseOptions): Promise<string>;
|
|
51
|
+
getReleaseHooks(options: HelmGetReleaseOptions): Promise<HelmHook[]>;
|
|
52
|
+
private buildLabelSelector;
|
|
53
|
+
private listStorageRefs;
|
|
54
|
+
private dedupeRefs;
|
|
55
|
+
private listSecretRefs;
|
|
56
|
+
private listConfigMapRefs;
|
|
57
|
+
private ensureRefHasData;
|
|
58
|
+
private parseReleaseData;
|
|
59
|
+
private toSummary;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=HelmReleaseOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelmReleaseOperations.d.ts","sourceRoot":"","sources":["../../../../src/kubernetes/resources/HelmReleaseOperations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAML,QAAQ,EACR,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,eAAe,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,KAAK,eAAe,GAAG,QAAQ,GAAG,WAAW,CAAC;AA6G9C,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsB;gBAEvC,MAAM,EAAE,gBAAgB;IAK9B,YAAY,CAAC,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAoClF,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyCtE,iBAAiB,CACrB,OAAO,EAAE,qBAAqB,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACzD,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAsC/B,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IAKjF,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnE,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKhE,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAK1E,OAAO,CAAC,kBAAkB;YAiBZ,eAAe;IAmC7B,OAAO,CAAC,UAAU;YAkBJ,cAAc;YAmCd,iBAAiB;YAoCjB,gBAAgB;IAkC9B,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,SAAS;CA8BlB"}
|