mcp-server-kubernetes 0.1.5 → 0.2.3
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 +29 -9
- package/dist/config/cleanup-config.d.ts +8 -0
- package/dist/config/cleanup-config.js +8 -0
- package/dist/config/container-templates.d.ts +5 -0
- package/dist/config/container-templates.js +109 -0
- package/dist/config/deployment-config.d.ts +31 -0
- package/dist/config/deployment-config.js +23 -0
- package/dist/config/namespace-config.d.ts +8 -0
- package/dist/config/namespace-config.js +8 -0
- package/dist/config/server-config.d.ts +8 -0
- package/dist/config/server-config.js +8 -0
- package/dist/index.js +49 -928
- package/dist/models/helm-models.d.ts +39 -0
- package/dist/models/helm-models.js +8 -0
- package/dist/models/resource-models.d.ts +94 -0
- package/dist/models/resource-models.js +17 -0
- package/dist/models/response-schemas.d.ts +221 -0
- package/dist/models/response-schemas.js +36 -0
- package/dist/models/tool-models.d.ts +42 -0
- package/dist/models/tool-models.js +10 -0
- package/dist/resources/handlers.d.ts +22 -0
- package/dist/resources/handlers.js +112 -0
- package/dist/tools/create_pod.d.ts +39 -0
- package/dist/tools/create_pod.js +71 -0
- package/dist/tools/delete_pod.d.ts +31 -0
- package/dist/tools/delete_pod.js +45 -0
- package/dist/tools/describe_pod.d.ts +33 -0
- package/dist/tools/describe_pod.js +81 -0
- package/dist/tools/get_logs.d.ts +67 -0
- package/dist/tools/get_logs.js +150 -0
- package/dist/tools/helm-operations.d.ts +99 -0
- package/dist/tools/helm-operations.js +198 -0
- package/dist/tools/list_deployments.d.ts +23 -0
- package/dist/tools/list_deployments.js +30 -0
- package/dist/tools/list_nodes.d.ts +15 -0
- package/dist/tools/list_nodes.js +21 -0
- package/dist/tools/list_pods.d.ts +23 -0
- package/dist/tools/list_pods.js +29 -0
- package/dist/tools/list_services.d.ts +23 -0
- package/dist/tools/list_services.js +31 -0
- package/dist/types.d.ts +4 -433
- package/dist/types.js +6 -120
- package/dist/utils/kubernetes-manager.d.ts +21 -0
- package/dist/utils/kubernetes-manager.js +68 -0
- package/package.json +3 -2
- package/dist/helm.test.d.ts +0 -1
- package/dist/helm.test.js +0 -208
- package/dist/unit.test.d.ts +0 -1
- package/dist/unit.test.js +0 -293
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ContainerTemplate, containerTemplates } from "../config/container-templates.js";
|
|
2
|
+
export const createPodSchema = {
|
|
3
|
+
name: "create_pod",
|
|
4
|
+
description: "Create a new Kubernetes pod",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
name: { type: "string" },
|
|
9
|
+
namespace: { type: "string" },
|
|
10
|
+
template: {
|
|
11
|
+
type: "string",
|
|
12
|
+
enum: ContainerTemplate.options,
|
|
13
|
+
},
|
|
14
|
+
command: {
|
|
15
|
+
type: "array",
|
|
16
|
+
items: { type: "string" },
|
|
17
|
+
optional: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ["name", "namespace", "template"],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export async function createPod(k8sManager, input) {
|
|
24
|
+
const templateConfig = containerTemplates[input.template];
|
|
25
|
+
const pod = {
|
|
26
|
+
apiVersion: "v1",
|
|
27
|
+
kind: "Pod",
|
|
28
|
+
metadata: {
|
|
29
|
+
name: input.name,
|
|
30
|
+
namespace: input.namespace,
|
|
31
|
+
labels: {
|
|
32
|
+
"mcp-managed": "true",
|
|
33
|
+
app: input.name,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
spec: {
|
|
37
|
+
containers: [
|
|
38
|
+
{
|
|
39
|
+
...templateConfig,
|
|
40
|
+
...(input.command && {
|
|
41
|
+
command: input.command,
|
|
42
|
+
args: undefined, // Clear default args when command is overridden
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const response = await k8sManager
|
|
49
|
+
.getCoreApi()
|
|
50
|
+
.createNamespacedPod(input.namespace, pod)
|
|
51
|
+
.catch((error) => {
|
|
52
|
+
console.error("Pod creation error:", {
|
|
53
|
+
status: error.response?.statusCode,
|
|
54
|
+
message: error.response?.body?.message || error.message,
|
|
55
|
+
details: error.response?.body,
|
|
56
|
+
});
|
|
57
|
+
throw error;
|
|
58
|
+
});
|
|
59
|
+
k8sManager.trackResource("Pod", input.name, input.namespace);
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: JSON.stringify({
|
|
65
|
+
podName: response.body.metadata.name,
|
|
66
|
+
status: "created",
|
|
67
|
+
}, null, 2),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { KubernetesManager } from "../types.js";
|
|
2
|
+
export declare const deletePodSchema: {
|
|
3
|
+
readonly name: "delete_pod";
|
|
4
|
+
readonly description: "Delete a Kubernetes pod";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly name: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
};
|
|
11
|
+
readonly namespace: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
};
|
|
14
|
+
readonly ignoreNotFound: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly required: readonly ["name", "namespace"];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare function deletePod(k8sManager: KubernetesManager, input: {
|
|
23
|
+
name: string;
|
|
24
|
+
namespace: string;
|
|
25
|
+
ignoreNotFound?: boolean;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const deletePodSchema = {
|
|
2
|
+
name: "delete_pod",
|
|
3
|
+
description: "Delete a Kubernetes pod",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
name: { type: "string" },
|
|
8
|
+
namespace: { type: "string" },
|
|
9
|
+
ignoreNotFound: { type: "boolean", default: false },
|
|
10
|
+
},
|
|
11
|
+
required: ["name", "namespace"],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export async function deletePod(k8sManager, input) {
|
|
15
|
+
try {
|
|
16
|
+
await k8sManager.getCoreApi().deleteNamespacedPod(input.name, input.namespace);
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: JSON.stringify({
|
|
22
|
+
success: true,
|
|
23
|
+
status: "deleted",
|
|
24
|
+
}, null, 2),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (input.ignoreNotFound && error.response?.statusCode === 404) {
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: JSON.stringify({
|
|
36
|
+
success: true,
|
|
37
|
+
status: "not_found",
|
|
38
|
+
}, null, 2),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { KubernetesManager } from "../types.js";
|
|
2
|
+
export declare const describePodSchema: {
|
|
3
|
+
readonly name: "describe_pod";
|
|
4
|
+
readonly description: "Describe a Kubernetes pod (read details like status, containers, etc.)";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly name: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
};
|
|
11
|
+
readonly namespace: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly required: readonly ["name", "namespace"];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function describePod(k8sManager: KubernetesManager, input: {
|
|
19
|
+
name: string;
|
|
20
|
+
namespace: string;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
content: {
|
|
23
|
+
type: string;
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
isError: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
content: {
|
|
29
|
+
type: string;
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
isError?: undefined;
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
export const describePodSchema = {
|
|
3
|
+
name: "describe_pod",
|
|
4
|
+
description: "Describe a Kubernetes pod (read details like status, containers, etc.)",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
name: { type: "string" },
|
|
9
|
+
namespace: { type: "string" },
|
|
10
|
+
},
|
|
11
|
+
required: ["name", "namespace"],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export async function describePod(k8sManager, input) {
|
|
15
|
+
try {
|
|
16
|
+
const { body } = await k8sManager.getCoreApi().readNamespacedPod(input.name, input.namespace);
|
|
17
|
+
if (!body) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: JSON.stringify({
|
|
23
|
+
error: "Pod not found",
|
|
24
|
+
status: "not_found",
|
|
25
|
+
}, null, 2),
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
isError: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Format the pod details for better readability
|
|
32
|
+
const podDetails = {
|
|
33
|
+
kind: body.kind,
|
|
34
|
+
metadata: {
|
|
35
|
+
name: body.metadata?.name,
|
|
36
|
+
namespace: body.metadata?.namespace,
|
|
37
|
+
creationTimestamp: body.metadata?.creationTimestamp,
|
|
38
|
+
labels: body.metadata?.labels,
|
|
39
|
+
},
|
|
40
|
+
spec: {
|
|
41
|
+
containers: body.spec?.containers.map((container) => ({
|
|
42
|
+
name: container.name,
|
|
43
|
+
image: container.image,
|
|
44
|
+
ports: container.ports,
|
|
45
|
+
resources: container.resources,
|
|
46
|
+
})),
|
|
47
|
+
nodeName: body.spec?.nodeName,
|
|
48
|
+
},
|
|
49
|
+
status: {
|
|
50
|
+
phase: body.status?.phase,
|
|
51
|
+
conditions: body.status?.conditions,
|
|
52
|
+
containerStatuses: body.status?.containerStatuses,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
text: JSON.stringify(podDetails, null, 2),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error.response?.statusCode === 404) {
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: JSON.stringify({
|
|
71
|
+
error: "Pod not found",
|
|
72
|
+
status: "not_found",
|
|
73
|
+
}, null, 2),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
isError: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
throw new McpError(ErrorCode.InternalError, `Failed to describe pod: ${error.response?.body?.message || error.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { KubernetesManager } from "../types.js";
|
|
2
|
+
export declare const getLogsSchema: {
|
|
3
|
+
readonly name: "get_logs";
|
|
4
|
+
readonly description: "Get logs from pods, deployments, jobs, or resources matching a label selector";
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly resourceType: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly enum: readonly ["pod", "deployment", "job"];
|
|
11
|
+
readonly description: "Type of resource to get logs from";
|
|
12
|
+
};
|
|
13
|
+
readonly name: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly description: "Name of the resource";
|
|
16
|
+
};
|
|
17
|
+
readonly namespace: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly description: "Namespace of the resource";
|
|
20
|
+
readonly default: "default";
|
|
21
|
+
};
|
|
22
|
+
readonly labelSelector: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Label selector to filter resources";
|
|
25
|
+
readonly optional: true;
|
|
26
|
+
};
|
|
27
|
+
readonly container: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly description: "Container name (required when pod has multiple containers)";
|
|
30
|
+
readonly optional: true;
|
|
31
|
+
};
|
|
32
|
+
readonly tail: {
|
|
33
|
+
readonly type: "number";
|
|
34
|
+
readonly description: "Number of lines to show from end of logs";
|
|
35
|
+
readonly optional: true;
|
|
36
|
+
};
|
|
37
|
+
readonly since: {
|
|
38
|
+
readonly type: "number";
|
|
39
|
+
readonly description: "Get logs since relative time in seconds";
|
|
40
|
+
readonly optional: true;
|
|
41
|
+
};
|
|
42
|
+
readonly timestamps: {
|
|
43
|
+
readonly type: "boolean";
|
|
44
|
+
readonly description: "Include timestamps in logs";
|
|
45
|
+
readonly default: false;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly required: readonly ["resourceType"];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare function getLogs(k8sManager: KubernetesManager, input: {
|
|
52
|
+
resourceType: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
namespace?: string;
|
|
55
|
+
labelSelector?: string;
|
|
56
|
+
container?: string;
|
|
57
|
+
tail?: number;
|
|
58
|
+
sinceSeconds?: number;
|
|
59
|
+
timestamps?: boolean;
|
|
60
|
+
pretty?: boolean;
|
|
61
|
+
follow?: false;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
content: {
|
|
64
|
+
type: string;
|
|
65
|
+
text: string;
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
export const getLogsSchema = {
|
|
3
|
+
name: "get_logs",
|
|
4
|
+
description: "Get logs from pods, deployments, jobs, or resources matching a label selector",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
resourceType: {
|
|
9
|
+
type: "string",
|
|
10
|
+
enum: ["pod", "deployment", "job"],
|
|
11
|
+
description: "Type of resource to get logs from",
|
|
12
|
+
},
|
|
13
|
+
name: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Name of the resource",
|
|
16
|
+
},
|
|
17
|
+
namespace: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Namespace of the resource",
|
|
20
|
+
default: "default",
|
|
21
|
+
},
|
|
22
|
+
labelSelector: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Label selector to filter resources",
|
|
25
|
+
optional: true,
|
|
26
|
+
},
|
|
27
|
+
container: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Container name (required when pod has multiple containers)",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
tail: {
|
|
33
|
+
type: "number",
|
|
34
|
+
description: "Number of lines to show from end of logs",
|
|
35
|
+
optional: true,
|
|
36
|
+
},
|
|
37
|
+
since: {
|
|
38
|
+
type: "number",
|
|
39
|
+
description: "Get logs since relative time in seconds",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
timestamps: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Include timestamps in logs",
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ["resourceType"],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
async function getPodLogs(k8sManager, podName, podNamespace, input) {
|
|
52
|
+
try {
|
|
53
|
+
const { body } = await k8sManager.getCoreApi().readNamespacedPodLog(podName, podNamespace, input.container, input.follow, undefined, // insecureSkipTLSVerifyBackend
|
|
54
|
+
undefined, // limitBytes
|
|
55
|
+
input.pretty ? "true" : "false", undefined, // previous
|
|
56
|
+
input.sinceSeconds, input.tail, input.timestamps);
|
|
57
|
+
return body;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error.response?.statusCode === 404) {
|
|
61
|
+
throw new McpError(ErrorCode.InvalidRequest, `Pod ${podName} not found in namespace ${podNamespace}`);
|
|
62
|
+
}
|
|
63
|
+
// Log full error details
|
|
64
|
+
console.error("Full error:", {
|
|
65
|
+
statusCode: error.response?.statusCode,
|
|
66
|
+
message: error.response?.body?.message || error.message,
|
|
67
|
+
details: error.response?.body,
|
|
68
|
+
});
|
|
69
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get logs for pod ${podName}: ${error.response?.body?.message || error.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export async function getLogs(k8sManager, input) {
|
|
73
|
+
const namespace = input.namespace || "default";
|
|
74
|
+
const logs = {};
|
|
75
|
+
try {
|
|
76
|
+
// Get logs based on resource type
|
|
77
|
+
switch (input.resourceType.toLowerCase()) {
|
|
78
|
+
case "pod": {
|
|
79
|
+
if (!input.name) {
|
|
80
|
+
throw new McpError(ErrorCode.InvalidRequest, "Pod name is required when resourceType is 'pod'");
|
|
81
|
+
}
|
|
82
|
+
logs[input.name] = await getPodLogs(k8sManager, input.name, namespace, input);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case "deployment": {
|
|
86
|
+
if (!input.name) {
|
|
87
|
+
throw new McpError(ErrorCode.InvalidRequest, "Deployment name is required when resourceType is 'deployment'");
|
|
88
|
+
}
|
|
89
|
+
const { body: deployment } = await k8sManager
|
|
90
|
+
.getAppsApi()
|
|
91
|
+
.readNamespacedDeployment(input.name, namespace);
|
|
92
|
+
if (!deployment.spec?.selector?.matchLabels) {
|
|
93
|
+
throw new McpError(ErrorCode.InvalidRequest, `Deployment ${input.name} has no selector`);
|
|
94
|
+
}
|
|
95
|
+
const selector = Object.entries(deployment.spec.selector.matchLabels)
|
|
96
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
97
|
+
.join(",");
|
|
98
|
+
const { body: podList } = await k8sManager
|
|
99
|
+
.getCoreApi()
|
|
100
|
+
.listNamespacedPod(namespace, undefined, undefined, undefined, undefined, selector);
|
|
101
|
+
for (const pod of podList.items) {
|
|
102
|
+
if (pod.metadata?.name) {
|
|
103
|
+
logs[pod.metadata.name] = await getPodLogs(k8sManager, pod.metadata.name, namespace, input);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case "job": {
|
|
109
|
+
if (!input.name) {
|
|
110
|
+
throw new McpError(ErrorCode.InvalidRequest, "Job name is required when resourceType is 'job'");
|
|
111
|
+
}
|
|
112
|
+
const { body: podList } = await k8sManager
|
|
113
|
+
.getCoreApi()
|
|
114
|
+
.listNamespacedPod(namespace, undefined, undefined, undefined, undefined, `job-name=${input.name}`);
|
|
115
|
+
for (const pod of podList.items) {
|
|
116
|
+
if (pod.metadata?.name) {
|
|
117
|
+
logs[pod.metadata.name] = await getPodLogs(k8sManager, pod.metadata.name, namespace, input);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
throw new McpError(ErrorCode.InvalidRequest, `Unsupported resource type: ${input.resourceType}`);
|
|
124
|
+
}
|
|
125
|
+
// If labelSelector is provided, filter or add logs by label
|
|
126
|
+
if (input.labelSelector) {
|
|
127
|
+
const { body: labeledPods } = await k8sManager
|
|
128
|
+
.getCoreApi()
|
|
129
|
+
.listNamespacedPod(namespace, undefined, undefined, undefined, undefined, input.labelSelector);
|
|
130
|
+
for (const pod of labeledPods.items) {
|
|
131
|
+
if (pod.metadata?.name) {
|
|
132
|
+
logs[pod.metadata.name] = await getPodLogs(k8sManager, pod.metadata.name, namespace, input);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
content: [
|
|
138
|
+
{
|
|
139
|
+
type: "text",
|
|
140
|
+
text: JSON.stringify({ logs }, null, 2),
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
if (error instanceof McpError)
|
|
147
|
+
throw error;
|
|
148
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get logs: ${error}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { HelmInstallOperation, HelmOperation, HelmUpgradeOperation } from "../models/helm-models.js";
|
|
2
|
+
export declare const installHelmChartSchema: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
chart: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
repo: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
namespace: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
values: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
additionalProperties: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
required: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const upgradeHelmChartSchema: {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: string;
|
|
38
|
+
properties: {
|
|
39
|
+
name: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
chart: {
|
|
44
|
+
type: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
repo: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
namespace: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
values: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
additionalProperties: boolean;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
required: string[];
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const uninstallHelmChartSchema: {
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: string;
|
|
69
|
+
properties: {
|
|
70
|
+
name: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
namespace: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
required: string[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare function installHelmChart(params: HelmInstallOperation): Promise<{
|
|
83
|
+
content: {
|
|
84
|
+
type: string;
|
|
85
|
+
text: string;
|
|
86
|
+
}[];
|
|
87
|
+
}>;
|
|
88
|
+
export declare function upgradeHelmChart(params: HelmUpgradeOperation): Promise<{
|
|
89
|
+
content: {
|
|
90
|
+
type: string;
|
|
91
|
+
text: string;
|
|
92
|
+
}[];
|
|
93
|
+
}>;
|
|
94
|
+
export declare function uninstallHelmChart(params: HelmOperation): Promise<{
|
|
95
|
+
content: {
|
|
96
|
+
type: string;
|
|
97
|
+
text: string;
|
|
98
|
+
}[];
|
|
99
|
+
}>;
|