Access Teleport Kubernetes clusters over MCP
This guide explains how to connect to Teleport Kubernetes Clusters with MCP clients.
Prerequisites
-
A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.
-
The
tshclient.Installing
tshclient-
Determine the version of your Teleport cluster. The
tshclient must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand use a JSON query tool to obtain your cluster version. Replace teleport.example.com:443 with the web address of your Teleport Proxy Service:TELEPORT_DOMAIN=teleport.example.com:443TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
Follow the instructions for your platform to install
tshclient:- Mac
- Windows - Powershell
- Linux
Download the signed macOS .pkg installer for Teleport, which includes the
tshclient:curl -O https://cdn.teleport.dev/teleport-${TELEPORT_VERSION?}.pkgIn Finder double-click the
pkgfile to begin installation.dangerUsing Homebrew to install Teleport is not supported. The Teleport package in Homebrew is not maintained by Teleport and we can't guarantee its reliability or security.
curl.exe -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-windows-amd64-bin.zipUnzip the archive and move the `tsh` client to your %PATH%
NOTE: Do not place the `tsh` client in the System32 directory, as this can cause issues when using WinSCP.
Use %SystemRoot% (C:\Windows) or %USERPROFILE% (C:\Users\<username>) instead.
All of the Teleport binaries in Linux installations include the
tshclient. For more options (including RPM/DEB packages and downloads for i386/ARM/ARM64) see our installation page.curl -O https://cdn.teleport.dev/teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gztar -xzf teleport-v${TELEPORT_VERSION?}-linux-amd64-bin.tar.gzcd teleportsudo ./installTeleport binaries have been copied to /usr/local/bin
-
- Kubernetes Clusters enrolled with Teleport. See our guides.
Step 1/2. Configure MCP clients
First, sign in into your Teleport cluster using tsh login:
tsh login --proxy=teleport.example.com:443 [email protected]
To list Kubernetes clusters available for you to access:
tsh kube lsKube Cluster Name Labels Selected----------------- ------- --------minikube env=dev *
Now log in to your Kubernetes cluster, replacing minikube with your our Kubernetes cluster name:
tsh kube login minikubeLogged into Kubernetes cluster "minikube". Try 'kubectl version' to test the connection.
This command also updates your default Kubernetes config.
Next, configure your MCP clients to use the
kubernetes-mcp-server
MCP server.
- Claude Desktop
- Cursor
- VS Code / VS Code Insiders
Open your claude_desktop_config.json and add the MCP server to the list of
mcpServers:
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": [
"-y",
"kubernetes-mcp-server@latest"
]
}
}
}
You can install the extension by editing the mcp.json file:
{
"mcpServers": {
"kubernetes-mcp-server": {
"command": "npx",
"args": ["-y", "kubernetes-mcp-server@latest"]
}
}
}
You can install the extension by running the following command:
For VS Code
code --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'For VS Code Insiders
code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'
Step 2/2. Access Teleport-protected resources over MCP
After configuring your MCP client, you will find Kubernetes and Helms tools from
kubernetes-mcp-server.
You can now use these tools to interact with your Kubernetes clusters via Teleport in your MCP clients:
Teleport behind TLS-terminating load balancers
If your Teleport cluster is behind a TLS-terminating load balancer or reverse
proxy, you can start a local proxy with tsh:
tsh proxy kube -p 8888
Copy the KUBECONFIG path from the output of the command, and add it with the
--kubeconfig flag in your MCP client configuration. For example:
{
"mcpServers": {
"kubernetes-mcp-server": {
"command": "npx",
"args": ["-y", "kubernetes-mcp-server@latest", "--kubeconfig", "/path/to/your/tsh/localproxy-8888-kubeconfig"]
}
}
}
Alternatively, you can use Teleport Connect to run
the local proxy to your Kubernetes cluster. You can find the KUBECONFIG path
from the terminal in Teleport Connect:
echo $KUBECONFIG/path/to/your/minikube-kubeconfig