The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the K8s Port Forward MCP listing page.
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.
kubectl port-forwardThis 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.start_k8s_port_forward accepts an array so each service can use different namespace, environment, localPort, and remotePort.kubectl logs -f in a separate OS-level terminal window per service.kubectl installed and configured with access to your clusterhttp://localhost:3002).First, install the Kubernetes Port Forward MCP server with your client.
Standard config works in most MCP clients:
Add via the Amp VS Code extension settings screen or by updating your settings.json file:
Amp CLI Setup:
Add via the amp mcp add command below:
Add via the Antigravity settings or by updating your configuration file:
Use the Claude Code CLI to add the Kubernetes Port Forward MCP server:
Follow the MCP install guide, use the standard config above.
Follow the instruction in the section Configuring MCP Servers
Example: Local Setup
Add the following to your cline_mcp_settings.json file:
Use the Codex CLI to add the Kubernetes Port Forward MCP server:
Alternatively, create or edit the configuration file ~/.codex/config.toml and add:
For more information, see the Codex MCP documentation.
Use the Copilot CLI to interactively add the Kubernetes Port Forward MCP server:
Alternatively, create or edit the configuration file ~/.copilot/mcp-config.json and add:
For more information, see the Copilot CLI documentation.
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.
Use the Factory CLI to add the Kubernetes Port Forward MCP server:
Alternatively, type /mcp within Factory droid to open an interactive UI for managing MCP servers.
For more information, see the Factory MCP documentation.
Follow the MCP install guide, use the standard config above.
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".
Follow the MCP Servers documentation. For example in .kiro/settings/mcp.json:
Go to Program in the right sidebar -> Install -> Edit mcp.json. Use the standard config above.
Follow the MCP Servers documentation. For example in ~/.config/opencode/opencode.json:
Open Qodo Gen chat panel in VSCode or IntelliJ -> Connect more tools -> + Add new MCP -> Paste the standard config above.
Click Save.
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:
After installation, the Kubernetes Port Forward MCP server will be available for use with your GitHub Copilot agent in VS Code.
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:
Follow Windsurf MCP documentation. Use the standard config above.
"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({})
User: "Run the frontend service in qa on port 3001"
AI workflow:
list_k8s_services({}) to find the exact service name.frontend: qa (ns: ...), dev (ns: ...).start_k8s_port_forward({ services: [{ serviceName: "frontend", environment: "qa", localPort: 3001 }] }).includeLogs is true, logs open in a separate window. The tool result includes http://localhost:3001 and the exact kubectl commands.list_k8s_namespaces
list_k8s_services
namespace (string, optional): Filter results to a namespace.start_k8s_port_forward
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).stop_k8s_port_forward
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.
Windows (PowerShell):
Linux/macOS:
This helps you:
includeLogs: true in the port-forward request.taskkill /PID <pid> on Windows, kill <pid> on Linux/macOS).