Kubernetes Port Forward MCP

Kubernetes Port Forward MCP

k8s-port-forward-mcp•byoijusti

An MCP server that discovers Kubernetes services and starts and stops kubectl port-forward sessions through tool calls.

License: Not specified•Runtime: Awaiting documentation review•Category: cloud devops

WHAT IT DOES

  • •Lists namespaces and infers services from running pods, grouped by short name and environment.
  • •Starts port-forwards for multiple services in a single tool call, each with its own namespace, environment and ports.
  • •Can open kubectl log output in a separate terminal window per service.
  • •Stops all active port-forward processes it started.

BEST FOR

  • •Agents that should discover available services and establish port-forwards from natural language rather than manual kubectl commands.
  • •Starting several service port-forwards at once against specific ports and environments.
  • •Forwarding to a service on a chosen remote (cluster) port and environment.

ABOUT K8S-PORT-FORWARD-MCP

Kubernetes Port Forward MCP is cataloged as an MCP server attributed to oijusti. An MCP server that discovers Kubernetes services and starts and stops kubectl port-forward sessions through tool calls. It is categorized under cloud devops. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Kubernetes Port Forward MCP are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What MCP tools does this server expose?

It provides namespace and service listing tools, a start port-forward tool for one or more services, and a stop tool for all active port-forwards it started.

Where do the port-forwards run?

Port-forwards run within the MCP server process.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 6e3529b5a6dd · 采集于 2026-11-13 12:26:30 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Kubernetes Port Forward MCP

A Model Context Protocol (MCP) server that provides tools for discovering Kubernetes services and running kubectl port-forward sessions (optionally with separate log windows). It is designed for MCP clients/LLMs that translate natural language into structured tool calls.

Kubernetes Port Forward MCP vs kubectl port-forward

This package provides an MCP interface on top of the standard kubectl workflow.

  • kubectl: Best when you already know exact namespace/pod/ports and prefer manual control.
  • MCP: Best when an agent should discover services and run one or many port-forwards via tool calls.

Key Features

  • Service discovery: list namespaces and infer services (short name → environments → namespace) from running pods.
  • Multi-service in one session: start multiple port-forwards with one tool call.
  • LLM-friendly API: start_k8s_port_forward accepts an array so each service can use different namespace, environment, localPort, and remotePort.
  • Optional logs: open kubectl logs -f in a separate OS-level terminal window per service.

Table of Contents

Requirements

  • Node.js 18 or newer
  • kubectl installed and configured with access to your cluster
  • VS Code, Cursor, Windsurf, Claude Desktop, Cline, or any other MCP client

Quick Start

  1. Add this server to your MCP client (use the config in Getting Started below).
  2. Ask your assistant: "List available Kubernetes services."
  3. Ask your assistant: "Run api service on local port 3002."
  4. Open the returned URL (for example http://localhost:3002).
  5. When finished, ask: "Stop all port-forwards."

Getting Started

First, install the Kubernetes Port Forward MCP server with your client.

Standard config works in most MCP clients:

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

Install in VS Code Install in VS Code Insiders

Amp

Add via the Amp VS Code extension settings screen or by updating your settings.json file:

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

Amp CLI Setup:

Add via the amp mcp add command below:

amp mcp add k8s-port-forward -- npx -y k8s-port-forward-mcp@latest
Antigravity

Add via the Antigravity settings or by updating your configuration file:

{
  "mcpServers": {
    "k8s-port-forward": {
      "command": "npx",
      "args": ["-y", "k8s-port-forward-mcp@latest"]
    }
  }
}
Claude Code

Use the Claude Code CLI to add the Kubernetes Port Forward MCP server:

claude mcp add k8s-port-forward npx -y k8s-port-forward-mcp@latest
Claude Desktop

Follow the MCP install guide, use the standard config above.

Cline

Follow the instruction in the section Configuring MCP Servers

Example: Local Setup

Add the following to your cline_mcp_settings.json file:

{
  "mcpServers": {
    "k8s-port-forward": {
      "type": "stdio",
      "command": "npx",
      "timeout": 30,
      "args": ["-y", "k8s-port-forward-mcp@latest"],
      "disabled": false
    }
  }
}
Codex

Use the Codex CLI to add the Kubernetes Port Forward MCP server:

codex mcp add k8s-port-forward npx "-y" "k8s-port-forward-mcp@latest"

Alternatively, create or edit the configuration file ~/.codex/config.toml and add:

[mcp_servers.k8s-port-forward]
command = "npx"
args = ["-y", "k8s-port-forward-mcp@latest"]

For more information, see the Codex MCP documentation.

Copilot

Use the Copilot CLI to interactively add the Kubernetes Port Forward MCP server:

/mcp add

Alternatively, create or edit the configuration file ~/.copilot/mcp-config.json and add:

{
  "mcpServers": {
    "k8s-port-forward": {
      "type": "local",
      "command": "npx",
      "tools": ["*"],
      "args": ["-y", "k8s-port-forward-mcp@latest"]
    }
  }
}

For more information, see the Copilot CLI documentation.

Cursor

Click the button to install:

Install in Cursor

Or install manually:

Go to Cursor Settings -> MCP -> Add new MCP Server. Name to your liking, use command type with the command npx -y k8s-port-forward-mcp@latest. You can also verify config or add command arguments via clicking Edit.

Factory

Use the Factory CLI to add the Kubernetes Port Forward MCP server:

droid mcp add k8s-port-forward "npx -y k8s-port-forward-mcp@latest"

Alternatively, type /mcp within Factory droid to open an interactive UI for managing MCP servers.

For more information, see the Factory MCP documentation.

Gemini CLI

Follow the MCP install guide, use the standard config above.

Goose

Click the button to install:

Install in Goose

Or install manually:

Go to Advanced settings -> Extensions -> Add custom extension. Name to your liking, use type STDIO, and set the command to npx -y k8s-port-forward-mcp@latest. Click "Add Extension".

Kiro

Follow the MCP Servers documentation. For example in .kiro/settings/mcp.json:

{
  "mcpServers": {
    "k8s-port-forward": {
      "command": "npx",
      "args": ["-y", "k8s-port-forward-mcp@latest"]
    }
  }
}
LM Studio

Click the button to install:

Add MCP Server k8s-port-forward to LM Studio

Or install manually:

Go to Program in the right sidebar -> Install -> Edit mcp.json. Use the standard config above.

opencode

Follow the MCP Servers documentation. For example in ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "k8s-port-forward": {
      "type": "local",
      "command": ["npx", "-y", "k8s-port-forward-mcp@latest"],
      "enabled": true
    }
  }
}
Qodo Gen

Open Qodo Gen chat panel in VSCode or IntelliJ -> Connect more tools -> + Add new MCP -> Paste the standard config above.

Click Save.

VS Code

Click the button to install:

Install in VS Code Install in VS Code Insiders

Or install manually:

Follow the MCP install guide, use the standard config above. You can also install the Kubernetes Port Forward MCP server using the VS Code CLI:

# For VS Code
code --add-mcp '{"name":"k8s-port-forward","command":"npx","args":["-y","k8s-port-forward-mcp@latest"]}'

After installation, the Kubernetes Port Forward MCP server will be available for use with your GitHub Copilot agent in VS Code.

Warp

Go to Settings -> AI -> Manage MCP Servers -> + Add to add an MCP Server. Use the standard config above.

Alternatively, use the slash command /add-mcp in the Warp prompt and paste the standard config from above:

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

Follow Windsurf MCP documentation. Use the standard config above.

Examples

Quick reference (natural language → tool calls)

  • "Run api and auth services on local ports 3002, 3003"
    → list_k8s_services({}) then start_k8s_port_forward({ services: [{ serviceName: "api", localPort: 3002 }, { serviceName: "auth", localPort: 3003 }] })

  • "Run order service from shared services namespace in local port 3000"
    → start_k8s_port_forward({ services: [{ serviceName: "order", namespace: "shared-services", localPort: 3000 }] })

  • "Run order service from shared services namespace and remote port 3000 in local port 3000"
    → start_k8s_port_forward({ services: [{ serviceName: "order", namespace: "shared-services", localPort: 3000, remotePort: 3000 }] })

  • "Run api service in qa environment on local port 3001"
    → start_k8s_port_forward({ services: [{ serviceName: "api", environment: "qa", localPort: 3001 }] })

  • "Run auth service in prod environment from production namespace on local port 3002"
    → start_k8s_port_forward({ services: [{ serviceName: "auth", environment: "prod", namespace: "production", localPort: 3002 }] })

  • "Stop all port-forwards"
    → stop_k8s_port_forward({})

Detailed workflow example

User: "Run the frontend service in qa on port 3001"

AI workflow:

  1. Call list_k8s_services({}) to find the exact service name.
  2. Receive list containing e.g. frontend: qa (ns: ...), dev (ns: ...).
  3. Call start_k8s_port_forward({ services: [{ serviceName: "frontend", environment: "qa", localPort: 3001 }] }).
  4. Result: port-forwards run in the MCP server process; if includeLogs is true, logs open in a separate window. The tool result includes http://localhost:3001 and the exact kubectl commands.

Tools

Service discovery
  • list_k8s_namespaces

    • Title: List namespaces
    • Description: List all available Kubernetes namespaces.
    • Parameters: None
    • Read-only: true
  • list_k8s_services

    • Title: List services
    • Description: List available services grouped by short name and environment.
    • Parameters:
      • namespace (string, optional): Filter results to a namespace.
    • Read-only: true
Port forwarding
  • start_k8s_port_forward

    • Title: Start port-forward
    • Description: Start port-forwarding for one or more services.
    • Parameters:
      • services (array, required): List of service configs.
        • serviceName (string, required): Short name of the service. (Call list_k8s_services first.)
        • localPort (number, required): Local port to bind (1-65535).
        • namespace (string, optional): Namespace to target.
        • remotePort (number, optional): Remote (cluster) port.
        • environment (string, optional): dev | qa | stg | prod.
        • includeLogs (boolean, optional): Whether to open logs in a separate window (default: true).
    • Read-only: false
  • stop_k8s_port_forward

    • Title: Stop port-forward
    • Description: Stop all active port-forward processes started by this MCP server.
    • Parameters: None
    • Read-only: false

Validation and Debugging

Since the MCP server spawns actual kubectl processes in the background, you may want to verify what's running and see the exact commands being executed.

Checking running kubectl processes

Windows (PowerShell):

# List all kubectl processes
tasklist /fi "imagename eq kubectl.exe"

# See the exact commands with process IDs
Get-CimInstance Win32_Process -Filter "Name='kubectl.exe'" | Select-Object ProcessId,CommandLine

Linux/macOS:

# List all kubectl processes
ps aux | grep kubectl

# See the exact commands with process IDs
ps -ef | grep kubectl

This helps you:

  • Verify port-forwards are actually running
  • See the exact namespaces and ports being used
  • Identify stuck processes that might need manual termination
  • Debug connectivity issues by examining the actual commands

Common failures and fixes

  • Port already in use: choose another local port or stop the conflicting process.
  • Connection refused: verify service name, namespace, and selected environment.
  • No logs window: set includeLogs: true in the port-forward request.
  • Stuck process: terminate by PID (taskkill /PID <pid> on Windows, kill <pid> on Linux/macOS).

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Kubernetes Port Forward MCP from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/k8s-port-forward-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related cloud devops MCP Servers

Alternative and complementary servers in the same category

View all in cloud devops →
Huawei MCP Server
mcp-server-huaweiclouddeveloper•huaweiclouddeveloper

A Model Context Protocol server built on Huawei Cloud services that enables AI assistants to operate Huawei Cloud resources within conversational workflows, supporting ECS, OBS, GaussDB, and other cloud products.

Repository stats unavailable
Cloud & DevOps
Coolify MCP Server
coolify-mcp-server•wrediam

An MCP server that exposes the Coolify v4.3.1 REST API so AI clients can manage applications, databases, services, servers, deployments, and more.

Repository stats unavailable
Cloud & DevOps

A deprecated Model Context Protocol server for interacting with Kong Konnect APIs, enabling AI assistants to query and analyze Kong Gateway configurations, traffic, and analytics.

Repository stats unavailable
Cloud & DevOps