mcp-server-kubernetes 1.6.2 → 2.1.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 +46 -22
- package/dist/config/container-templates.d.ts +2 -2
- package/dist/index.d.ts +314 -736
- package/dist/index.js +93 -200
- package/dist/models/resource-models.d.ts +6 -6
- package/dist/tools/kubectl-apply.d.ts +46 -0
- package/dist/tools/kubectl-apply.js +110 -0
- package/dist/tools/kubectl-context.d.ts +49 -0
- package/dist/tools/kubectl-context.js +233 -0
- package/dist/tools/kubectl-create.d.ts +150 -0
- package/dist/tools/kubectl-create.js +321 -0
- package/dist/tools/kubectl-delete.d.ts +77 -0
- package/dist/tools/kubectl-delete.js +177 -0
- package/dist/tools/kubectl-describe.d.ts +47 -0
- package/dist/tools/kubectl-describe.js +96 -0
- package/dist/tools/kubectl-generic.d.ts +71 -0
- package/dist/tools/kubectl-generic.js +121 -0
- package/dist/tools/kubectl-get.d.ts +72 -0
- package/dist/tools/kubectl-get.js +251 -0
- package/dist/tools/kubectl-list.d.ts +61 -0
- package/dist/tools/kubectl-list.js +189 -0
- package/dist/tools/{get_logs.d.ts → kubectl-logs.d.ts} +35 -19
- package/dist/tools/kubectl-logs.js +312 -0
- package/dist/tools/kubectl-patch.d.ts +57 -0
- package/dist/tools/kubectl-patch.js +128 -0
- package/dist/tools/kubectl-rollout.d.ts +67 -0
- package/dist/tools/kubectl-rollout.js +115 -0
- package/dist/tools/{scale_deployment.d.ts → kubectl-scale.d.ts} +13 -3
- package/dist/tools/kubectl-scale.js +73 -0
- package/dist/utils/kubernetes-manager.d.ts +4 -0
- package/dist/utils/kubernetes-manager.js +21 -3
- package/package.json +1 -1
- package/dist/tools/create_configmap.d.ts +0 -33
- package/dist/tools/create_configmap.js +0 -66
- package/dist/tools/create_cronjob.d.ts +0 -47
- package/dist/tools/create_cronjob.js +0 -93
- package/dist/tools/create_deployment.d.ts +0 -135
- package/dist/tools/create_deployment.js +0 -162
- package/dist/tools/create_namespace.d.ts +0 -22
- package/dist/tools/create_namespace.js +0 -48
- package/dist/tools/create_pod.d.ts +0 -130
- package/dist/tools/create_pod.js +0 -153
- package/dist/tools/create_service.d.ts +0 -74
- package/dist/tools/create_service.js +0 -102
- package/dist/tools/delete_configmap.d.ts +0 -26
- package/dist/tools/delete_configmap.js +0 -49
- package/dist/tools/delete_cronjob.d.ts +0 -26
- package/dist/tools/delete_cronjob.js +0 -48
- package/dist/tools/delete_deployment.d.ts +0 -31
- package/dist/tools/delete_deployment.js +0 -47
- package/dist/tools/delete_namespace.d.ts +0 -27
- package/dist/tools/delete_namespace.js +0 -44
- package/dist/tools/delete_pod.d.ts +0 -31
- package/dist/tools/delete_pod.js +0 -45
- package/dist/tools/delete_service.d.ts +0 -32
- package/dist/tools/delete_service.js +0 -46
- package/dist/tools/describe_cronjob.d.ts +0 -27
- package/dist/tools/describe_cronjob.js +0 -83
- package/dist/tools/describe_deployment.d.ts +0 -26
- package/dist/tools/describe_deployment.js +0 -40
- package/dist/tools/describe_node.d.ts +0 -22
- package/dist/tools/describe_node.js +0 -84
- package/dist/tools/describe_pod.d.ts +0 -33
- package/dist/tools/describe_pod.js +0 -81
- package/dist/tools/describe_service.d.ts +0 -34
- package/dist/tools/describe_service.js +0 -85
- package/dist/tools/get_configmap.d.ts +0 -27
- package/dist/tools/get_configmap.js +0 -48
- package/dist/tools/get_current_context.d.ts +0 -23
- package/dist/tools/get_current_context.js +0 -55
- package/dist/tools/get_events.d.ts +0 -28
- package/dist/tools/get_events.js +0 -66
- package/dist/tools/get_job_logs.d.ts +0 -40
- package/dist/tools/get_job_logs.js +0 -104
- package/dist/tools/get_logs.js +0 -150
- package/dist/tools/list_contexts.d.ts +0 -23
- package/dist/tools/list_contexts.js +0 -39
- package/dist/tools/list_cronjobs.d.ts +0 -23
- package/dist/tools/list_cronjobs.js +0 -35
- package/dist/tools/list_deployments.d.ts +0 -23
- package/dist/tools/list_deployments.js +0 -30
- package/dist/tools/list_jobs.d.ts +0 -29
- package/dist/tools/list_jobs.js +0 -77
- package/dist/tools/list_nodes.d.ts +0 -15
- package/dist/tools/list_nodes.js +0 -21
- package/dist/tools/list_pods.d.ts +0 -23
- package/dist/tools/list_pods.js +0 -29
- package/dist/tools/list_services.d.ts +0 -23
- package/dist/tools/list_services.js +0 -31
- package/dist/tools/scale_deployment.js +0 -50
- package/dist/tools/set_current_context.d.ts +0 -23
- package/dist/tools/set_current_context.js +0 -35
- package/dist/tools/update_configmap.d.ts +0 -33
- package/dist/tools/update_configmap.js +0 -71
- package/dist/tools/update_deployment.d.ts +0 -113
- package/dist/tools/update_deployment.js +0 -155
- package/dist/tools/update_service.d.ts +0 -72
- package/dist/tools/update_service.js +0 -125
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export const createCronJobSchema = {
|
|
2
|
-
name: "create_cronjob",
|
|
3
|
-
description: "Create a new Kubernetes CronJob",
|
|
4
|
-
inputSchema: {
|
|
5
|
-
type: "object",
|
|
6
|
-
properties: {
|
|
7
|
-
name: { type: "string" },
|
|
8
|
-
namespace: { type: "string" },
|
|
9
|
-
schedule: { type: "string" },
|
|
10
|
-
image: { type: "string" },
|
|
11
|
-
command: {
|
|
12
|
-
type: "array",
|
|
13
|
-
items: { type: "string" },
|
|
14
|
-
optional: true,
|
|
15
|
-
},
|
|
16
|
-
suspend: {
|
|
17
|
-
type: "boolean",
|
|
18
|
-
optional: true,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
required: ["name", "namespace", "schedule", "image"],
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
export async function createCronJob(k8sManager, input) {
|
|
25
|
-
try {
|
|
26
|
-
const cronJob = {
|
|
27
|
-
apiVersion: "batch/v1",
|
|
28
|
-
kind: "CronJob",
|
|
29
|
-
metadata: {
|
|
30
|
-
name: input.name,
|
|
31
|
-
namespace: input.namespace,
|
|
32
|
-
labels: {
|
|
33
|
-
"mcp-managed": "true",
|
|
34
|
-
app: input.name,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
spec: {
|
|
38
|
-
schedule: input.schedule,
|
|
39
|
-
suspend: input.suspend || false,
|
|
40
|
-
jobTemplate: {
|
|
41
|
-
spec: {
|
|
42
|
-
template: {
|
|
43
|
-
spec: {
|
|
44
|
-
containers: [
|
|
45
|
-
{
|
|
46
|
-
name: input.name,
|
|
47
|
-
image: input.image,
|
|
48
|
-
...(input.command && {
|
|
49
|
-
command: input.command,
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
restartPolicy: "OnFailure",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const response = await k8sManager
|
|
61
|
-
.getBatchApi()
|
|
62
|
-
.createNamespacedCronJob(input.namespace, cronJob)
|
|
63
|
-
.catch((error) => {
|
|
64
|
-
console.error("CronJob creation error:", {
|
|
65
|
-
status: error.response?.statusCode,
|
|
66
|
-
message: error.response?.body?.message || error.message,
|
|
67
|
-
details: error.response?.body,
|
|
68
|
-
});
|
|
69
|
-
throw error;
|
|
70
|
-
});
|
|
71
|
-
k8sManager.trackResource("CronJob", input.name, input.namespace);
|
|
72
|
-
return {
|
|
73
|
-
content: [
|
|
74
|
-
{
|
|
75
|
-
type: "text",
|
|
76
|
-
text: JSON.stringify({
|
|
77
|
-
cronJobName: response.body.metadata.name,
|
|
78
|
-
schedule: response.body.spec.schedule,
|
|
79
|
-
status: "created",
|
|
80
|
-
}, null, 2),
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.error("CronJob creation error:", {
|
|
87
|
-
status: error.response?.statusCode,
|
|
88
|
-
message: error.response?.body?.message || error.message,
|
|
89
|
-
details: error.response?.body,
|
|
90
|
-
});
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { KubernetesManager } from "../types.js";
|
|
2
|
-
import { CustomContainerConfigType } from "../config/container-templates.js";
|
|
3
|
-
export declare const createDeploymentSchema: {
|
|
4
|
-
readonly name: "create_deployment";
|
|
5
|
-
readonly description: "Create a new Kubernetes deployment";
|
|
6
|
-
readonly inputSchema: {
|
|
7
|
-
readonly type: "object";
|
|
8
|
-
readonly properties: {
|
|
9
|
-
readonly name: {
|
|
10
|
-
readonly type: "string";
|
|
11
|
-
};
|
|
12
|
-
readonly namespace: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
};
|
|
15
|
-
readonly template: {
|
|
16
|
-
readonly type: "string";
|
|
17
|
-
readonly enum: ["ubuntu", "nginx", "busybox", "alpine", "custom"];
|
|
18
|
-
};
|
|
19
|
-
readonly replicas: {
|
|
20
|
-
readonly type: "number";
|
|
21
|
-
readonly default: 1;
|
|
22
|
-
};
|
|
23
|
-
readonly ports: {
|
|
24
|
-
readonly type: "array";
|
|
25
|
-
readonly items: {
|
|
26
|
-
readonly type: "number";
|
|
27
|
-
};
|
|
28
|
-
readonly optional: true;
|
|
29
|
-
};
|
|
30
|
-
readonly customConfig: {
|
|
31
|
-
readonly type: "object";
|
|
32
|
-
readonly optional: true;
|
|
33
|
-
readonly properties: {
|
|
34
|
-
readonly image: {
|
|
35
|
-
readonly type: "string";
|
|
36
|
-
};
|
|
37
|
-
readonly command: {
|
|
38
|
-
readonly type: "array";
|
|
39
|
-
readonly items: {
|
|
40
|
-
readonly type: "string";
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
readonly args: {
|
|
44
|
-
readonly type: "array";
|
|
45
|
-
readonly items: {
|
|
46
|
-
readonly type: "string";
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
readonly ports: {
|
|
50
|
-
readonly type: "array";
|
|
51
|
-
readonly items: {
|
|
52
|
-
readonly type: "object";
|
|
53
|
-
readonly properties: {
|
|
54
|
-
readonly containerPort: {
|
|
55
|
-
readonly type: "number";
|
|
56
|
-
};
|
|
57
|
-
readonly name: {
|
|
58
|
-
readonly type: "string";
|
|
59
|
-
};
|
|
60
|
-
readonly protocol: {
|
|
61
|
-
readonly type: "string";
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
readonly resources: {
|
|
67
|
-
readonly type: "object";
|
|
68
|
-
readonly properties: {
|
|
69
|
-
readonly limits: {
|
|
70
|
-
readonly type: "object";
|
|
71
|
-
readonly additionalProperties: {
|
|
72
|
-
readonly type: "string";
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
readonly requests: {
|
|
76
|
-
readonly type: "object";
|
|
77
|
-
readonly additionalProperties: {
|
|
78
|
-
readonly type: "string";
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
readonly env: {
|
|
84
|
-
readonly type: "array";
|
|
85
|
-
readonly items: {
|
|
86
|
-
readonly type: "object";
|
|
87
|
-
readonly properties: {
|
|
88
|
-
readonly name: {
|
|
89
|
-
readonly type: "string";
|
|
90
|
-
};
|
|
91
|
-
readonly value: {
|
|
92
|
-
readonly type: "string";
|
|
93
|
-
};
|
|
94
|
-
readonly valueFrom: {
|
|
95
|
-
readonly type: "object";
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
readonly volumeMounts: {
|
|
101
|
-
readonly type: "array";
|
|
102
|
-
readonly items: {
|
|
103
|
-
readonly type: "object";
|
|
104
|
-
readonly properties: {
|
|
105
|
-
readonly name: {
|
|
106
|
-
readonly type: "string";
|
|
107
|
-
};
|
|
108
|
-
readonly mountPath: {
|
|
109
|
-
readonly type: "string";
|
|
110
|
-
};
|
|
111
|
-
readonly readOnly: {
|
|
112
|
-
readonly type: "boolean";
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
readonly required: readonly ["name", "namespace", "template"];
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
export declare function createDeployment(k8sManager: KubernetesManager, input: {
|
|
124
|
-
name: string;
|
|
125
|
-
namespace: string;
|
|
126
|
-
template: string;
|
|
127
|
-
replicas?: number;
|
|
128
|
-
ports?: number[];
|
|
129
|
-
customConfig?: CustomContainerConfigType;
|
|
130
|
-
}): Promise<{
|
|
131
|
-
content: {
|
|
132
|
-
type: string;
|
|
133
|
-
text: string;
|
|
134
|
-
}[];
|
|
135
|
-
}>;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { ContainerTemplate, containerTemplates, CustomContainerConfig, } from "../config/container-templates.js";
|
|
3
|
-
export const createDeploymentSchema = {
|
|
4
|
-
name: "create_deployment",
|
|
5
|
-
description: "Create a new Kubernetes deployment",
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: "object",
|
|
8
|
-
properties: {
|
|
9
|
-
name: { type: "string" },
|
|
10
|
-
namespace: { type: "string" },
|
|
11
|
-
template: {
|
|
12
|
-
type: "string",
|
|
13
|
-
enum: ContainerTemplate.options,
|
|
14
|
-
},
|
|
15
|
-
replicas: { type: "number", default: 1 },
|
|
16
|
-
ports: {
|
|
17
|
-
type: "array",
|
|
18
|
-
items: { type: "number" },
|
|
19
|
-
optional: true,
|
|
20
|
-
},
|
|
21
|
-
customConfig: {
|
|
22
|
-
type: "object",
|
|
23
|
-
optional: true,
|
|
24
|
-
properties: {
|
|
25
|
-
image: { type: "string" },
|
|
26
|
-
command: { type: "array", items: { type: "string" } },
|
|
27
|
-
args: { type: "array", items: { type: "string" } },
|
|
28
|
-
ports: {
|
|
29
|
-
type: "array",
|
|
30
|
-
items: {
|
|
31
|
-
type: "object",
|
|
32
|
-
properties: {
|
|
33
|
-
containerPort: { type: "number" },
|
|
34
|
-
name: { type: "string" },
|
|
35
|
-
protocol: { type: "string" },
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
resources: {
|
|
40
|
-
type: "object",
|
|
41
|
-
properties: {
|
|
42
|
-
limits: {
|
|
43
|
-
type: "object",
|
|
44
|
-
additionalProperties: { type: "string" },
|
|
45
|
-
},
|
|
46
|
-
requests: {
|
|
47
|
-
type: "object",
|
|
48
|
-
additionalProperties: { type: "string" },
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
env: {
|
|
53
|
-
type: "array",
|
|
54
|
-
items: {
|
|
55
|
-
type: "object",
|
|
56
|
-
properties: {
|
|
57
|
-
name: { type: "string" },
|
|
58
|
-
value: { type: "string" },
|
|
59
|
-
valueFrom: { type: "object" },
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
volumeMounts: {
|
|
64
|
-
type: "array",
|
|
65
|
-
items: {
|
|
66
|
-
type: "object",
|
|
67
|
-
properties: {
|
|
68
|
-
name: { type: "string" },
|
|
69
|
-
mountPath: { type: "string" },
|
|
70
|
-
readOnly: { type: "boolean" },
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
required: ["name", "namespace", "template"],
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
export async function createDeployment(k8sManager, input) {
|
|
81
|
-
const templateConfig = containerTemplates[input.template];
|
|
82
|
-
// If using custom template, validate and merge custom config
|
|
83
|
-
let containerConfig;
|
|
84
|
-
if (input.template === "custom") {
|
|
85
|
-
if (!input.customConfig) {
|
|
86
|
-
throw new McpError(ErrorCode.InvalidRequest, "Custom container configuration is required when using 'custom' template");
|
|
87
|
-
}
|
|
88
|
-
// Validate custom config against schema
|
|
89
|
-
const validatedConfig = CustomContainerConfig.parse(input.customConfig);
|
|
90
|
-
// Merge base template with custom config
|
|
91
|
-
containerConfig = {
|
|
92
|
-
...templateConfig,
|
|
93
|
-
image: validatedConfig.image,
|
|
94
|
-
command: validatedConfig.command,
|
|
95
|
-
args: validatedConfig.args,
|
|
96
|
-
ports: validatedConfig.ports,
|
|
97
|
-
resources: validatedConfig.resources,
|
|
98
|
-
env: validatedConfig.env,
|
|
99
|
-
volumeMounts: validatedConfig.volumeMounts,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
containerConfig = {
|
|
104
|
-
...templateConfig,
|
|
105
|
-
ports: input.ports?.map((port) => ({ containerPort: port })) ||
|
|
106
|
-
templateConfig.ports,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const deployment = {
|
|
110
|
-
apiVersion: "apps/v1",
|
|
111
|
-
kind: "Deployment",
|
|
112
|
-
metadata: {
|
|
113
|
-
name: input.name,
|
|
114
|
-
namespace: input.namespace,
|
|
115
|
-
labels: {
|
|
116
|
-
"mcp-managed": "true",
|
|
117
|
-
app: input.name,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
spec: {
|
|
121
|
-
replicas: input.replicas || 1,
|
|
122
|
-
selector: {
|
|
123
|
-
matchLabels: {
|
|
124
|
-
app: input.name,
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
template: {
|
|
128
|
-
metadata: {
|
|
129
|
-
labels: {
|
|
130
|
-
app: input.name,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
spec: {
|
|
134
|
-
containers: [containerConfig],
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
const response = await k8sManager
|
|
140
|
-
.getAppsApi()
|
|
141
|
-
.createNamespacedDeployment(input.namespace, deployment)
|
|
142
|
-
.catch((error) => {
|
|
143
|
-
console.error("Deployment creation error:", {
|
|
144
|
-
status: error.response?.statusCode,
|
|
145
|
-
message: error.response?.body?.message || error.message,
|
|
146
|
-
details: error.response?.body,
|
|
147
|
-
});
|
|
148
|
-
throw error;
|
|
149
|
-
});
|
|
150
|
-
k8sManager.trackResource("Deployment", input.name, input.namespace);
|
|
151
|
-
return {
|
|
152
|
-
content: [
|
|
153
|
-
{
|
|
154
|
-
type: "text",
|
|
155
|
-
text: JSON.stringify({
|
|
156
|
-
deploymentName: response.body.metadata.name,
|
|
157
|
-
status: "created",
|
|
158
|
-
}, null, 2),
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { KubernetesManager } from "../types.js";
|
|
2
|
-
export declare const createNamespaceSchema: {
|
|
3
|
-
readonly name: "create_namespace";
|
|
4
|
-
readonly description: "Create a new Kubernetes namespace";
|
|
5
|
-
readonly inputSchema: {
|
|
6
|
-
readonly type: "object";
|
|
7
|
-
readonly properties: {
|
|
8
|
-
readonly name: {
|
|
9
|
-
readonly type: "string";
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
readonly required: readonly ["name"];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function createNamespace(k8sManager: KubernetesManager, input: {
|
|
16
|
-
name: string;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
content: {
|
|
19
|
-
type: string;
|
|
20
|
-
text: string;
|
|
21
|
-
}[];
|
|
22
|
-
}>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export const createNamespaceSchema = {
|
|
2
|
-
name: "create_namespace",
|
|
3
|
-
description: "Create a new Kubernetes namespace",
|
|
4
|
-
inputSchema: {
|
|
5
|
-
type: "object",
|
|
6
|
-
properties: {
|
|
7
|
-
name: { type: "string" },
|
|
8
|
-
},
|
|
9
|
-
required: ["name"],
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
export async function createNamespace(k8sManager, input) {
|
|
13
|
-
const namespace = {
|
|
14
|
-
apiVersion: "v1",
|
|
15
|
-
kind: "Namespace",
|
|
16
|
-
metadata: {
|
|
17
|
-
name: input.name,
|
|
18
|
-
labels: {
|
|
19
|
-
"mcp-managed": "true",
|
|
20
|
-
app: input.name,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
spec: {},
|
|
24
|
-
};
|
|
25
|
-
try {
|
|
26
|
-
const response = await k8sManager.getCoreApi().createNamespace(namespace);
|
|
27
|
-
k8sManager.trackResource("Namespace", input.name, input.name);
|
|
28
|
-
return {
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
31
|
-
type: "text",
|
|
32
|
-
text: JSON.stringify({
|
|
33
|
-
namespaceName: response.body.metadata.name,
|
|
34
|
-
status: "created",
|
|
35
|
-
}, null, 2),
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
console.error("Namespace creation error:", {
|
|
42
|
-
status: error.response?.statusCode,
|
|
43
|
-
message: error.response?.body?.message || error.message,
|
|
44
|
-
details: error.response?.body,
|
|
45
|
-
});
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { KubernetesManager } from "../types.js";
|
|
2
|
-
import { CustomContainerConfigType } from "../config/container-templates.js";
|
|
3
|
-
export declare const createPodSchema: {
|
|
4
|
-
readonly name: "create_pod";
|
|
5
|
-
readonly description: "Create a new Kubernetes pod";
|
|
6
|
-
readonly inputSchema: {
|
|
7
|
-
readonly type: "object";
|
|
8
|
-
readonly properties: {
|
|
9
|
-
readonly name: {
|
|
10
|
-
readonly type: "string";
|
|
11
|
-
};
|
|
12
|
-
readonly namespace: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
};
|
|
15
|
-
readonly template: {
|
|
16
|
-
readonly type: "string";
|
|
17
|
-
readonly enum: ["ubuntu", "nginx", "busybox", "alpine", "custom"];
|
|
18
|
-
};
|
|
19
|
-
readonly command: {
|
|
20
|
-
readonly type: "array";
|
|
21
|
-
readonly items: {
|
|
22
|
-
readonly type: "string";
|
|
23
|
-
};
|
|
24
|
-
readonly optional: true;
|
|
25
|
-
};
|
|
26
|
-
readonly customConfig: {
|
|
27
|
-
readonly type: "object";
|
|
28
|
-
readonly optional: true;
|
|
29
|
-
readonly properties: {
|
|
30
|
-
readonly image: {
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
};
|
|
33
|
-
readonly command: {
|
|
34
|
-
readonly type: "array";
|
|
35
|
-
readonly items: {
|
|
36
|
-
readonly type: "string";
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
readonly args: {
|
|
40
|
-
readonly type: "array";
|
|
41
|
-
readonly items: {
|
|
42
|
-
readonly type: "string";
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
readonly ports: {
|
|
46
|
-
readonly type: "array";
|
|
47
|
-
readonly items: {
|
|
48
|
-
readonly type: "object";
|
|
49
|
-
readonly properties: {
|
|
50
|
-
readonly containerPort: {
|
|
51
|
-
readonly type: "number";
|
|
52
|
-
};
|
|
53
|
-
readonly name: {
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
};
|
|
56
|
-
readonly protocol: {
|
|
57
|
-
readonly type: "string";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
readonly resources: {
|
|
63
|
-
readonly type: "object";
|
|
64
|
-
readonly properties: {
|
|
65
|
-
readonly limits: {
|
|
66
|
-
readonly type: "object";
|
|
67
|
-
readonly additionalProperties: {
|
|
68
|
-
readonly type: "string";
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
readonly requests: {
|
|
72
|
-
readonly type: "object";
|
|
73
|
-
readonly additionalProperties: {
|
|
74
|
-
readonly type: "string";
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
readonly env: {
|
|
80
|
-
readonly type: "array";
|
|
81
|
-
readonly items: {
|
|
82
|
-
readonly type: "object";
|
|
83
|
-
readonly properties: {
|
|
84
|
-
readonly name: {
|
|
85
|
-
readonly type: "string";
|
|
86
|
-
};
|
|
87
|
-
readonly value: {
|
|
88
|
-
readonly type: "string";
|
|
89
|
-
};
|
|
90
|
-
readonly valueFrom: {
|
|
91
|
-
readonly type: "object";
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
readonly volumeMounts: {
|
|
97
|
-
readonly type: "array";
|
|
98
|
-
readonly items: {
|
|
99
|
-
readonly type: "object";
|
|
100
|
-
readonly properties: {
|
|
101
|
-
readonly name: {
|
|
102
|
-
readonly type: "string";
|
|
103
|
-
};
|
|
104
|
-
readonly mountPath: {
|
|
105
|
-
readonly type: "string";
|
|
106
|
-
};
|
|
107
|
-
readonly readOnly: {
|
|
108
|
-
readonly type: "boolean";
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
readonly required: readonly ["name", "namespace", "template"];
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
export declare function createPod(k8sManager: KubernetesManager, input: {
|
|
120
|
-
name: string;
|
|
121
|
-
namespace: string;
|
|
122
|
-
template: string;
|
|
123
|
-
command?: string[];
|
|
124
|
-
customConfig?: CustomContainerConfigType;
|
|
125
|
-
}): Promise<{
|
|
126
|
-
content: {
|
|
127
|
-
type: string;
|
|
128
|
-
text: string;
|
|
129
|
-
}[];
|
|
130
|
-
}>;
|