1. Conduid
  2. Developer Tools
  3. Kubernetes MCP In Kilocode
MCP server · Developer Tools

Kubernetes MCP In Kilocode

How to Setup Kubernetes MCP in kilocode

Unclaimed MIT last commit 10 months ago devtools
56Fair

Scored 5 months ago · breakdown

About Kubernetes MCP In Kilocode

Kubernetes MCP In Kilocode is an MCP server published by ashishpatel26 in the Developer Tools category: how to Setup Kubernetes MCP in kilocode.

The repository has 3 stars and 0 forks, with the last commit 10 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/ashishpatel26/Kubernetes-mcp-in-kilocode

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (4)

describe_podGet detailed pod information

Parameters not published.

get_podsList pods with optional namespace and label filters

Parameters not published.

get_servicesList services in namespaces

Parameters not published.

logsRetrieve container logs

Parameters not published.

Ask AI

✦

Ask AI about Kubernetes MCP In Kilocode

Powered by Claude · Grounded in docs

I know everything about Kubernetes MCP In Kilocode. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 1 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

1 check has not been run yet.

README

Kubernetes-mcp-in-kilocode

How to Setup Kubernetes MCP in kilocode

Setting Up Kubernetes MCP Server in KiloCode

This guide provides step-by-step instructions to set up a local Kubernetes MCP server in your KiloCode workspace, allowing you to manage your Kubernetes cluster through AI-assisted commands.

Prerequisites

  • Node.js and npm installed
  • Access to npm registry (may require IT approval for @modelcontextprotocol/sdk)
  • kubectl configured and connected to your Kubernetes cluster
  • KiloCode workspace

Step 1: Create the MCP Server Directory Structure

mkdir -p mcp/kubernetes-server/src

Step 2: Create package.json

Create mcp/kubernetes-server/package.json with the following content:

{
  "name": "kubernetes-server",
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "build": "tsc && chmod +x build/index.js"
  },
  "dependencies": {
    "@modelcontextprotocol/sdk": "^0.4.0",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "typescript": "^5.0.0"
  }
}

Step 3: Create tsconfig.json

Create mcp/kubernetes-server/tsconfig.json with the following content:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ES2022",
    "moduleResolution": "node",
    "outDir": "./build",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "build"]
}

Step 4: Create the Server Implementation

Create mcp/kubernetes-server/src/index.ts with the following content:

#!/usr/bin/env node
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { execSync } from "child_process";

// Create an MCP server
const server = new McpServer({
  name: "kubernetes-server",
  version: "0.1.0"
});

// Tool for getting pods
server.tool(
  "get_pods",
  {
    namespace: z.string().optional().describe("Namespace to list pods from"),
    selector: z.string().optional().describe("Label selector"),
    output: z.string().optional().describe("Output format (json, yaml, wide, etc.)")
  },
  async ({ namespace, selector, output = "wide" }) => {
    try {
      let cmd = `kubectl get pods`;
      if (namespace) cmd += ` -n ${namespace}`;
      if (selector) cmd += ` -l ${selector}`;
      cmd += ` -o ${output}`;
      const result = execSync(cmd, { encoding: 'utf8' });
      return {
        content: [{ type: "text", text: result }]
      };
    } catch (error: any) {
      return {
        content: [{ type: "text", text: `Error: ${error.message}` }],
        isError: true
      };
    }
  }
);

// Tool for describing a pod
server.tool(
  "describe_pod",
  {
    name: z.string().describe("Pod name"),
    namespace: z.string().optional().describe("Namespace")
  },
  async ({ name, namespace }) => {
    try {
      let cmd = `kubectl describe pod ${name}`;
      if (namespace) cmd += ` -n ${namespace}`;
      const result = execSync(cmd, { encoding: 'utf8' });
      return {
        content: [{ type: "text", text: result }]
      };
    } catch (error: any) {
      return {
        content: [{ type: "text", text: `Error: ${error.message}` }],
        isError: true
      };
    }
  }
);

// Tool for getting logs
server.tool(
  "logs",
  {
    name: z.string().describe("Pod name"),
    namespace: z.string().optional().describe("Namespace"),
    container: z.string().optional().describe("Container name"),
    tail: z.number().optional().describe("Number of lines to tail")
  },
  async ({ name, namespace, container, tail }) => {
    try {
      let cmd = `kubectl logs ${name}`;
      if (namespace) cmd += ` -n ${namespace}`;
      if (container) cmd += ` -c ${container}`;
      if (tail) cmd += ` --tail=${tail}`;
      const result = execSync(cmd, { encoding: 'utf8' });
      return {
        content: [{ type: "text", text: result }]
      };
    } catch (error: any) {
      return {
        content: [{ type: "text", text: `Error: ${error.message}` }],
        isError: true
      };
    }
  }
);

// Tool for getting services
server.tool(
  "get_services",
  {
    namespace: z.string().optional().describe("Namespace"),
    output: z.string().optional().describe("Output format")
  },
  async ({ namespace, output = "wide" }) => {
    try {
      let cmd = `kubectl get services`;
      if (namespace) cmd += ` -n ${namespace}`;
      cmd += ` -o ${output}`;
      const result = execSync(cmd, { encoding: 'utf8' });
      return {
        content: [{ type: "text", text: result }]
      };
    } catch (error: any) {
      return {
        content: [{ type: "text", text: `Error: ${error.message}` }],
        isError: true
      };
    }
  }
);

// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);
console.error('Kubernetes MCP server running on stdio');

Step 5: Install Dependencies

Navigate to the server directory and install dependencies:

cd mcp/kubernetes-server
npm install

Note: If you encounter a 403 error, contact your IT administrator to allow access to the @modelcontextprotocol/sdk package on npmjs.org.

Step 6: Build the Server

Compile the TypeScript code:

npm run build

Step 7: Configure KiloCode MCP Settings

Update .kilocode/mcp.json in your workspace root to include the local server:

{
  "mcpServers": {
    "kubernetes-mcp-server": {
      "command": "node",
      "args": ["mcp/kubernetes-server/build/index.js"]
    }
  }
}

Step 8: Verify Setup

Restart KiloCode or reload the window to load the new MCP server. You can now use commands like:

  • "Get all pods in the advisor namespace"
  • "Describe the advisor-service pod"
  • "Show logs for a specific pod"
  • "List services in the cluster"

Troubleshooting

  • 403 npm error: Security policy blocking package access
  • Build fails: Ensure TypeScript and dependencies are installed
  • MCP not loading: Check the .kilocode/mcp.json syntax and path

Available Tools

  • get_pods: List pods with optional namespace and label filters
  • describe_pod: Get detailed pod information
  • logs: Retrieve container logs
  • get_services: List services in namespaces

README fetched from the repository 1 hours ago. The original is authoritative.

Questions

About Kubernetes MCP In Kilocode

How do I install Kubernetes MCP In Kilocode?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Kubernetes MCP In Kilocode safe to use with an AI agent?

Its trust score is 56 out of 100 (fair). It passes 2 of the 5 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Kubernetes MCP In Kilocode still maintained?

The last commit was 10 months ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.