mcp-server-kubernetes
Version:
MCP server for interacting with Kubernetes clusters via kubectl
82 lines (81 loc) • 2.27 kB
TypeScript
/**
* Tool: exec_in_pod
* Execute a command in a Kubernetes pod or container and return the output.
* Uses the official Kubernetes client-node Exec API for native execution.
* Supports both string and array command formats, and optional container targeting.
*/
import { KubernetesManager } from "../types.js";
/**
* Schema for exec_in_pod tool.
* - name: Pod name
* - namespace: Namespace (default: "default")
* - command: Command to execute (string or array of args)
* - container: (Optional) Container name
*/
export declare const execInPodSchema: {
name: string;
description: string;
inputSchema: {
type: string;
properties: {
name: {
type: string;
description: string;
};
namespace: {
type: "string";
description: string;
default: string;
};
command: {
anyOf: ({
type: string;
items?: undefined;
} | {
type: string;
items: {
type: string;
};
})[];
description: string;
};
container: {
type: string;
description: string;
};
shell: {
type: string;
description: string;
};
timeout: {
type: string;
description: string;
};
context: {
type: "string";
description: string;
default: string;
};
};
required: string[];
};
};
/**
* Execute a command in a Kubernetes pod or container using the Kubernetes client-node Exec API.
* Returns the stdout output as a text response.
* Throws McpError on failure.
*/
export declare function execInPod(k8sManager: KubernetesManager, input: {
name: string;
namespace?: string;
command: string | string[];
container?: string;
shell?: string;
timeout?: number;
context?: string;
}): Promise<{
content: {
type: string;
text: string;
}[];
}>;