About K8s MCP Server
K8s MCP Server is an MCP server published by HomayoonAlimohammadi in the Cloud category: mCP server for Kubernetes.
The repository has 1 stars and 0 forks, with the last commit a year 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
git clone https://github.com/HomayoonAlimohammadi/k8s-mcp-serverThis 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.
Ask AI
Ask AI about K8s MCP Server
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 22 hours ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- !License declaredNo license file. Legally you have no right to use it in a product.
- !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
- ✓Dependencies pinnedA lockfile pins dependency versions.
- ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
README
K8s MCP Server
A Model Context Protocol (MCP) server that provides Kubernetes cluster access tools for AI assistants.
Overview
This MCP server allows AI assistants to interact with Kubernetes clusters by providing tools to:
- Get specific Kubernetes resources
- List resources with filtering capabilities
The server uses the Kubernetes Go client library and supports both in-cluster and external cluster configurations.
Features
- Resource Access: Get and list Kubernetes resources by kind, name, and namespace
- Filtering: Support for label selectors when listing resources
- Flexible Authentication: Works with kubeconfig files or in-cluster service account
- Structured Logging: Configurable logging levels and formats
- Graceful Shutdown: Proper signal handling and shutdown procedures
Installation
Prerequisites
- Go 1.23.2 or later
- Access to a Kubernetes cluster
- Valid kubeconfig file (if running outside the cluster)
Build from source
git clone https://github.com/HomayoonAlimohammadi/k8s-mcp-server
cd k8s-mcp-server
make build
Configuration
The server is configured through environment variables:
| Variable | Default | Description |
|---|---|---|
SERVER_NAME |
k8s-mcp-server |
Server name identifier |
SERVER_VERSION |
1.0.0 |
Server version |
KUBECONFIG |
~/.kube/config |
Path to kubeconfig file |
K8S_IN_CLUSTER |
false |
Use in-cluster configuration |
LOG_LEVEL |
info |
Logging level (debug, info, warn, error) |
LOG_FORMAT |
text |
Log format (text, json) |
Usage
Running the server
# Using default configuration
./bin/k8s-mcp-server
# With custom configuration
SERVER_NAME=my-k8s-server LOG_LEVEL=debug ./bin/k8s-mcp-server
Available Tools
getResource
Get a specific Kubernetes resource.
Parameters:
kind(required): Resource kind (e.g., "Pod", "Service", "Deployment")name(required): Resource namenamespace(optional): Resource namespace
listResources
List Kubernetes resources with optional filtering.
Parameters:
kind(required): Resource kind to listnamespace(optional): Namespace to search inlabelSelector(optional): Label selector for filtering
Example Usage with MCP Client
// Get a specific pod
await mcpClient.callTool("getResource", {
kind: "Pod",
name: "my-pod",
namespace: "default"
});
// List all deployments in a namespace
await mcpClient.callTool("listResources", {
kind: "Deployment",
namespace: "production"
});
// List pods with label selector
await mcpClient.callTool("listResources", {
kind: "Pod",
labelSelector: "app=nginx"
});
Development
Running in development
make run
Testing
make test
Code formatting and linting
make fmt
make lint
Docker
Build image
make docker-build
Run container
make docker-run
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
README fetched from the repository 22 hours ago. The original is authoritative.