K8s Port Forward MCP logo

K8s Port Forward MCP

Discover Kubernetes services and start one or more kubectl port-forward sessions through MCP.

Install K8s Port Forward MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "k8s-port-forward-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "k8s-port-forward-mcp@latest"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y k8s-port-forward-mcp@latest

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The k8s-port-forward-mcp MCP server connects MCP clients to Kubernetes through kubectl, allowing agents to discover services and start port-forward sessions. Its tools accept service, namespace, environment, and local or remote port details, with support for multiple forwards in one call. Optional log streaming opens a separate operating-system terminal window for each service. Use it when an agent needs to find running services and manage local access without manually entering every kubectl command.

Use cases

  • Discover available Kubernetes services before connecting locally
  • Start several service port-forwards with one agent request
  • Map remote Kubernetes ports to chosen local ports
  • Open live logs in separate terminal windows while forwarding

Key features

  • Kubernetes service discovery
  • Namespace and environment inference
  • Multiple port-forwards per request
  • Structured local and remote port configuration
  • Optional per-service log windows
  • kubectl-based execution

Tools12

What K8s Port Forward MCP lets your agent do. Expand a tool for its parameters.

Self-reported~25 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 83d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 16d ago via OSV.dev · k8s-port-forward-mcp@latest (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads171Package downloads in the last 30 days.
Last commit8mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed12Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How K8s Port Forward MCP works

What k8s-port-forward-mcp does

The k8s-port-forward-mcp MCP server adds an MCP interface to a Kubernetes port-forward workflow. It can inspect running pods to discover available services, relate short service names to environments and namespaces, and launch kubectl port-forward sessions on the developer's machine.

The service-discovery flow is intended for situations where an agent does not already know the exact namespace, pod, or port mapping. A client can ask for available Kubernetes services, then use the returned information to construct a port-forward request. Multiple services can be started through one request, and each entry can specify its own namespace, environment, local port, and remote port.

Optional log handling starts kubectl logs -f in a separate operating-system terminal window for each service. This keeps the forwarded connection and its live logs available as separate local processes or windows.

How it works

The server runs as a local MCP process and translates structured tool calls into Kubernetes discovery and kubectl operations. Kubernetes access is not provided by the package itself: the host must already have kubectl installed and configured with permission to access the target cluster.

The main port-forward operation accepts an array of service configurations, which lets an MCP client request different ports or environments in the same call. A typical workflow is to list services, choose a service and environment, start a forward such as a local port mapped to a remote port, and then open the returned local URL.

Compared with running kubectl port-forward directly, k8s-port-forward-mcp is aimed at agent-driven discovery and structured requests. Direct kubectl remains the better fit when the operator already knows the exact namespace, pod, and ports and wants manual control.

Setup and configuration

The runtime requires Node.js 18 or newer and a working kubectl installation with cluster access. A standard stdio configuration launches the package through npm's executor:

config.json
{
  "mcpServers": {
    "k8s-port-forward": {
      "command": "npx",
      "args": ["-y", "k8s-port-forward-mcp@latest"]
    }
  }
}

Add this configuration to an MCP client that supports local stdio servers. The README provides client-specific instructions for VS Code, Cursor, Windsurf, Claude Desktop, Cline, Claude Code, Codex, Gemini CLI, and LM Studio, among others. No server-specific environment variables are documented.

Tools and capabilities

Supported operations and inputs documented for the server include:

  • Listing Kubernetes services and discovering namespaces.
  • Starting Kubernetes port-forwards through the start_k8s_port_forward operation.
  • Supplying serviceName, namespace, environment, localPort, and remotePort for each requested forward.
  • Starting multiple forwards in one MCP call.
  • Requesting optional live logs with includeLogs.
  • Selecting environment values such as dev, qa, stg, or prod where applicable.

The tool interface is designed for natural-language requests that an MCP client can convert into structured arguments. The server then uses the local Kubernetes context and kubectl configuration to perform the requested work.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about K8s Port Forward MCP

k8s-port-forward-mcp is an MCP server that connects MCP clients to Kubernetes through a locally configured kubectl installation. Its main tools discover available services and start kubectl port-forward sessions, including multiple forwards in one request. It can also open separate terminal windows for streaming service logs.

Install it by adding a local stdio MCP entry that runs `npx -y k8s-port-forward-mcp@latest`. The host needs Node.js 18 or newer, kubectl, and configured access to the target Kubernetes cluster. The README includes client-specific setup instructions for several MCP clients.

Add a new MCP server in Cursor Settings, choose the command-based configuration, and use `npx -y k8s-port-forward-mcp@latest`. Cursor can then invoke the server's Kubernetes discovery and port-forward tools.

Yes, it can start multiple port-forwards in one tool call. Each service entry may use its own namespace, environment, local port, and remote port, allowing one request to configure different mappings for several services.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewK8s Port Forward MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/k8s-port-forward-mcp?style=directory)](https://allmcps.com/mcp/k8s-port-forward-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/k8s-port-forward-mcp"><img src="https://allmcps.com/api/badge/k8s-port-forward-mcp?style=directory" alt="K8s Port Forward MCP on AllMCPs" /></a>