mcp-server-kubernetes 2.7.0 → 2.9.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/README.md +251 -2
- package/dist/index.d.ts +190 -27
- package/dist/index.js +7 -0
- package/dist/models/common-parameters.d.ts +15 -0
- package/dist/models/common-parameters.js +15 -0
- package/dist/models/helm-models.d.ts +18 -5
- package/dist/models/kubectl-models.d.ts +2 -0
- package/dist/tools/exec_in_pod.d.ts +7 -1
- package/dist/tools/exec_in_pod.js +7 -5
- package/dist/tools/helm-operations.d.ts +89 -11
- package/dist/tools/helm-operations.js +297 -106
- package/dist/tools/kubectl-apply.d.ts +12 -6
- package/dist/tools/kubectl-apply.js +9 -10
- package/dist/tools/kubectl-create.d.ts +12 -6
- package/dist/tools/kubectl-create.js +9 -10
- package/dist/tools/kubectl-delete.d.ts +9 -3
- package/dist/tools/kubectl-delete.js +8 -5
- package/dist/tools/kubectl-describe.d.ts +9 -3
- package/dist/tools/kubectl-describe.js +7 -5
- package/dist/tools/kubectl-generic.d.ts +7 -1
- package/dist/tools/kubectl-generic.js +7 -5
- package/dist/tools/kubectl-get.d.ts +9 -3
- package/dist/tools/kubectl-get.js +7 -5
- package/dist/tools/kubectl-logs.d.ts +9 -3
- package/dist/tools/kubectl-logs.js +11 -5
- package/dist/tools/kubectl-operations.d.ts +10 -0
- package/dist/tools/kubectl-operations.js +13 -0
- package/dist/tools/kubectl-patch.d.ts +8 -2
- package/dist/tools/kubectl-patch.js +9 -10
- package/dist/tools/kubectl-rollout.d.ts +7 -1
- package/dist/tools/kubectl-rollout.js +8 -5
- package/dist/tools/kubectl-scale.d.ts +7 -1
- package/dist/tools/kubectl-scale.js +8 -5
- package/dist/tools/node-management.d.ts +100 -0
- package/dist/tools/node-management.js +291 -0
- package/dist/utils/sse.js +21 -0
- package/dist/utils/streamable-http.js +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://github.com/Flux159/mcp-server-kubernetes/issues)
|
|
10
10
|
[](https://github.com/Flux159/mcp-server-kubernetes/pulls)
|
|
11
11
|
[](https://github.com/Flux159/mcp-server-kubernetes/commits/main)
|
|
12
|
-
[](https://archestra.ai/mcp-catalog/flux159__mcp-server-kubernetes)
|
|
13
13
|
|
|
14
14
|
MCP Server that can connect to a Kubernetes cluster and manage it. Supports loading kubeconfig from multiple sources in priority order.
|
|
15
15
|
|
|
@@ -90,6 +90,12 @@ npx mcp-chat --config "%APPDATA%\Claude\claude_desktop_config.json"
|
|
|
90
90
|
- Run Helm operations
|
|
91
91
|
- Install, upgrade, and uninstall charts
|
|
92
92
|
- Support for custom values, repositories, and versions
|
|
93
|
+
- Template-based installation (`helm_template_apply`) to bypass authentication issues
|
|
94
|
+
- Template-based uninstallation (`helm_template_uninstall`) to bypass authentication issues
|
|
95
|
+
- Pod cleanup operations
|
|
96
|
+
- Clean up problematic pods (`cleanup_pods`) in states: Evicted, ContainerStatusUnknown, Completed, Error, ImagePullBackOff, CrashLoopBackOff
|
|
97
|
+
- Node management operations
|
|
98
|
+
- Cordoning, draining, and uncordoning nodes (`node_management`) for maintenance and scaling operations
|
|
93
99
|
- [x] Troubleshooting Prompt (`k8s-diagnose`)
|
|
94
100
|
- Guides through a systematic Kubernetes troubleshooting flow for pods based on a keyword and optional namespace.
|
|
95
101
|
- [x] Non-destructive mode for read and create/update-only access to clusters
|
|
@@ -196,7 +202,7 @@ All read-only and resource creation/update operations remain available:
|
|
|
196
202
|
|
|
197
203
|
- Resource Information: `kubectl_get`, `kubectl_describe`, `kubectl_logs`, `explain_resource`, `list_api_resources`
|
|
198
204
|
- Resource Creation/Modification: `kubectl_apply`, `kubectl_create`, `kubectl_scale`, `kubectl_patch`, `kubectl_rollout`
|
|
199
|
-
- Helm Operations: `install_helm_chart`, `upgrade_helm_chart`
|
|
205
|
+
- Helm Operations: `install_helm_chart`, `upgrade_helm_chart`, `helm_template_apply`, `helm_template_uninstall`
|
|
200
206
|
- Connectivity: `port_forward`, `stop_port_forward`
|
|
201
207
|
- Context Management: `kubectl_context`
|
|
202
208
|
|
|
@@ -207,8 +213,251 @@ The following destructive operations are disabled:
|
|
|
207
213
|
- `kubectl_delete`: Deleting any Kubernetes resources
|
|
208
214
|
- `uninstall_helm_chart`: Uninstalling Helm charts
|
|
209
215
|
- `cleanup`: Cleanup of managed resources
|
|
216
|
+
- `cleanup_pods`: Cleaning up problematic pods
|
|
217
|
+
- `node_management`: Node management operations (can drain nodes)
|
|
210
218
|
- `kubectl_generic`: General kubectl command access (may include destructive operations)
|
|
211
219
|
|
|
220
|
+
### Helm Template Apply Tool
|
|
221
|
+
|
|
222
|
+
The `helm_template_apply` tool provides an alternative way to install Helm charts that bypasses authentication issues commonly encountered with certain Kubernetes configurations. This tool is particularly useful when you encounter errors like:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
WARNING: Kubernetes configuration file is group-readable. This is insecure.
|
|
226
|
+
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Instead of using `helm install` directly, this tool:
|
|
230
|
+
|
|
231
|
+
1. Uses `helm template` to generate YAML manifests from the Helm chart
|
|
232
|
+
2. Applies the generated YAML using `kubectl apply`
|
|
233
|
+
3. Handles namespace creation and cleanup automatically
|
|
234
|
+
|
|
235
|
+
#### Usage Example
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"name": "helm_template_apply",
|
|
240
|
+
"arguments": {
|
|
241
|
+
"name": "events-exporter",
|
|
242
|
+
"chart": ".",
|
|
243
|
+
"namespace": "kube-event-exporter",
|
|
244
|
+
"valuesFile": "values.yaml",
|
|
245
|
+
"createNamespace": true
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
This is equivalent to running:
|
|
251
|
+
```bash
|
|
252
|
+
helm template events-exporter . -f values.yaml > events-exporter.yaml
|
|
253
|
+
kubectl create namespace kube-event-exporter
|
|
254
|
+
kubectl apply -f events-exporter.yaml -n kube-event-exporter
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Parameters
|
|
258
|
+
|
|
259
|
+
- `name`: Release name for the Helm chart
|
|
260
|
+
- `chart`: Chart name or path to chart directory
|
|
261
|
+
- `repo`: Chart repository URL (optional if using local chart path)
|
|
262
|
+
- `namespace`: Kubernetes namespace to deploy to
|
|
263
|
+
- `values`: Chart values as an object (optional)
|
|
264
|
+
- `valuesFile`: Path to values.yaml file (optional, alternative to values object)
|
|
265
|
+
- `createNamespace`: Whether to create the namespace if it doesn't exist (default: true)
|
|
266
|
+
|
|
267
|
+
### Pod Cleanup with Existing Tools
|
|
268
|
+
|
|
269
|
+
Pod cleanup can be achieved using the existing `kubectl_get` and `kubectl_delete` tools with field selectors. This approach leverages standard Kubernetes functionality without requiring dedicated cleanup tools.
|
|
270
|
+
|
|
271
|
+
#### Identifying Problematic Pods
|
|
272
|
+
|
|
273
|
+
Use `kubectl_get` with field selectors to identify pods in problematic states:
|
|
274
|
+
|
|
275
|
+
**Get failed pods:**
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"name": "kubectl_get",
|
|
279
|
+
"arguments": {
|
|
280
|
+
"resourceType": "pods",
|
|
281
|
+
"namespace": "default",
|
|
282
|
+
"fieldSelector": "status.phase=Failed"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Get completed pods:**
|
|
288
|
+
```json
|
|
289
|
+
{
|
|
290
|
+
"name": "kubectl_get",
|
|
291
|
+
"arguments": {
|
|
292
|
+
"resourceType": "pods",
|
|
293
|
+
"namespace": "default",
|
|
294
|
+
"fieldSelector": "status.phase=Succeeded"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Get pods with specific conditions:**
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"name": "kubectl_get",
|
|
303
|
+
"arguments": {
|
|
304
|
+
"resourceType": "pods",
|
|
305
|
+
"namespace": "default",
|
|
306
|
+
"fieldSelector": "status.conditions[?(@.type=='Ready')].status=False"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### Deleting Problematic Pods
|
|
312
|
+
|
|
313
|
+
Use `kubectl_delete` with field selectors to delete pods in problematic states:
|
|
314
|
+
|
|
315
|
+
**Delete failed pods:**
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"name": "kubectl_delete",
|
|
319
|
+
"arguments": {
|
|
320
|
+
"resourceType": "pods",
|
|
321
|
+
"namespace": "default",
|
|
322
|
+
"fieldSelector": "status.phase=Failed",
|
|
323
|
+
"force": true,
|
|
324
|
+
"gracePeriodSeconds": 0
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Delete completed pods:**
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"name": "kubectl_delete",
|
|
333
|
+
"arguments": {
|
|
334
|
+
"resourceType": "pods",
|
|
335
|
+
"namespace": "default",
|
|
336
|
+
"fieldSelector": "status.phase=Succeeded",
|
|
337
|
+
"force": true,
|
|
338
|
+
"gracePeriodSeconds": 0
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### Workflow
|
|
344
|
+
|
|
345
|
+
1. **First, identify problematic pods** using `kubectl_get` with appropriate field selectors
|
|
346
|
+
2. **Review the list** of pods in the response
|
|
347
|
+
3. **Delete the pods** using `kubectl_delete` with the same field selectors
|
|
348
|
+
|
|
349
|
+
#### Available Field Selectors
|
|
350
|
+
|
|
351
|
+
- `status.phase=Failed` - Pods that have failed
|
|
352
|
+
- `status.phase=Succeeded` - Pods that have completed successfully
|
|
353
|
+
- `status.phase=Pending` - Pods that are pending
|
|
354
|
+
- `status.conditions[?(@.type=='Ready')].status=False` - Pods that are not ready
|
|
355
|
+
|
|
356
|
+
#### Safety Features
|
|
357
|
+
|
|
358
|
+
- **Field selectors**: Target specific pod states precisely
|
|
359
|
+
- **Force deletion**: Use `force=true` and `gracePeriodSeconds=0` for immediate deletion
|
|
360
|
+
- **Namespace isolation**: Target specific namespaces or use `allNamespaces=true`
|
|
361
|
+
- **Standard kubectl**: Uses well-established Kubernetes patterns
|
|
362
|
+
|
|
363
|
+
### Node Management Tool
|
|
364
|
+
|
|
365
|
+
The `node_management` tool provides comprehensive node management capabilities for Kubernetes clusters, including cordoning, draining, and uncordoning operations. This is essential for cluster maintenance, scaling, and troubleshooting.
|
|
366
|
+
|
|
367
|
+
#### Operations Available
|
|
368
|
+
|
|
369
|
+
- **`list`**: List all nodes with their status and schedulability
|
|
370
|
+
- **`cordon`**: Mark a node as unschedulable (no new pods will be scheduled)
|
|
371
|
+
- **`drain`**: Safely evict all pods from a node and mark it as unschedulable
|
|
372
|
+
- **`uncordon`**: Mark a node as schedulable again
|
|
373
|
+
|
|
374
|
+
#### Usage Examples
|
|
375
|
+
|
|
376
|
+
**1. List all nodes:**
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"name": "node_management",
|
|
380
|
+
"arguments": {
|
|
381
|
+
"operation": "list"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**2. Cordon a node (mark as unschedulable):**
|
|
387
|
+
```json
|
|
388
|
+
{
|
|
389
|
+
"name": "node_management",
|
|
390
|
+
"arguments": {
|
|
391
|
+
"operation": "cordon",
|
|
392
|
+
"nodeName": "worker-node-1"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**3. Drain a node (dry run first):**
|
|
398
|
+
```json
|
|
399
|
+
{
|
|
400
|
+
"name": "node_management",
|
|
401
|
+
"arguments": {
|
|
402
|
+
"operation": "drain",
|
|
403
|
+
"nodeName": "worker-node-1",
|
|
404
|
+
"dryRun": true
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**4. Drain a node (with confirmation):**
|
|
410
|
+
```json
|
|
411
|
+
{
|
|
412
|
+
"name": "node_management",
|
|
413
|
+
"arguments": {
|
|
414
|
+
"operation": "drain",
|
|
415
|
+
"nodeName": "worker-node-1",
|
|
416
|
+
"dryRun": false,
|
|
417
|
+
"confirmDrain": true,
|
|
418
|
+
"force": true,
|
|
419
|
+
"ignoreDaemonsets": true,
|
|
420
|
+
"timeout": "5m"
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**5. Uncordon a node:**
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"name": "node_management",
|
|
429
|
+
"arguments": {
|
|
430
|
+
"operation": "uncordon",
|
|
431
|
+
"nodeName": "worker-node-1"
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Drain Operation Parameters
|
|
437
|
+
|
|
438
|
+
- `force`: Force the operation even if there are pods not managed by controllers
|
|
439
|
+
- `gracePeriod`: Period of time in seconds given to each pod to terminate gracefully
|
|
440
|
+
- `deleteLocalData`: Delete local data even if emptyDir volumes are used
|
|
441
|
+
- `ignoreDaemonsets`: Ignore DaemonSet-managed pods (default: true)
|
|
442
|
+
- `timeout`: The length of time to wait before giving up (e.g., '5m', '1h')
|
|
443
|
+
- `dryRun`: Show what would be done without actually doing it
|
|
444
|
+
- `confirmDrain`: Explicit confirmation to drain the node (required for actual draining)
|
|
445
|
+
|
|
446
|
+
#### Safety Features
|
|
447
|
+
|
|
448
|
+
- **Dry run by default**: Drain operations default to dry run to show what would be done
|
|
449
|
+
- **Explicit confirmation**: Drain operations require `confirmDrain=true` to proceed
|
|
450
|
+
- **Status tracking**: Shows node status before and after operations
|
|
451
|
+
- **Timeout protection**: Configurable timeouts to prevent hanging operations
|
|
452
|
+
- **Graceful termination**: Configurable grace periods for pod termination
|
|
453
|
+
|
|
454
|
+
#### Common Use Cases
|
|
455
|
+
|
|
456
|
+
1. **Cluster Maintenance**: Cordon nodes before maintenance, drain them, perform maintenance, then uncordon
|
|
457
|
+
2. **Node Scaling**: Drain nodes before removing them from the cluster
|
|
458
|
+
3. **Troubleshooting**: Isolate problematic nodes by cordoning them
|
|
459
|
+
4. **Resource Management**: Drain nodes to redistribute workload
|
|
460
|
+
|
|
212
461
|
For additional advanced features, see the [ADVANCED_README.md](ADVANCED_README.md).
|
|
213
462
|
|
|
214
463
|
## Architecture
|
package/dist/index.d.ts
CHANGED
|
@@ -10,9 +10,68 @@ declare const destructiveTools: ({
|
|
|
10
10
|
description: string;
|
|
11
11
|
};
|
|
12
12
|
namespace: {
|
|
13
|
+
type: "string";
|
|
14
|
+
description: string;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
context: {
|
|
18
|
+
type: "string";
|
|
19
|
+
description: string;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
required: string[];
|
|
24
|
+
};
|
|
25
|
+
} | {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: string;
|
|
30
|
+
properties: {
|
|
31
|
+
operation: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
enum: string[];
|
|
35
|
+
};
|
|
36
|
+
nodeName: {
|
|
13
37
|
type: string;
|
|
14
38
|
description: string;
|
|
15
39
|
};
|
|
40
|
+
force: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
gracePeriod: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
default: number;
|
|
49
|
+
};
|
|
50
|
+
deleteLocalData: {
|
|
51
|
+
type: string;
|
|
52
|
+
description: string;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
ignoreDaemonsets: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
timeout: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
dryRun: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
confirmDrain: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
16
75
|
};
|
|
17
76
|
required: string[];
|
|
18
77
|
};
|
|
@@ -38,9 +97,9 @@ declare const destructiveTools: ({
|
|
|
38
97
|
readonly description: "Name of the resource to delete";
|
|
39
98
|
};
|
|
40
99
|
readonly namespace: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
100
|
+
type: "string";
|
|
101
|
+
description: string;
|
|
102
|
+
default: string;
|
|
44
103
|
};
|
|
45
104
|
readonly labelSelector: {
|
|
46
105
|
readonly type: "string";
|
|
@@ -68,6 +127,11 @@ declare const destructiveTools: ({
|
|
|
68
127
|
readonly type: "number";
|
|
69
128
|
readonly description: "Period of time in seconds given to the resource to terminate gracefully";
|
|
70
129
|
};
|
|
130
|
+
readonly context: {
|
|
131
|
+
type: "string";
|
|
132
|
+
description: string;
|
|
133
|
+
default: string;
|
|
134
|
+
};
|
|
71
135
|
};
|
|
72
136
|
readonly required: readonly ["resourceType", "name", "namespace"];
|
|
73
137
|
};
|
|
@@ -83,9 +147,68 @@ declare const allTools: ({
|
|
|
83
147
|
description: string;
|
|
84
148
|
};
|
|
85
149
|
namespace: {
|
|
150
|
+
type: "string";
|
|
151
|
+
description: string;
|
|
152
|
+
default: string;
|
|
153
|
+
};
|
|
154
|
+
context: {
|
|
155
|
+
type: "string";
|
|
156
|
+
description: string;
|
|
157
|
+
default: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
required: string[];
|
|
161
|
+
};
|
|
162
|
+
} | {
|
|
163
|
+
name: string;
|
|
164
|
+
description: string;
|
|
165
|
+
inputSchema: {
|
|
166
|
+
type: string;
|
|
167
|
+
properties: {
|
|
168
|
+
operation: {
|
|
169
|
+
type: string;
|
|
170
|
+
description: string;
|
|
171
|
+
enum: string[];
|
|
172
|
+
};
|
|
173
|
+
nodeName: {
|
|
86
174
|
type: string;
|
|
87
175
|
description: string;
|
|
88
176
|
};
|
|
177
|
+
force: {
|
|
178
|
+
type: string;
|
|
179
|
+
description: string;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
gracePeriod: {
|
|
183
|
+
type: string;
|
|
184
|
+
description: string;
|
|
185
|
+
default: number;
|
|
186
|
+
};
|
|
187
|
+
deleteLocalData: {
|
|
188
|
+
type: string;
|
|
189
|
+
description: string;
|
|
190
|
+
default: boolean;
|
|
191
|
+
};
|
|
192
|
+
ignoreDaemonsets: {
|
|
193
|
+
type: string;
|
|
194
|
+
description: string;
|
|
195
|
+
default: boolean;
|
|
196
|
+
};
|
|
197
|
+
timeout: {
|
|
198
|
+
type: string;
|
|
199
|
+
description: string;
|
|
200
|
+
default: string;
|
|
201
|
+
};
|
|
202
|
+
dryRun: {
|
|
203
|
+
type: string;
|
|
204
|
+
description: string;
|
|
205
|
+
default: boolean;
|
|
206
|
+
};
|
|
207
|
+
confirmDrain: {
|
|
208
|
+
type: string;
|
|
209
|
+
description: string;
|
|
210
|
+
default: boolean;
|
|
211
|
+
};
|
|
89
212
|
};
|
|
90
213
|
required: string[];
|
|
91
214
|
};
|
|
@@ -108,6 +231,11 @@ declare const allTools: ({
|
|
|
108
231
|
description: string;
|
|
109
232
|
default: boolean;
|
|
110
233
|
};
|
|
234
|
+
context: {
|
|
235
|
+
type: "string";
|
|
236
|
+
description: string;
|
|
237
|
+
default: string;
|
|
238
|
+
};
|
|
111
239
|
output: {
|
|
112
240
|
type: string;
|
|
113
241
|
description: string;
|
|
@@ -131,6 +259,11 @@ declare const allTools: ({
|
|
|
131
259
|
type: string;
|
|
132
260
|
description: string;
|
|
133
261
|
};
|
|
262
|
+
context: {
|
|
263
|
+
type: string;
|
|
264
|
+
description: string;
|
|
265
|
+
default: string;
|
|
266
|
+
};
|
|
134
267
|
verbs: {
|
|
135
268
|
type: string;
|
|
136
269
|
items: {
|
|
@@ -239,9 +372,9 @@ declare const allTools: ({
|
|
|
239
372
|
readonly description: "Name of the resource (optional - if not provided, lists all resources of the specified type)";
|
|
240
373
|
};
|
|
241
374
|
readonly namespace: {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
375
|
+
type: "string";
|
|
376
|
+
description: string;
|
|
377
|
+
default: string;
|
|
245
378
|
};
|
|
246
379
|
readonly output: {
|
|
247
380
|
readonly type: "string";
|
|
@@ -266,6 +399,11 @@ declare const allTools: ({
|
|
|
266
399
|
readonly type: "string";
|
|
267
400
|
readonly description: "Sort events by a field (default: lastTimestamp). Only applicable for events.";
|
|
268
401
|
};
|
|
402
|
+
readonly context: {
|
|
403
|
+
type: "string";
|
|
404
|
+
description: string;
|
|
405
|
+
default: string;
|
|
406
|
+
};
|
|
269
407
|
};
|
|
270
408
|
readonly required: readonly ["resourceType", "name", "namespace"];
|
|
271
409
|
};
|
|
@@ -284,9 +422,14 @@ declare const allTools: ({
|
|
|
284
422
|
readonly description: "Name of the resource to describe";
|
|
285
423
|
};
|
|
286
424
|
readonly namespace: {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
425
|
+
type: "string";
|
|
426
|
+
description: string;
|
|
427
|
+
default: string;
|
|
428
|
+
};
|
|
429
|
+
readonly context: {
|
|
430
|
+
type: "string";
|
|
431
|
+
description: string;
|
|
432
|
+
default: string;
|
|
290
433
|
};
|
|
291
434
|
readonly allNamespaces: {
|
|
292
435
|
readonly type: "boolean";
|
|
@@ -311,20 +454,25 @@ declare const allTools: ({
|
|
|
311
454
|
readonly description: "Path to a YAML file to apply (optional - use either manifest or filename)";
|
|
312
455
|
};
|
|
313
456
|
readonly namespace: {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
457
|
+
type: "string";
|
|
458
|
+
description: string;
|
|
459
|
+
default: string;
|
|
317
460
|
};
|
|
318
461
|
readonly dryRun: {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
462
|
+
type: "boolean";
|
|
463
|
+
description: string;
|
|
464
|
+
default: boolean;
|
|
322
465
|
};
|
|
323
466
|
readonly force: {
|
|
324
467
|
readonly type: "boolean";
|
|
325
468
|
readonly description: "If true, immediately remove resources from API and bypass graceful deletion";
|
|
326
469
|
readonly default: false;
|
|
327
470
|
};
|
|
471
|
+
readonly context: {
|
|
472
|
+
type: "string";
|
|
473
|
+
description: string;
|
|
474
|
+
default: string;
|
|
475
|
+
};
|
|
328
476
|
};
|
|
329
477
|
readonly required: readonly [];
|
|
330
478
|
};
|
|
@@ -343,9 +491,9 @@ declare const allTools: ({
|
|
|
343
491
|
readonly description: "Name of the resource to delete";
|
|
344
492
|
};
|
|
345
493
|
readonly namespace: {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
494
|
+
type: "string";
|
|
495
|
+
description: string;
|
|
496
|
+
default: string;
|
|
349
497
|
};
|
|
350
498
|
readonly labelSelector: {
|
|
351
499
|
readonly type: "string";
|
|
@@ -373,6 +521,11 @@ declare const allTools: ({
|
|
|
373
521
|
readonly type: "number";
|
|
374
522
|
readonly description: "Period of time in seconds given to the resource to terminate gracefully";
|
|
375
523
|
};
|
|
524
|
+
readonly context: {
|
|
525
|
+
type: "string";
|
|
526
|
+
description: string;
|
|
527
|
+
default: string;
|
|
528
|
+
};
|
|
376
529
|
};
|
|
377
530
|
readonly required: readonly ["resourceType", "name", "namespace"];
|
|
378
531
|
};
|
|
@@ -383,9 +536,9 @@ declare const allTools: ({
|
|
|
383
536
|
readonly type: "object";
|
|
384
537
|
readonly properties: {
|
|
385
538
|
readonly dryRun: {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
539
|
+
type: "boolean";
|
|
540
|
+
description: string;
|
|
541
|
+
default: boolean;
|
|
389
542
|
};
|
|
390
543
|
readonly output: {
|
|
391
544
|
readonly type: "string";
|
|
@@ -415,9 +568,9 @@ declare const allTools: ({
|
|
|
415
568
|
readonly description: "Name of the resource to create";
|
|
416
569
|
};
|
|
417
570
|
readonly namespace: {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
571
|
+
type: "string";
|
|
572
|
+
description: string;
|
|
573
|
+
default: string;
|
|
421
574
|
};
|
|
422
575
|
readonly fromLiteral: {
|
|
423
576
|
readonly type: "array";
|
|
@@ -493,6 +646,11 @@ declare const allTools: ({
|
|
|
493
646
|
};
|
|
494
647
|
readonly description: "Annotations to apply to the resource (e.g. [\"key1=value1\", \"key2=value2\"])";
|
|
495
648
|
};
|
|
649
|
+
readonly context: {
|
|
650
|
+
type: "string";
|
|
651
|
+
description: string;
|
|
652
|
+
default: string;
|
|
653
|
+
};
|
|
496
654
|
};
|
|
497
655
|
readonly required: readonly [];
|
|
498
656
|
};
|
|
@@ -512,9 +670,9 @@ declare const allTools: ({
|
|
|
512
670
|
readonly description: "Name of the resource";
|
|
513
671
|
};
|
|
514
672
|
readonly namespace: {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
673
|
+
type: "string";
|
|
674
|
+
description: string;
|
|
675
|
+
default: string;
|
|
518
676
|
};
|
|
519
677
|
readonly container: {
|
|
520
678
|
readonly type: "string";
|
|
@@ -551,6 +709,11 @@ declare const allTools: ({
|
|
|
551
709
|
readonly type: "string";
|
|
552
710
|
readonly description: "Filter resources by label selector";
|
|
553
711
|
};
|
|
712
|
+
readonly context: {
|
|
713
|
+
type: "string";
|
|
714
|
+
description: string;
|
|
715
|
+
default: string;
|
|
716
|
+
};
|
|
554
717
|
};
|
|
555
718
|
readonly required: readonly ["resourceType", "name", "namespace"];
|
|
556
719
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { installHelmChart, installHelmChartSchema, upgradeHelmChart, upgradeHelmChartSchema, uninstallHelmChart, uninstallHelmChartSchema, } from "./tools/helm-operations.js";
|
|
5
|
+
import { nodeManagement, nodeManagementSchema, } from "./tools/node-management.js";
|
|
5
6
|
import { explainResource, explainResourceSchema, listApiResources, listApiResourcesSchema, } from "./tools/kubectl-operations.js";
|
|
6
7
|
import { execInPod, execInPodSchema } from "./tools/exec_in_pod.js";
|
|
7
8
|
import { getResourceHandlers } from "./resources/handlers.js";
|
|
@@ -45,6 +46,7 @@ const destructiveTools = [
|
|
|
45
46
|
uninstallHelmChartSchema,
|
|
46
47
|
cleanupSchema, // Cleanup is also destructive as it deletes resources
|
|
47
48
|
kubectlGenericSchema, // Generic kubectl command can perform destructive operations
|
|
49
|
+
nodeManagementSchema, // Node management can drain nodes (destructive)
|
|
48
50
|
];
|
|
49
51
|
// Get all available tools
|
|
50
52
|
const allTools = [
|
|
@@ -68,6 +70,7 @@ const allTools = [
|
|
|
68
70
|
installHelmChartSchema,
|
|
69
71
|
upgradeHelmChartSchema,
|
|
70
72
|
uninstallHelmChartSchema,
|
|
73
|
+
nodeManagementSchema,
|
|
71
74
|
// Port forwarding
|
|
72
75
|
PortForwardSchema,
|
|
73
76
|
StopPortForwardSchema,
|
|
@@ -156,6 +159,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
156
159
|
labelSelector: input.labelSelector,
|
|
157
160
|
sortBy: input.sortBy,
|
|
158
161
|
output: input.output,
|
|
162
|
+
context: input.context,
|
|
159
163
|
});
|
|
160
164
|
}
|
|
161
165
|
// Handle specific non-kubectl operations
|
|
@@ -185,6 +189,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
185
189
|
case "upgrade_helm_chart": {
|
|
186
190
|
return await upgradeHelmChart(input);
|
|
187
191
|
}
|
|
192
|
+
case "node_management": {
|
|
193
|
+
return await nodeManagement(input);
|
|
194
|
+
}
|
|
188
195
|
case "list_api_resources": {
|
|
189
196
|
return await listApiResources(input);
|
|
190
197
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const contextParameter: {
|
|
2
|
+
type: "string";
|
|
3
|
+
description: string;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const namespaceParameter: {
|
|
7
|
+
type: "string";
|
|
8
|
+
description: string;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const dryRunParameter: {
|
|
12
|
+
type: "boolean";
|
|
13
|
+
description: string;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const contextParameter = {
|
|
2
|
+
type: "string",
|
|
3
|
+
description: "Kubeconfig Context to use for the command (optional - defaults to null)",
|
|
4
|
+
default: "",
|
|
5
|
+
};
|
|
6
|
+
export const namespaceParameter = {
|
|
7
|
+
type: "string",
|
|
8
|
+
description: "Kubernetes namespace",
|
|
9
|
+
default: "default",
|
|
10
|
+
};
|
|
11
|
+
export const dryRunParameter = {
|
|
12
|
+
type: "boolean",
|
|
13
|
+
description: "If true, only validate the resource, don't actually execute the operation",
|
|
14
|
+
default: false,
|
|
15
|
+
};
|