
How to add kubefwd to Cursor
Bulk Kubernetes port forwarding with an MCP server that lets AI assistants forward services, inspect pods, and monitor traffic. Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 14, 2026 · 4.1k★ · stdio · no auth · official
Cursor config for kubefwd
brew install kubefwd{
"mcpServers": {
"kubefwd": {
"command": "kubefwd",
"args": [
"mcp"
]
}
}
}Setup steps
- 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the kubefwd config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of kubefwd's tools to confirm it's connected.
Before you start
- kubefwd installed and on your PATH (brew install kubefwd, winget/scoop on Windows, or .deb/.rpm/.tar.gz from GitHub releases)
- kubectl configured with cluster access (a valid kubeconfig)
- Root/sudo access to run kubefwd itself (for /etc/hosts and network interfaces)
- kubefwd running with the API enabled so the MCP bridge can reach it, e.g. `sudo -E kubefwd --api` or `sudo -E kubefwd --tui`
What kubefwd can do in Cursor
list_k8s_namespacesList available Kubernetes namespaces and which are forwarded.
list_k8s_servicesList services in a namespace with their types, ports, and selectors.
list_contextsList available Kubernetes contexts (clusters) from your kubeconfig.
add_namespaceForward all services in a namespace to localhost with automatic /etc/hosts entries.
remove_namespaceStop forwarding an entire namespace.
add_serviceForward a specific service, optionally with custom port mappings.
remove_serviceStop forwarding an individual service.
list_servicesList currently forwarded services.
Security
kubefwd itself requires root/sudo to modify /etc/hosts and create loopback network interfaces, but the MCP bridge (kubefwd mcp) runs as a standard user with no elevated privileges. The kubefwd REST API binds to localhost by default, so forwards are only reachable on your machine. kubefwd uses your existing kubeconfig; no cluster credentials are passed through MCP. Exposing the API via a public tunnel (e.g. ngrok, required for ChatGPT/remote HTTP-SSE clients) gives external access to your forwards and should only be done in development with tunnel authentication enabled.
kubefwd + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the kubefwd config there under the "mcpServers" key and restart the client.
Is kubefwd safe to use with Cursor?
kubefwd itself requires root/sudo to modify /etc/hosts and create loopback network interfaces, but the MCP bridge (kubefwd mcp) runs as a standard user with no elevated privileges. The kubefwd REST API binds to localhost by default, so forwards are only reachable on your machine. kubefwd uses your existing kubeconfig; no cluster credentials are passed through MCP. Exposing the API via a public tunnel (e.g. ngrok, required for ChatGPT/remote HTTP-SSE clients) gives external access to your forwards and should only be done in development with tunnel authentication enabled.
How do I add the kubefwd MCP server to Claude Code?
Run `claude mcp add --transport stdio kubefwd -- kubefwd mcp`, then verify with `claude mcp list`. Claude Code spawns `kubefwd mcp` automatically when needed. kubefwd itself must already be running with the API enabled (e.g. `sudo -E kubefwd --api` or `sudo -E kubefwd --tui`).
What transport does it use, and does my AI client need root?
It uses stdio transport. The MCP bridge (kubefwd mcp) runs as a standard, unprivileged user and talks to the privileged kubefwd process over its localhost REST API, so your AI client never needs sudo. Only the main kubefwd process requires root for /etc/hosts and network interface changes.
Does kubefwd MCP need any API keys or credentials?
No. kubefwd uses your existing kubeconfig for cluster access, and no credentials are passed through MCP. The MCP config is just the `kubefwd` command with the `mcp` argument.