A backend system that provides an interactive and extensible interface for managing Kubernetes resources, retrieving and analyzing logs, and formatting logs for export through the Model Context Protocol (MCP).
- CRUD operations on Kubernetes resources (Pods, Services, Namespaces, Deployments, etc.)
- Log retrieval and pattern searching
- Log formatting and exporting in multiple formats (Plaintext, JSON, CSV, NDJSON)
- Extensible architecture for future enhancements
- Go 1.24+
- Kubernetes cluster access
- kubectl configured
# Clone the repository
git clone https://github.com/mayukhsarkar/k8s-mcp-server.git
cd k8s-mcp-server
# Build the binary
go build -o k8s-mcp-server
# Run the server
./k8s-mcp-server serve
# Start the MCP server
./k8s-mcp-server serve
# Get help
./k8s-mcp-server --help
The MCP server exposes HTTP endpoints for interacting with Kubernetes resources and logs.
POST /api/v1/resources/{resource_type}
- Create a resourceGET /api/v1/resources/{resource_type}
- List resourcesGET /api/v1/resources/{resource_type}/{name}
- Get resource detailsDELETE /api/v1/resources/{resource_type}/{name}
- Delete a resource
GET /api/v1/logs/{namespace}/{pod}
- Get logs from a podGET /api/v1/logs/search
- Search logs with pattern matchingGET /api/v1/logs/export
- Export logs in various formats
MIT