A read-only Kubernetes MCP server for safely interacting with Kubernetes clusters
Project description
Kubernetes Read Only MCP Server
A Model Context Protocol (MCP) server for safely interacting with Kubernetes clusters using read-only operations.
This MCP server was created to provide a secure way to interact with Kubernetes clusters without allowing any create, update, or delete operations. It only exposes read-only APIs to ensure your clusters remain safe while still enabling AI assistants to help you monitor and troubleshoot your Kubernetes resources.
Built with FastMCP 2.0 and the official Kubernetes Python client library.
Blog Post and Demo Video
Read more about running the MCP server using Amazon Q CLI at https://vijay.eu/posts/building-my-first-mcp-server/
Features
This MCP server provides the following read-only tools:
list_pods: List all pods in a namespace or across all namespaceslist_deployments: List all deployments in a specified namespacelist_services: List all services in a namespace or across all namespaceslist_namespaces: List all namespaces in the clusterget_events: Get Kubernetes events from the clusterget_pod_logs: Get logs from a specific podget_logs: Get logs from pods, deployments, jobs, or resources matching a label selector
Prerequisites
- Kubernetes cluster creation and configuring your kubectl must be done before starting the installation. Default K8s context will be used.
- For demo purposes, you can use kind and docker to setup a local k8s cluster running quickly in your local machine.
- Refer to this quickstart: https://kind.sigs.k8s.io/docs/user/quick-start/
Installation
MCP configuration
Add this to your MCP Server configuration file:
{
"mcpServers": {
"kubernetes-readonly-mcp": {
"command": "uvx",
"args": ["kubernetes-readonly-mcp@latest"]
}
}
}
Every MCP Hosts/Clients manages their MCP Server configuration differently. If you are using it for the first time then most probably mcp configuration file might not be present. You might have to create it and paste the above JSON text into it.
Here is related documentation for Claude Desktop and Amazon Q CLI:
- Claude Desktop: https://modelcontextprotocol.io/quickstart/user
- Amazon Q CLI: https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html
Verify Installation
Verify that your MCP Host/Client is restarted and the kubernetes-readonly-mcp MCP server is visible in the list.
You can use Amazon Q CLI, Claude Desktop, VSCode + Cline, or any other MCP-compatible client.
Example Prompts
- "Get list of pods from my kubernetes cluster"
- "Are there any failing pods? Debug why they are failing"
- "Show me the logs from the nginx deployment"
- "List all services in the default namespace"
License
Apache License 2.0
Disclaimer
This is an experimental project and not production-ready. Use it at your own discretion.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kubernetes_readonly_mcp-0.1.3.tar.gz.
File metadata
- Download URL: kubernetes_readonly_mcp-0.1.3.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0dd40794d791b1e80217c7446d8f0bda72e53ff254d57d18838c3afbc99a285
|
|
| MD5 |
1e1df12dece335e323ecd364eb15eed8
|
|
| BLAKE2b-256 |
ecbea03bc43daa06487446c46538160412b6f901c9af74c55d6d410d7d701d16
|
File details
Details for the file kubernetes_readonly_mcp-0.1.3-py3-none-any.whl.
File metadata
- Download URL: kubernetes_readonly_mcp-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbd94d8c09d7b2d9778ae0d505076e382efd8b67ae101e54621dd5e7f8aa4991
|
|
| MD5 |
b5ef62e11cf2ff8a86b74615382d5336
|
|
| BLAKE2b-256 |
b6fb01979fc94ba0d5c5130021bf34217d51bfe004b3e41fd652839783e91edf
|