AI agents (MCP server)

Let Claude Code, Cursor and other MCP clients inspect and operate your clusters, with a read-only switch and per-change approval.

mcpmodel context protocolclaude codecursorai agentautomationapprovalread-only

AI agents (MCP server)

The MCP server runs inside the Kubexer Kubernetes desktop app.

Let an AI agent on this computer, such as Claude Code, Claude Desktop or Cursor, inspect and operate your clusters through a local Model Context Protocol (MCP) server. Agents use the clusters you have already added to Kubexer.

Turn it on

  1. Open Settings → AI Agents.
  2. Switch on Allow AI agents to use Kubexer. The status changes to Running.
  3. Optionally change the Port (default 47822).

The server only runs while Kubexer is open.

Connect an agent

Under Connect your agent:

  • Claude Code: copy the command and run it once in your terminal. It looks like claude mcp add --transport http kubexer http://127.0.0.1:47822/… --header "Authorization: Bearer …".
  • Other MCP clients: copy the JSON config into the client's MCP settings.

Both include the bearer token. Regenerate replaces it and disconnects every agent set up with the old one.

What agents can do

Every tool takes a cluster (an id or context name from list_clusters). A cluster that is not connected is connected on first use.

  • Read: namespaces, resources and their YAML, pod logs, events, cluster and namespace health, top pods and nodes, diagnosing pods, failing pods, unschedulable pods, service endpoints, ingress, network policies, PVCs, quotas and more.
  • Change: restart, scale, suspend or resume, trigger a CronJob, apply YAML, delete a resource, cordon or uncordon a node, and run a command in a pod.
  • Check an edit first: preview_resource_yaml validates a manifest with a server-side dry run and saves nothing.
  • Pro features, following your plan: global search, "who can" RBAC queries (Security Matrix), Cluster Alerts, and Security Scanner results.

Control what they may change

Under Cluster changes:

  • Allow agents to change clusters: when off, the server is read-only.
  • Ask me before each change: every change waits for you to approve or decline it in Kubexer. YAML edits show the resource before and after. Requests unanswered for two minutes are declined.
  • Allow agents to run commands in pods: a separate switch for exec_in_pod, which runs one non-interactive command and needs changes to be allowed too.

By default, changes are allowed and approval is off. Turn on Ask me before each change if you want to approve each one.

Every change shows a notification, and Recent agent activity lists what agents did.

Security

  • The server listens on 127.0.0.1 only, and requests from web pages are refused.
  • Agents never see kubeconfig credentials. Secret values are redacted in what they read.
  • Agents act with the permissions of the context you added. Use a narrower context or a scoped kubeconfig if that matters.
  • Output from exec_in_pod, and log lines, can contain sensitive text that then reaches the agent. Keep exec off if that is a concern.
  • Treat the token like a password.

Kubexy AI Assistant · Security Matrix