mcp-server-kubernetes 3.4.0 → 3.5.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.
@@ -1,9 +1,8 @@
1
1
  import { spawn } from "child_process";
2
2
  // Use spawn instead of exec because port-forward is a long-running process
3
- async function executeKubectlCommandAsync(command) {
3
+ async function executePortForward(args) {
4
4
  return new Promise((resolve, reject) => {
5
- const [cmd, ...args] = command.split(" ");
6
- const process = spawn(cmd, args);
5
+ const process = spawn("kubectl", args);
7
6
  let output = "";
8
7
  let errorOutput = "";
9
8
  process.stdout.on("data", (data) => {
@@ -54,13 +53,14 @@ export const PortForwardSchema = {
54
53
  },
55
54
  };
56
55
  export async function startPortForward(k8sManager, input) {
57
- let command = `kubectl port-forward`;
56
+ const args = ["port-forward"];
58
57
  if (input.namespace) {
59
- command += ` -n ${input.namespace}`;
58
+ args.push("-n", input.namespace);
60
59
  }
61
- command += ` ${input.resourceType}/${input.resourceName} ${input.localPort}:${input.targetPort}`;
60
+ args.push(`${input.resourceType}/${input.resourceName}`);
61
+ args.push(`${input.localPort}:${input.targetPort}`);
62
62
  try {
63
- const result = await executeKubectlCommandAsync(command);
63
+ const result = await executePortForward(args);
64
64
  // Track the port-forward process
65
65
  k8sManager.trackPortForward({
66
66
  id: `${input.resourceType}-${input.resourceName}-${input.localPort}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-kubernetes",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "MCP server for interacting with Kubernetes clusters via kubectl",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "@opentelemetry/semantic-conventions": "^1.39.0",
48
48
  "express": "4.21.2",
49
49
  "js-yaml": "4.1.1",
50
- "yaml": "2.7.0",
50
+ "yaml": "2.8.3",
51
51
  "zod": "3.25.76"
52
52
  },
53
53
  "devDependencies": {