mcp-server-kubernetes 1.0.0 → 1.0.1
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 +1 -1
- package/dist/tools/port_forward.d.ts +4 -0
- package/dist/tools/port_forward.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ MCP Server that can connect to a Kubernetes cluster and manage it.
|
|
|
15
15
|
|
|
16
16
|
https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed
|
|
17
17
|
|
|
18
|
-
<a href="https://glama.ai/mcp/servers/w71ieamqrt"><img width="380" height="200" src="https://glama.ai/mcp/servers/w71ieamqrt/badge"
|
|
18
|
+
<a href="https://glama.ai/mcp/servers/w71ieamqrt"><img width="380" height="200" src="https://glama.ai/mcp/servers/w71ieamqrt/badge" /></a>
|
|
19
19
|
|
|
20
20
|
## Usage with Claude Desktop
|
|
21
21
|
|
|
@@ -17,6 +17,9 @@ export declare const PortForwardSchema: {
|
|
|
17
17
|
targetPort: {
|
|
18
18
|
type: string;
|
|
19
19
|
};
|
|
20
|
+
namespace: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
20
23
|
};
|
|
21
24
|
required: string[];
|
|
22
25
|
};
|
|
@@ -26,6 +29,7 @@ export declare function startPortForward(k8sManager: KubernetesManager, input: {
|
|
|
26
29
|
resourceName: string;
|
|
27
30
|
localPort: number;
|
|
28
31
|
targetPort: number;
|
|
32
|
+
namespace?: string;
|
|
29
33
|
}): Promise<{
|
|
30
34
|
content: {
|
|
31
35
|
success: boolean;
|
|
@@ -45,12 +45,17 @@ export const PortForwardSchema = {
|
|
|
45
45
|
resourceName: { type: "string" },
|
|
46
46
|
localPort: { type: "number" },
|
|
47
47
|
targetPort: { type: "number" },
|
|
48
|
+
namespace: { type: "string" },
|
|
48
49
|
},
|
|
49
50
|
required: ["resourceType", "resourceName", "localPort", "targetPort"],
|
|
50
51
|
},
|
|
51
52
|
};
|
|
52
53
|
export async function startPortForward(k8sManager, input) {
|
|
53
|
-
let command = `kubectl port-forward
|
|
54
|
+
let command = `kubectl port-forward`;
|
|
55
|
+
if (input.namespace) {
|
|
56
|
+
command += ` -n ${input.namespace}`;
|
|
57
|
+
}
|
|
58
|
+
command += ` ${input.resourceType}/${input.resourceName} ${input.localPort}:${input.targetPort}`;
|
|
54
59
|
try {
|
|
55
60
|
const result = await executeKubectlCommandAsync(command);
|
|
56
61
|
// Track the port-forward process
|
|
@@ -68,7 +73,7 @@ export async function startPortForward(k8sManager, input) {
|
|
|
68
73
|
},
|
|
69
74
|
resourceType: input.resourceType,
|
|
70
75
|
name: input.resourceName,
|
|
71
|
-
namespace: "default",
|
|
76
|
+
namespace: input.namespace || "default",
|
|
72
77
|
ports: [{ local: input.localPort, remote: input.targetPort }],
|
|
73
78
|
});
|
|
74
79
|
return {
|