This guide provides instructions for installing, configuring, and using the MCP Server for Kubernetes Support Bundles.
The easiest way to use the MCP server is with Docker. The provided Docker image includes all necessary dependencies.
- Build the Docker image:
docker build -t mcp-server-troubleshoot:latest .- Run the container:
docker run -i --rm \
-v "/path/to/bundles:/data/bundles" \
-e SBCTL_TOKEN="your-token" \
mcp-server-troubleshoot:latestFor complete Docker usage instructions, including container configuration and environment variables, see the Docker documentation.
To use the Docker container with MCP clients like Claude or other AI models, add it to your client's configuration. The server provides a command to generate the necessary configuration:
docker run --rm mcp-server-troubleshoot:latest --show-configIf you prefer to install the MCP server manually:
-
Ensure you have Python 3.13 installed.
-
Install required system dependencies:
# For Ubuntu/Debian
sudo apt-get update && sudo apt-get install -y curl
# For macOS
brew install curl-
Install the
kubectlcommand-line tool. -
Install the
sbctlcommand-line tool for bundle management. -
Create a virtual environment with UV (recommended):
# Create virtual environment
uv venv -p python3.13 .venv
source .venv/bin/activate- Install the MCP server package:
# For development mode
git clone https://github.com/user/troubleshoot-mcp-server.git
cd troubleshoot-mcp-server
uv pip install -e ".[dev]" The MCP server uses token-based authentication for accessing support bundles. You need to provide your authentication token using the SBCTL_TOKEN environment variable.
export SBCTL_TOKEN=your-tokenThis token is used to authenticate with the support bundle service when downloading and managing bundles.
The MCP server exposes the following tools for AI models to interact with Kubernetes support bundles:
-
initialize_bundle: Initialize a support bundle for use.
- Parameters:
source: Path to the support bundle file (.tar.gz)
- Returns: Information about the initialized bundle
- Parameters:
-
list_bundles: List available support bundles.
- Parameters: None
- Returns: List of available bundles
-
get_bundle_info: Get information about the current active bundle.
- Parameters: None
- Returns: Bundle information object
- kubectl: Execute kubectl commands against the bundle.
- Parameters:
command: The kubectl command to execute (without 'kubectl' prefix)
- Returns: Command output as string
- Parameters:
Examples:
kubectl command="get pods -n kube-system"
kubectl command="describe deployment nginx -n default"
kubectl command="get nodes -o json"
-
list_files: List files and directories.
- Parameters:
path: Directory path (relative to bundle root)recursive(optional): Whether to list recursively (default: false)
- Returns: List of file information objects
- Parameters:
-
read_file: Read file contents.
- Parameters:
path: File path (relative to bundle root)
- Returns: File contents as string
- Parameters:
-
grep_files: Search for files containing a pattern.
- Parameters:
pattern: Pattern to search forpath(optional): Path to restrict search to
- Returns: List of matching file paths with line numbers
- Parameters:
Examples:
list_files path="/kubernetes/pods"
read_file path="/kubernetes/pods/kube-apiserver.yaml"
grep_files pattern="CrashLoopBackOff"
# List all namespaces
kubectl command="get namespaces"
# List pods in a specific namespace
kubectl command="get pods -n kube-system"
# Get details of a specific pod
kubectl command="describe pod kube-apiserver-master -n kube-system"
# Check node status
kubectl command="get nodes"
# Get detailed node information
kubectl command="describe node my-node-name"
# Check pod distribution across nodes
kubectl command="get pods -o wide --all-namespaces"
# List log files
list_files path="/kubernetes/logs"
# Read specific log file
read_file path="/kubernetes/logs/kube-apiserver.log"
# Search logs for errors
grep_files pattern="error" path="/kubernetes/logs"
# List pod definition files
list_files path="/kubernetes/pods"
# Read pod definition
read_file path="/kubernetes/pods/kube-apiserver-master.yaml"
# Search for resource limits in pod definitions
grep_files pattern="resources:" path="/kubernetes/pods"
If you encounter problems initializing a support bundle:
- Verify that your
SBCTL_TOKENis set correctly and valid. - Check network connectivity to the support bundle service.
- Ensure the bundle ID exists and is accessible with your token.
- Check available disk space for bundle extraction.
If kubectl commands fail:
- Verify that the bundle is properly initialized.
- Check the command syntax for errors.
- Ensure the command is supported within a bundle context.
- Check if the resources you're querying exist in the bundle.
If file operations fail:
- Verify the path is correct and exists within the bundle.
- Check file permissions.
- Ensure the bundle is properly initialized.
- Use
list_filesto verify the correct path structure.
If using the Docker container:
- Verify the volume mount is correct.
- Ensure environment variables are properly set.
- Check Docker logs for error messages.
- See Docker troubleshooting for more details.