Kubernetes MCP serverand Python AI tasks
qbash hosts a Kubernetes MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse. Developers use qbash Tasks to write cloud-hosted Python functions that pair Kubernetes with models such as Claude and GPT.
Add the qbash MCP
Use Kubernetes from Claude Code, Codex, Cursor and other MCP clients. Connect Kubernetes in qbash, and your agent can work with its data and build Tasks that call it.
claude mcp add --transport http qbash https://mcp.qbash.com/mcp
Then run /mcp in Claude Code and sign in with qbash.
- List namespaces with their status and labels
- List pods in a namespace or across the cluster, filtered by label or field
- Read a pod's spec, container statuses, restart counts and conditions
- Read a container's logs, including the logs of its previous crashed run
- List events such as failed scheduling, image pull errors and OOM kills
- List deployments with their desired, ready and available replicas
Write a Kubernetes task in Python
A qbash Task is a Python function hosted in the cloud. Python is the runtime and defines the process, and built-in inline prompts run on leading models such as Claude, GPT, Gemini and Grok.
Run a Task on a schedule, from an HTTP request or when a connected app sends an event. Your agents and chat tools call it over MCP.
Each run is logged with its inputs and results, and you can turn data logging off for any Task. Every Task has version control, and each run is locked to the version it ran.
Explain the warning events in a namespace
Read the recent Warning events in one namespace and ask an inline prompt to group them by object and name the likely cause of each.
events = qbash.integrations.kubernetes.list_events(
namespace="YOUR_NAMESPACE",
field_selector="type=Warning",
limit=100,
)
if events["items"]:
report = qbash.ai.run_prompt(
slug="kubernetes-warning-events",
variables={"events": json.dumps(events["items"])},
)
qbash.output(report)
else:
qbash.output("No warning events in this namespace.")
Sample list_events response
{
"kind": "EventList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "48211937"
},
"items": [
{
"metadata": {
"name": "checkout-api-7d9f6c8b5-x2lqp.17f3a9c2b1e04d77",
"namespace": "checkout"
},
"involvedObject": {
"kind": "Pod",
"namespace": "checkout",
"name": "checkout-api-7d9f6c8b5-x2lqp",
"fieldPath": "spec.containers{api}"
},
"reason": "BackOff",
"message": "Back-off restarting failed container api in pod checkout-api-7d9f6c8b5-x2lqp_checkout(5b1c2f0e-0c41-4c8e-9a51-2f6d1e7b9a10)",
"type": "Warning",
"count": 23,
"firstTimestamp": "2026-11-12T08:41:07Z",
"lastTimestamp": "2026-11-12T09:02:44Z"
},
{
"metadata": {
"name": "checkout-worker-5c6b9d7f4-hm8rt.17f3a9d0c2a1b913",
"namespace": "checkout"
},
"involvedObject": {
"kind": "Pod",
"namespace": "checkout",
"name": "checkout-worker-5c6b9d7f4-hm8rt",
"fieldPath": "spec.containers{worker}"
},
"reason": "Failed",
"message": "Failed to pull image \"registry.example.com/checkout-worker:1.42.0\": manifest unknown",
"type": "Warning",
"count": 6,
"firstTimestamp": "2026-11-12T08:55:12Z",
"lastTimestamp": "2026-11-12T09:01:30Z"
},
{
"metadata": {
"name": "checkout-cache-0.17f3a9e17c0d2a55",
"namespace": "checkout"
},
"involvedObject": {
"kind": "Pod",
"namespace": "checkout",
"name": "checkout-cache-0"
},
"reason": "FailedScheduling",
"message": "0/6 nodes are available: 3 Insufficient memory, 3 node(s) had untolerated taint {dedicated: batch}.",
"type": "Warning",
"count": 4,
"firstTimestamp": "2026-11-12T08:58:03Z",
"lastTimestamp": "2026-11-12T09:03:10Z"
}
]
}
Custom MCP server
Build a custom MCP server with Kubernetes
Create a hosted MCP server that combines Kubernetes tools with your other connectors, Tasks and memory folders. You choose each tool it exposes, so a server can share Kubernetes reads with write tools left off.
Share the server with your team, and each person adds it to the client they already use.
Kubernetes MCP questions
Does Kubernetes have an official MCP server?
The Kubernetes project does not publish one. The open source containers/kubernetes-mcp-server moved to the containers GitHub organization in 2025, and Red Hat offers an MCP server for OpenShift as a Technology Preview. You run either one yourself with your own credentials. qbash hosts its server for you on one URL with your other connectors, and the same methods run in Python Tasks.
What does the Kubernetes connector need to connect?
A service account token or a kubeconfig for a cluster whose API server qbash can reach over the internet. Bind the service account to a Role with get and list on the resources you read, and add patch or delete only for the write methods you plan to use.
Can the Kubernetes MCP server change my cluster?
Five methods write: scale_deployment, restart_deployment, cordon_node, delete_pod and apply_manifest. The service account's RBAC role sets what they can touch, and you can leave them off a server that should only read.
Related developer connectors
Build a Kubernetes task
Write it in Python with AI steps, or describe it to your coding agent through the qbash MCP.