mcp-server-kubernetes 3.0.2 → 3.0.4

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.
@@ -22,12 +22,8 @@ export class KubernetesManager {
22
22
  throw new Error(`Failed to parse KUBECONFIG_YAML: ${error instanceof Error ? error.message : "Unknown error"}`);
23
23
  }
24
24
  }
25
- else if (this.isRunningInCluster()) {
26
- // Priority 2: Check if running in cluster
27
- this.kc.loadFromCluster();
28
- }
29
25
  else if (this.hasEnvKubeconfigJson()) {
30
- // Priority 3: Full kubeconfig as JSON string
26
+ // Priority 2: Full kubeconfig as JSON string
31
27
  try {
32
28
  this.loadEnvKubeconfigJson();
33
29
  // Create temp kubeconfig file for kubectl commands from JSON
@@ -39,7 +35,7 @@ export class KubernetesManager {
39
35
  }
40
36
  }
41
37
  else if (this.hasEnvMinimalKubeconfig()) {
42
- // Priority 4: Minimal config with individual environment variables
38
+ // Priority 3: Minimal config with K8S_SERVER and K8S_TOKEN
43
39
  try {
44
40
  this.loadEnvMinimalKubeconfig();
45
41
  // Create temp kubeconfig file for kubectl commands from minimal config
@@ -50,6 +46,10 @@ export class KubernetesManager {
50
46
  throw new Error(`Failed to create kubeconfig from K8S_SERVER and K8S_TOKEN: ${error instanceof Error ? error.message : "Unknown error"}`);
51
47
  }
52
48
  }
49
+ else if (this.isRunningInCluster()) {
50
+ // Priority 4: Check if running in cluster
51
+ this.kc.loadFromCluster();
52
+ }
53
53
  else if (this.hasEnvKubeconfigPath()) {
54
54
  // Priority 5: Custom kubeconfig file path using KUBECONFIG_PATH
55
55
  try {
@@ -146,10 +146,14 @@ export class KubernetesManager {
146
146
  if (!process.env.K8S_SERVER || !process.env.K8S_TOKEN) {
147
147
  throw new Error("K8S_SERVER and K8S_TOKEN environment variables are required");
148
148
  }
149
+ // When K8S_CA_DATA is provided, force skipTLSVerify to false as they are incompatible
150
+ const hasCAData = !!(process.env.K8S_CA_DATA && process.env.K8S_CA_DATA.trim());
151
+ const skipTLSVerify = hasCAData ? false : process.env.K8S_SKIP_TLS_VERIFY === "true";
149
152
  const cluster = {
150
153
  name: "env-cluster",
151
154
  server: process.env.K8S_SERVER,
152
- skipTLSVerify: process.env.K8S_SKIP_TLS_VERIFY === "true",
155
+ skipTLSVerify,
156
+ caData: process.env.K8S_CA_DATA || undefined,
153
157
  };
154
158
  const user = {
155
159
  name: "env-user",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-kubernetes",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "MCP server for interacting with Kubernetes clusters via kubectl",
5
5
  "license": "MIT",
6
6
  "type": "module",