mcp-server-kubernetes 1.5.0 → 1.6.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 CHANGED
@@ -66,12 +66,13 @@ npx mcp-chat --config "%APPDATA%\Claude\claude_desktop_config.json"
66
66
  ## Features
67
67
 
68
68
  - [x] Connect to a Kubernetes cluster
69
- - [x] List all pods, services, deployments, nodes
70
- - [x] Describe nodes
69
+ - [x] List all pods, services, deployments
70
+ - [x] List, Describe nodes
71
71
  - [x] Create, describe, delete a pod
72
72
  - [x] List all namespaces, create a namespace
73
73
  - [x] Create custom pod & deployment configs, update deployment replicas
74
74
  - [x] Create, describe, delete, update a service
75
+ - [x] Create, get, update, delete a ConfigMap
75
76
  - [x] Get logs from a pod for debugging (supports pods, deployments, jobs, and label selectors)
76
77
  - [x] Support Helm v3 for installing charts
77
78
  - Install charts with custom values
package/dist/index.js CHANGED
@@ -36,6 +36,9 @@ import { scaleDeployment, scaleDeploymentSchema, } from "./tools/scale_deploymen
36
36
  import { describeDeployment, describeDeploymentSchema, } from "./tools/describe_deployment.js";
37
37
  import { updateDeployment, updateDeploymentSchema, } from "./tools/update_deployment.js";
38
38
  import { createConfigMap, CreateConfigMapSchema, } from "./tools/create_configmap.js";
39
+ import { getConfigMap, GetConfigMapSchema } from "./tools/get_configmap.js";
40
+ import { updateConfigMap, UpdateConfigMapSchema } from "./tools/update_configmap.js";
41
+ import { deleteConfigMap, DeleteConfigMapSchema } from "./tools/delete_configmap.js";
39
42
  import { listContexts, listContextsSchema } from "./tools/list_contexts.js";
40
43
  import { getCurrentContext, getCurrentContextSchema, } from "./tools/get_current_context.js";
41
44
  import { setCurrentContext, setCurrentContextSchema, } from "./tools/set_current_context.js";
@@ -104,6 +107,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
104
107
  DeleteCronJobSchema,
105
108
  CreateConfigMapSchema,
106
109
  updateServiceSchema,
110
+ GetConfigMapSchema,
111
+ UpdateConfigMapSchema,
112
+ DeleteConfigMapSchema,
107
113
  ];
108
114
  // Filter out destructive tools if ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS is set to 'true'
109
115
  const tools = nonDestructiveTools
@@ -246,6 +252,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
246
252
  case "create_configmap": {
247
253
  return await createConfigMap(k8sManager, input);
248
254
  }
255
+ case "get_configmap": {
256
+ return await getConfigMap(k8sManager, input);
257
+ }
258
+ case "update_configmap": {
259
+ return await updateConfigMap(k8sManager, input);
260
+ }
261
+ case "delete_configmap": {
262
+ return await deleteConfigMap(k8sManager, input);
263
+ }
249
264
  case "create_service": {
250
265
  return await createService(k8sManager, input);
251
266
  }
@@ -505,6 +505,77 @@ export declare const CreateConfigMapResponseSchema: z.ZodObject<{
505
505
  success: boolean;
506
506
  }[];
507
507
  }>;
508
+ export declare const GetConfigMapResponseSchema: z.ZodObject<{
509
+ content: z.ZodArray<z.ZodObject<{
510
+ success: z.ZodBoolean;
511
+ message: z.ZodString;
512
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
513
+ }, "strip", z.ZodTypeAny, {
514
+ message: string;
515
+ success: boolean;
516
+ data?: Record<string, string> | undefined;
517
+ }, {
518
+ message: string;
519
+ success: boolean;
520
+ data?: Record<string, string> | undefined;
521
+ }>, "many">;
522
+ }, "strip", z.ZodTypeAny, {
523
+ content: {
524
+ message: string;
525
+ success: boolean;
526
+ data?: Record<string, string> | undefined;
527
+ }[];
528
+ }, {
529
+ content: {
530
+ message: string;
531
+ success: boolean;
532
+ data?: Record<string, string> | undefined;
533
+ }[];
534
+ }>;
535
+ export declare const UpdateConfigMapResponseSchema: z.ZodObject<{
536
+ content: z.ZodArray<z.ZodObject<{
537
+ success: z.ZodBoolean;
538
+ message: z.ZodString;
539
+ }, "strip", z.ZodTypeAny, {
540
+ message: string;
541
+ success: boolean;
542
+ }, {
543
+ message: string;
544
+ success: boolean;
545
+ }>, "many">;
546
+ }, "strip", z.ZodTypeAny, {
547
+ content: {
548
+ message: string;
549
+ success: boolean;
550
+ }[];
551
+ }, {
552
+ content: {
553
+ message: string;
554
+ success: boolean;
555
+ }[];
556
+ }>;
557
+ export declare const DeleteConfigMapResponseSchema: z.ZodObject<{
558
+ content: z.ZodArray<z.ZodObject<{
559
+ success: z.ZodBoolean;
560
+ message: z.ZodString;
561
+ }, "strip", z.ZodTypeAny, {
562
+ message: string;
563
+ success: boolean;
564
+ }, {
565
+ message: string;
566
+ success: boolean;
567
+ }>, "many">;
568
+ }, "strip", z.ZodTypeAny, {
569
+ content: {
570
+ message: string;
571
+ success: boolean;
572
+ }[];
573
+ }, {
574
+ content: {
575
+ message: string;
576
+ success: boolean;
577
+ }[];
578
+ }>;
508
579
  export declare const ListContextsResponseSchema: z.ZodObject<{
509
580
  content: z.ZodArray<z.ZodObject<{
510
581
  type: z.ZodLiteral<"text">;
@@ -85,6 +85,25 @@ export const CreateConfigMapResponseSchema = z.object({
85
85
  message: z.string(),
86
86
  })),
87
87
  });
88
+ export const GetConfigMapResponseSchema = z.object({
89
+ content: z.array(z.object({
90
+ success: z.boolean(),
91
+ message: z.string(),
92
+ data: z.record(z.string(), z.string()).optional(),
93
+ })),
94
+ });
95
+ export const UpdateConfigMapResponseSchema = z.object({
96
+ content: z.array(z.object({
97
+ success: z.boolean(),
98
+ message: z.string(),
99
+ })),
100
+ });
101
+ export const DeleteConfigMapResponseSchema = z.object({
102
+ content: z.array(z.object({
103
+ success: z.boolean(),
104
+ message: z.string(),
105
+ })),
106
+ });
88
107
  export const ListContextsResponseSchema = z.object({
89
108
  content: z.array(ToolResponseContent),
90
109
  });
@@ -0,0 +1,26 @@
1
+ import { KubernetesManager } from "../types.js";
2
+ export declare const DeleteConfigMapSchema: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ namespace: {
12
+ type: string;
13
+ };
14
+ };
15
+ required: string[];
16
+ };
17
+ };
18
+ export declare function deleteConfigMap(k8sManager: KubernetesManager, input: {
19
+ name: string;
20
+ namespace: string;
21
+ }): Promise<{
22
+ content: {
23
+ success: boolean;
24
+ message: string;
25
+ }[];
26
+ }>;
@@ -0,0 +1,49 @@
1
+ export const DeleteConfigMapSchema = {
2
+ name: "delete_configmap",
3
+ description: "Delete a Kubernetes ConfigMap",
4
+ inputSchema: {
5
+ type: "object",
6
+ properties: {
7
+ name: { type: "string" },
8
+ namespace: { type: "string" },
9
+ },
10
+ required: ["name", "namespace"],
11
+ },
12
+ };
13
+ export async function deleteConfigMap(k8sManager, input) {
14
+ try {
15
+ const response = await k8sManager.getCoreApi().deleteNamespacedConfigMap(input.name, input.namespace);
16
+ if (response.response?.statusCode !== undefined &&
17
+ (response.response.statusCode === 200 ||
18
+ response.response.statusCode === 202)) {
19
+ return {
20
+ content: [
21
+ {
22
+ success: true,
23
+ message: `Deleted ConfigMap ${input.name} in namespace ${input.namespace}`,
24
+ },
25
+ ],
26
+ };
27
+ }
28
+ else {
29
+ return {
30
+ content: [
31
+ {
32
+ success: false,
33
+ message: `Failed to delete ConfigMap ${input.name} in namespace ${input.namespace}`,
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ }
39
+ catch (error) {
40
+ return {
41
+ content: [
42
+ {
43
+ success: false,
44
+ message: `Failed to delete ConfigMap ${input.name} in namespace ${input.namespace}. Error: ${error.message}`,
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ }
@@ -0,0 +1,27 @@
1
+ import { KubernetesManager } from "../types.js";
2
+ export declare const GetConfigMapSchema: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ namespace: {
12
+ type: string;
13
+ };
14
+ };
15
+ required: string[];
16
+ };
17
+ };
18
+ export declare function getConfigMap(k8sManager: KubernetesManager, input: {
19
+ name: string;
20
+ namespace: string;
21
+ }): Promise<{
22
+ content: {
23
+ success: boolean;
24
+ message: string;
25
+ data?: Record<string, string>;
26
+ }[];
27
+ }>;
@@ -0,0 +1,48 @@
1
+ export const GetConfigMapSchema = {
2
+ name: "get_configmap",
3
+ description: "Get a Kubernetes ConfigMap",
4
+ inputSchema: {
5
+ type: "object",
6
+ properties: {
7
+ name: { type: "string" },
8
+ namespace: { type: "string" },
9
+ },
10
+ required: ["name", "namespace"],
11
+ },
12
+ };
13
+ export async function getConfigMap(k8sManager, input) {
14
+ try {
15
+ const response = await k8sManager.getCoreApi().readNamespacedConfigMap(input.name, input.namespace);
16
+ if (response.body && response.body.data) {
17
+ return {
18
+ content: [
19
+ {
20
+ success: true,
21
+ message: `Fetched ConfigMap ${input.name} in namespace ${input.namespace}`,
22
+ data: response.body.data,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ else {
28
+ return {
29
+ content: [
30
+ {
31
+ success: false,
32
+ message: `ConfigMap ${input.name} in namespace ${input.namespace} not found or has no data.`,
33
+ },
34
+ ],
35
+ };
36
+ }
37
+ }
38
+ catch (error) {
39
+ return {
40
+ content: [
41
+ {
42
+ success: false,
43
+ message: `Failed to get ConfigMap ${input.name} in namespace ${input.namespace}. Error: ${error.message}`,
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ }
@@ -0,0 +1,33 @@
1
+ import { KubernetesManager } from "../types.js";
2
+ export declare const UpdateConfigMapSchema: {
3
+ name: string;
4
+ description: string;
5
+ inputSchema: {
6
+ type: string;
7
+ properties: {
8
+ name: {
9
+ type: string;
10
+ };
11
+ namespace: {
12
+ type: string;
13
+ };
14
+ data: {
15
+ type: string;
16
+ ConfigData: {
17
+ type: string;
18
+ };
19
+ };
20
+ };
21
+ required: string[];
22
+ };
23
+ };
24
+ export declare function updateConfigMap(k8sManager: KubernetesManager, input: {
25
+ name: string;
26
+ namespace: string;
27
+ data: Record<string, string>;
28
+ }): Promise<{
29
+ content: {
30
+ success: boolean;
31
+ message: string;
32
+ }[];
33
+ }>;
@@ -0,0 +1,71 @@
1
+ export const UpdateConfigMapSchema = {
2
+ name: "update_configmap",
3
+ description: "Update an existing Kubernetes ConfigMap",
4
+ inputSchema: {
5
+ type: "object",
6
+ properties: {
7
+ name: { type: "string" },
8
+ namespace: { type: "string" },
9
+ data: {
10
+ type: "object",
11
+ ConfigData: { type: "string" },
12
+ },
13
+ },
14
+ required: ["name", "namespace", "data"],
15
+ },
16
+ };
17
+ export async function updateConfigMap(k8sManager, input) {
18
+ try {
19
+ // Fetch the existing ConfigMap
20
+ const existing = await k8sManager.getCoreApi().readNamespacedConfigMap(input.name, input.namespace);
21
+ if (!existing.body || !existing.body.metadata) {
22
+ return {
23
+ content: [
24
+ {
25
+ success: false,
26
+ message: `ConfigMap ${input.name} in namespace ${input.namespace} not found.`,
27
+ },
28
+ ],
29
+ };
30
+ }
31
+ // Update the data
32
+ const updatedConfigMap = {
33
+ ...existing.body,
34
+ data: input.data,
35
+ };
36
+ const response = await k8sManager.getCoreApi().replaceNamespacedConfigMap(input.name, input.namespace, updatedConfigMap);
37
+ if (response.response?.statusCode !== undefined &&
38
+ (response.response.statusCode === 200 ||
39
+ response.response.statusCode === 201 ||
40
+ response.response.statusCode === 202)) {
41
+ return {
42
+ content: [
43
+ {
44
+ success: true,
45
+ message: `Updated ConfigMap ${input.name} in namespace ${input.namespace}`,
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ else {
51
+ return {
52
+ content: [
53
+ {
54
+ success: false,
55
+ message: `Failed to update ConfigMap ${input.name} in namespace ${input.namespace}`,
56
+ },
57
+ ],
58
+ };
59
+ }
60
+ }
61
+ catch (error) {
62
+ return {
63
+ content: [
64
+ {
65
+ success: false,
66
+ message: `Failed to update ConfigMap ${input.name} in namespace ${input.namespace}. Error: ${error.message}`,
67
+ },
68
+ ],
69
+ };
70
+ }
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-kubernetes",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "MCP server for interacting with Kubernetes clusters via kubectl",
5
5
  "license": "MIT",
6
6
  "type": "module",