Typescript implementation of Kubernetes cluster operations for pods, deployments, services.
This repository provides an MCP server that empowers Large Language Models (LLMs) to seamlessly interact with and manage your Kubernetes clusters. By leveraging the Model Context Protocol, this server enables you to build intelligent AI-powered tools for Kubernetes administration, directly integrating cluster insights and control into your LLM applications.
This MCP server acts as a bridge, translating LLM requests into Kubernetes API calls, allowing you to:
To integrate this MCP server with Claude Desktop, configure the mcpServers
section in your claude_desktop_config.json
file:
{ "mcpServers": { "kubernetes": { "command": "npx", "args": ["mcp-server-kubernetes"] } } }
This configuration instructs Claude Desktop to launch the MCP server, enabling it to respond to Kubernetes-related requests. The server automatically connects to your currently configured kubectl
context.
Prerequisites:
kubectl
installed and in your system's PATH.kubeconfig
file with configured contexts.Troubleshooting:
If you encounter connection issues, verify your kubectl
configuration by running kubectl get pods
in a terminal.
mcp-chat
provides a command-line interface for interacting with MCP servers. Use it to test and explore the capabilities of the Kubernetes MCP server:
npx mcp-chat --server "npx mcp-server-kubernetes"
Alternatively, point mcp-chat
to your existing Claude Desktop configuration file:
macOS:
npx mcp-chat --config "~/Library/Application Support/Claude/claude_desktop_config.json"
Windows:
npx mcp-chat --config "%APPDATA%\Claude\claude_desktop_config.json"
kubectl explain
and kubectl api-resources
for in-depth resource documentation and API discovery.Clone the repository:
git clone https://github.com/Flux159/mcp-server-kubernetes.git cd mcp-server-kubernetes
Install dependencies:
bun install
Start the server in development mode (with file watching):
bun run dev
Run unit tests:
bun run test
Build the project:
bun run build
Local Testing with Inspector:
npx @modelcontextprotocol/inspector node dist/index.js # Follow further instructions on terminal for Inspector link
Local testing with Claude Desktop:
{ "mcpServers": { "mcp-server-kubernetes": { "command": "node", "args": ["/path/to/your/mcp-server-kubernetes/dist/index.js"] } } }
Local testing with mcp-chat:
npm run chat
Please refer to the CONTRIBUTING.md file for guidelines on contributing to this project.
For advanced usage information, including details on using SSE transport, consult the ADVANCED_README.md.
The following diagram illustrates the request flow within the MCP Kubernetes server:
sequenceDiagram participant Client participant Transport as StdioTransport participant Server as MCP Server participant Handler as Request Handler participant K8sManager as KubernetesManager participant K8s as Kubernetes API Client->>Transport: Send Request via STDIO Transport->>Server: Forward Request alt Tools Request Server->>Handler: Route to tools handler Handler->>K8sManager: Execute tool operation K8sManager->>K8s: Make API call K8s-->>K8sManager: Return result K8sManager-->>Handler: Process response Handler-->>Server: Return tool result else Resource Request Server->>Handler: Route to resource handler Handler->>K8sManager: Get resource data K8sManager->>K8s: Query API K8s-->>K8sManager: Return data K8sManager-->>Handler: Format response Handler-->>Server: Return resource data end Server-->>Transport: Send Response Transport-->>Client: Return Final Response
This process triggers the cd.yml
workflow, which automatically updates the package.json
version, builds the release, and publishes it to npm.
This project does not currently include features for:
kubectx
.📇 A gateway demo for MCP SSE Server.
🐍 ☁️ A lightweight mcp server that tells you exactly what time is it.
#️⃣ 🏠 A C# SDK for building MCP servers on .NET 9 with NativeAOT compatibility ⚡ 🔌
☕ Java SDK for building MCP servers using Quarkus.