k8s-mcp-server
Provides read-only tools for Kubernetes cluster operations, including listing nodes and pods, retrieving details and logs, querying events, and real-time monitoring of cluster resources.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@k8s-mcp-serverlist all nodes and their status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
K8s Cluster Ops MCP Server
A Kubernetes operations query MCP service based on FastMCP. It wraps daily troubleshooting actions such as kubectl get / describe / logs / events --watch into read-only tools callable by LLMs, allowing clients like Claude to directly read cluster status and locate the source of problems.
⚠️ This project only exposes read-only tools (no create/update/delete). However, it is still recommended to use it with RBAC for a read-only ServiceAccount, see 'Security Recommendations' below.
Tool List
Tool | Description | Corresponding kubectl |
| Node list overview |
|
| Node details |
|
| Node resource requests/limits summary and overload assessment | Allocated resources of |
| Scan for problem nodes (NotReady / various Pressure) | — |
| Pod list (supports namespace / label / field filtering) |
|
| Pod details (supports locating by label / workload / name prefix) |
|
| Read Pod container logs |
|
| Query cluster events (deduplication + sorting) |
|
| Watch event stream in real time |
|
| Watch node status changes in real time |
|
| Watch Pod status changes in real time |
|
There are also two additional capabilities: @mcp.prompt (node troubleshooting / cluster inspection guidance) and @mcp.resource (k8s://cluster/summary cluster summary).
Related MCP server: Kubernetes MCP Server
Directory Structure
├── app.py # FastMCP 实例(叶子模块,破循环导入)
├── k8s_server.py # 入口:导入 Tools 即自动注册全部工具
├── k8s_client.py # K8s 客户端懒加载 + 单一配置真源
├── config.py # 12-Factor 环境变量配置
├── prompts.py # @mcp.prompt 引导
├── resources.py # @mcp.resource 资源
├── Tools/ # 每个工具一个文件,导入即注册
├── utils/ # 纯解析/辅助模块(无 K8s/MCP 依赖)
└── tests/ # 单元测试Installation and Running
# 1. 创建虚拟环境并安装依赖
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux / macOS
source .venv/bin/activate
pip install -r requirements.txt
# 2. 运行(HTTP transport,默认 127.0.0.1:8081)
python k8s_server.pyRun Tests
pip install -r requirements-dev.txt
python -m pytest -qConfiguration
All configuration is done through environment variables with defaults (see config.py):
Variable | Default | Description |
|
| Explicitly specify the kubeconfig path; leave empty to use the official resolution chain ( |
|
| Whether to verify TLS certificates; set to |
|
| MCP server name |
|
| Transport method, |
|
| Listen address |
|
| Listen port |
K8s connection configuration loading priority: in-cluster (SA inside Pod) → explicit KUBECONFIG_PATH → official kubeconfig resolution chain, a single source of truth, not assembled from multiple files.
Connect to MCP Client
Using Claude Code as an example (when the HTTP transport is already running on 127.0.0.1:8081):
{
"mcpServers": {
"k8s-node-server": {
"url": "http://127.0.0.1:8081/mcp"
}
}
}Security Recommendations
Use read-only RBAC: configure a read-only ClusterRole for the Pods/users running this service, and avoid reusing high-privilege credentials.
Bind to localhost by default:
MCP_HOSTdefaults to127.0.0.1. If you need to expose it externally, be sure to add authentication (TLS + Token / OIDC) at the reverse proxy layer, because the HTTP transport itself has no authentication or rate limiting.Do not disable certificate verification:
K8S_VERIFY_SSL=falseis only for temporarily debugging self-signed certificates; keep ittruein production.Do not commit credentials: kubeconfig contains secrets;
.gitignorealready excludeskubeconfig*, never force-commit it.
Known Limitations
All tools are read-only and contain no mutation operations (this is by design).
The
watch_*family is limited by a global concurrency lock: only one watch is allowed to run at a time, to avoid adding pressure to the API Server.Event/log output has a length limit; oversized content will be truncated (see the truncation logic in
read_pod_logandmax_countinquery_events).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceProvides a set of read-only Kubernetes functions via an MCP server, enabling interaction with Kubernetes clusters through agents or coding assistants like GitHub Copilot.93Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables real-time Kubernetes cluster observability and debugging through standardized MCP interface. Provides access to pods, services, nodes, events, and includes built-in tools for cluster health analysis and issue identification.
- FlicenseNot gradedqualityDmaintenanceEnables Kubernetes cluster introspection via MCP tools, such as listing pods, namespaces, nodes, and events.4
- AlicenseAqualityCmaintenanceA read-only MCP server for inspecting Kubernetes clusters, allowing LLMs to list resources, describe pods, and read logs without mutation.5MIT
Related MCP Connectors
Read-only Remote MCP for externally grounded AI agent trust receipts.
A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zj-hub-coder/k8s-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server