mcp-server-kubernetes 3.9.3 → 4.0.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,6 +1,6 @@
1
1
  export declare const serverConfig: {
2
2
  readonly name: "kubernetes";
3
- readonly version: "3.9.3";
3
+ readonly version: "4.0.0";
4
4
  readonly capabilities: {
5
5
  readonly resources: {};
6
6
  readonly tools: {};
@@ -1,6 +1,6 @@
1
1
  export const serverConfig = {
2
2
  name: "kubernetes",
3
- version: "3.9.3",
3
+ version: "4.0.0",
4
4
  capabilities: {
5
5
  resources: {},
6
6
  tools: {},
@@ -1,6 +1,13 @@
1
1
  import { spawn } from "child_process";
2
+ import { McpError } from "@modelcontextprotocol/sdk/types.js";
3
+ import { assertSafeArgv } from "../security/kubectl-flags.js";
2
4
  // Use spawn instead of exec because port-forward is a long-running process
3
5
  async function executePortForward(args) {
6
+ // port_forward uses spawn (long-running process) rather than the shared
7
+ // execFileSyncSafe wrapper, so it must run the argv guard itself. Otherwise
8
+ // user-supplied values pushed into positional slots (e.g. resourceType) can
9
+ // smuggle credential/target-redirecting flags such as --server.
10
+ assertSafeArgv(args);
4
11
  return new Promise((resolve, reject) => {
5
12
  const process = spawn("kubectl", args);
6
13
  let output = "";
@@ -92,6 +99,10 @@ export async function startPortForward(k8sManager, input) {
92
99
  };
93
100
  }
94
101
  catch (error) {
102
+ // Preserve McpError (e.g. the argv safety guard's InvalidParams rejection)
103
+ // so the client sees the real reason instead of a generic InternalError.
104
+ if (error instanceof McpError)
105
+ throw error;
95
106
  throw new Error(`Failed to execute port-forward: ${error.message}`);
96
107
  }
97
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-kubernetes",
3
- "version": "3.9.3",
3
+ "version": "4.0.0",
4
4
  "description": "MCP server for interacting with Kubernetes clusters via kubectl",
5
5
  "license": "MIT",
6
6
  "type": "module",