Labsco
MCP SERVER

Kubernetes Port Forward – MCP Server

by oijusti

Say which service you want reachable locally and get a working port-forward, without looking up the namespace first.

Containers, Kubernetes & Cluster Operations
Summary
Discovery first, then forwarding — which is the part kubectl makes you do by hand.

The two read-only tools exist so a model can turn "the auth service in qa" into a real namespace and pod before forwarding anything, and the start call takes an array so a whole stack comes up in one request. Because it shells out to kubectl, you can always confirm what is running by listing processes yourself.

What it is

A wrapper around kubectl port-forward built for agents. It discovers services by short name from the pods that are actually running, then starts one or several forwards in a single call.

What you get
  • Every namespace the cluster exposes to you (list_k8s_namespaces)
  • Services grouped by short name and environment, inferred from running pods, so you can ask for a service without knowing where it lives (list_k8s_services)
  • Several port-forwards started at once, each with its own namespace, environment, local port and remote port (start_k8s_port_forward)
  • The URL to open and the exact kubectl command that was run, returned with the result
  • Log tailing per forwarded service, opened in its own terminal window when you want it
  • Every forward this server started, stopped in one call (stop_k8s_port_forward)
Requirements

Node.js and a kubectl already configured against your cluster — the server spawns real kubectl processes, so whatever kubectl can reach, this can reach. Runs from the published npm package, and the same configuration works across the common MCP clients.

Setup effort

One command — npx -y k8s-port-forward-mcp@latest