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.
Files changed (38) hide show
  1. package/README.md +251 -2
  2. package/dist/index.d.ts +190 -27
  3. package/dist/index.js +7 -0
  4. package/dist/models/common-parameters.d.ts +15 -0
  5. package/dist/models/common-parameters.js +15 -0
  6. package/dist/models/helm-models.d.ts +18 -5
  7. package/dist/models/kubectl-models.d.ts +2 -0
  8. package/dist/tools/exec_in_pod.d.ts +7 -1
  9. package/dist/tools/exec_in_pod.js +7 -5
  10. package/dist/tools/helm-operations.d.ts +89 -11
  11. package/dist/tools/helm-operations.js +297 -106
  12. package/dist/tools/kubectl-apply.d.ts +12 -6
  13. package/dist/tools/kubectl-apply.js +9 -10
  14. package/dist/tools/kubectl-create.d.ts +12 -6
  15. package/dist/tools/kubectl-create.js +9 -10
  16. package/dist/tools/kubectl-delete.d.ts +9 -3
  17. package/dist/tools/kubectl-delete.js +8 -5
  18. package/dist/tools/kubectl-describe.d.ts +9 -3
  19. package/dist/tools/kubectl-describe.js +7 -5
  20. package/dist/tools/kubectl-generic.d.ts +7 -1
  21. package/dist/tools/kubectl-generic.js +7 -5
  22. package/dist/tools/kubectl-get.d.ts +9 -3
  23. package/dist/tools/kubectl-get.js +7 -5
  24. package/dist/tools/kubectl-logs.d.ts +9 -3
  25. package/dist/tools/kubectl-logs.js +11 -5
  26. package/dist/tools/kubectl-operations.d.ts +10 -0
  27. package/dist/tools/kubectl-operations.js +13 -0
  28. package/dist/tools/kubectl-patch.d.ts +8 -2
  29. package/dist/tools/kubectl-patch.js +9 -10
  30. package/dist/tools/kubectl-rollout.d.ts +7 -1
  31. package/dist/tools/kubectl-rollout.js +8 -5
  32. package/dist/tools/kubectl-scale.d.ts +7 -1
  33. package/dist/tools/kubectl-scale.js +8 -5
  34. package/dist/tools/node-management.d.ts +100 -0
  35. package/dist/tools/node-management.js +291 -0
  36. package/dist/utils/sse.js +21 -0
  37. package/dist/utils/streamable-http.js +21 -0
  38. package/package.json +1 -1
@@ -22,18 +22,31 @@ export declare const HelmResponseSchema: z.ZodObject<{
22
22
  }[];
23
23
  }>;
24
24
  export declare const HelmValuesSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
25
- export interface HelmOperation {
25
+ export interface HelmUninstallOperation {
26
26
  name: string;
27
27
  namespace: string;
28
28
  }
29
- export interface HelmInstallOperation extends HelmOperation {
29
+ export interface HelmInstallOperation {
30
+ name: string;
30
31
  chart: string;
31
- repo: string;
32
+ namespace: string;
33
+ repo?: string;
32
34
  values?: Record<string, any>;
35
+ valuesFile?: string;
36
+ createNamespace?: boolean;
37
+ useTemplate?: boolean;
33
38
  }
34
- export interface HelmUpgradeOperation extends HelmInstallOperation {
39
+ export interface HelmUpgradeOperation {
40
+ name: string;
41
+ chart: string;
42
+ namespace: string;
43
+ repo?: string;
44
+ values?: Record<string, any>;
45
+ valuesFile?: string;
35
46
  }
36
47
  export type HelmResponse = {
37
- status: "installed" | "upgraded" | "uninstalled";
48
+ status: "installed" | "upgraded" | "uninstalled" | "failed";
38
49
  message?: string;
50
+ error?: string;
51
+ steps?: string[];
39
52
  };
@@ -26,10 +26,12 @@ export interface ExplainResourceParams {
26
26
  apiVersion?: string;
27
27
  recursive?: boolean;
28
28
  output?: "plaintext" | "plaintext-openapiv2";
29
+ context?: string;
29
30
  }
30
31
  export interface ListApiResourcesParams {
31
32
  apiGroup?: string;
32
33
  namespaced?: boolean;
33
34
  verbs?: string[];
34
35
  output?: "wide" | "name" | "no-headers";
36
+ context?: string;
35
37
  }
@@ -23,7 +23,7 @@ export declare const execInPodSchema: {
23
23
  description: string;
24
24
  };
25
25
  namespace: {
26
- type: string;
26
+ type: "string";
27
27
  description: string;
28
28
  default: string;
29
29
  };
@@ -51,6 +51,11 @@ export declare const execInPodSchema: {
51
51
  type: string;
52
52
  description: string;
53
53
  };
54
+ context: {
55
+ type: "string";
56
+ description: string;
57
+ default: string;
58
+ };
54
59
  };
55
60
  required: string[];
56
61
  };
@@ -67,6 +72,7 @@ export declare function execInPod(k8sManager: KubernetesManager, input: {
67
72
  container?: string;
68
73
  shell?: string;
69
74
  timeout?: number;
75
+ context?: string;
70
76
  }): Promise<{
71
77
  content: {
72
78
  type: string;
@@ -7,6 +7,7 @@
7
7
  import * as k8s from "@kubernetes/client-node";
8
8
  import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
9
9
  import { Writable } from "stream";
10
+ import { contextParameter, namespaceParameter } from "../models/common-parameters.js";
10
11
  /**
11
12
  * Schema for exec_in_pod tool.
12
13
  * - name: Pod name
@@ -24,11 +25,7 @@ export const execInPodSchema = {
24
25
  type: "string",
25
26
  description: "Name of the pod to execute the command in",
26
27
  },
27
- namespace: {
28
- type: "string",
29
- description: "Kubernetes namespace where the pod is located",
30
- default: "default",
31
- },
28
+ namespace: namespaceParameter,
32
29
  command: {
33
30
  anyOf: [
34
31
  { type: "string" },
@@ -48,6 +45,7 @@ export const execInPodSchema = {
48
45
  type: "number",
49
46
  description: "Timeout for command - 60000 milliseconds if not specified",
50
47
  },
48
+ context: contextParameter,
51
49
  },
52
50
  required: ["name", "command"],
53
51
  },
@@ -93,6 +91,10 @@ export async function execInPod(k8sManager, input) {
93
91
  }
94
92
  });
95
93
  try {
94
+ // Set context if provided
95
+ if (input.context) {
96
+ k8sManager.setCurrentContext(input.context);
97
+ }
96
98
  // Use the Kubernetes client-node Exec API for native exec
97
99
  const kc = k8sManager.getKubeConfig();
98
100
  const exec = new k8s.Exec(kc);
@@ -1,4 +1,21 @@
1
- import { HelmInstallOperation, HelmOperation, HelmUpgradeOperation } from "../models/helm-models.js";
1
+ /**
2
+ * Tool: install_helm_chart
3
+ * Install a Helm chart with support for both standard Helm install and template-based installation.
4
+ * Template mode bypasses authentication issues and kubeconfig API version mismatches.
5
+ * Supports local chart paths, remote repositories, and custom values.
6
+ */
7
+ import { HelmInstallOperation, HelmUpgradeOperation, HelmUninstallOperation } from "../models/helm-models.js";
8
+ /**
9
+ * Schema for install_helm_chart tool.
10
+ * - name: Release name
11
+ * - chart: Chart name or path to chart directory
12
+ * - namespace: Target namespace
13
+ * - repo: (Optional) Helm repository URL
14
+ * - values: (Optional) Custom values object
15
+ * - valuesFile: (Optional) Path to values file
16
+ * - useTemplate: (Optional) Use template mode instead of helm install
17
+ * - createNamespace: (Optional) Create namespace if it doesn't exist
18
+ */
2
19
  export declare const installHelmChartSchema: {
3
20
  name: string;
4
21
  description: string;
@@ -13,24 +30,51 @@ export declare const installHelmChartSchema: {
13
30
  type: string;
14
31
  description: string;
15
32
  };
33
+ namespace: {
34
+ type: "string";
35
+ description: string;
36
+ default: string;
37
+ };
38
+ context: {
39
+ type: "string";
40
+ description: string;
41
+ default: string;
42
+ };
16
43
  repo: {
17
44
  type: string;
18
45
  description: string;
19
46
  };
20
- namespace: {
47
+ values: {
21
48
  type: string;
22
49
  description: string;
23
50
  };
24
- values: {
51
+ valuesFile: {
52
+ type: string;
53
+ description: string;
54
+ };
55
+ useTemplate: {
25
56
  type: string;
26
57
  description: string;
27
- properties: {};
28
- additionalProperties: boolean;
58
+ default: boolean;
59
+ };
60
+ createNamespace: {
61
+ type: string;
62
+ description: string;
63
+ default: boolean;
29
64
  };
30
65
  };
31
66
  required: string[];
32
67
  };
33
68
  };
69
+ /**
70
+ * Schema for upgrade_helm_chart tool.
71
+ * - name: Release name
72
+ * - chart: Chart name or path
73
+ * - namespace: Target namespace
74
+ * - repo: (Optional) Helm repository URL
75
+ * - values: (Optional) Custom values object
76
+ * - valuesFile: (Optional) Path to values file
77
+ */
34
78
  export declare const upgradeHelmChartSchema: {
35
79
  name: string;
36
80
  description: string;
@@ -45,24 +89,37 @@ export declare const upgradeHelmChartSchema: {
45
89
  type: string;
46
90
  description: string;
47
91
  };
92
+ namespace: {
93
+ type: "string";
94
+ description: string;
95
+ default: string;
96
+ };
97
+ context: {
98
+ type: "string";
99
+ description: string;
100
+ default: string;
101
+ };
48
102
  repo: {
49
103
  type: string;
50
104
  description: string;
51
105
  };
52
- namespace: {
106
+ values: {
53
107
  type: string;
54
108
  description: string;
55
109
  };
56
- values: {
110
+ valuesFile: {
57
111
  type: string;
58
112
  description: string;
59
- properties: {};
60
- additionalProperties: boolean;
61
113
  };
62
114
  };
63
115
  required: string[];
64
116
  };
65
117
  };
118
+ /**
119
+ * Schema for uninstall_helm_chart tool.
120
+ * - name: Release name
121
+ * - namespace: Target namespace
122
+ */
66
123
  export declare const uninstallHelmChartSchema: {
67
124
  name: string;
68
125
  description: string;
@@ -74,26 +131,47 @@ export declare const uninstallHelmChartSchema: {
74
131
  description: string;
75
132
  };
76
133
  namespace: {
77
- type: string;
134
+ type: "string";
135
+ description: string;
136
+ default: string;
137
+ };
138
+ context: {
139
+ type: "string";
78
140
  description: string;
141
+ default: string;
79
142
  };
80
143
  };
81
144
  required: string[];
82
145
  };
83
146
  };
147
+ /**
148
+ * Install a Helm chart using standard helm install command.
149
+ * @param params - Installation parameters
150
+ * @returns Promise with installation result
151
+ */
84
152
  export declare function installHelmChart(params: HelmInstallOperation): Promise<{
85
153
  content: {
86
154
  type: string;
87
155
  text: string;
88
156
  }[];
89
157
  }>;
158
+ /**
159
+ * Upgrade an existing Helm chart release.
160
+ * @param params - Upgrade parameters
161
+ * @returns Promise with upgrade result
162
+ */
90
163
  export declare function upgradeHelmChart(params: HelmUpgradeOperation): Promise<{
91
164
  content: {
92
165
  type: string;
93
166
  text: string;
94
167
  }[];
95
168
  }>;
96
- export declare function uninstallHelmChart(params: HelmOperation): Promise<{
169
+ /**
170
+ * Uninstall a Helm chart release.
171
+ * @param params - Uninstall parameters
172
+ * @returns Promise with uninstall result
173
+ */
174
+ export declare function uninstallHelmChart(params: HelmUninstallOperation): Promise<{
97
175
  content: {
98
176
  type: string;
99
177
  text: string;