A Model Context Protocol (MCP) server for Kubernetes that enables AI assistants like Claude, Cursor, and others to interact with Kubernetes clusters through natural language.
A Model Context Protocol (MCP) server for Kubernetes that enables AI assistants like Claude, Cursor, and others to interact with Kubernetes clusters through natural language.
We are currently experiencing JSON parsing issues on our server. This has led to difficulties running MCP in:
I am actively working on resolving these issues. Given I'm handling the troubleshooting process independently, resolution may take some time as I'm conducting detailed tests for each service individually. If you can debug those issues, feel free to submit a Pull Request.
Your patience and continued support during this period are greatly appreciated. 🙏
Thank you for understanding!
The Kubectl MCP Tool implements the Model Context Protocol (MCP), enabling AI assistants to interact with Kubernetes clusters through a standardized interface. The architecture consists of:
The tool operates in two modes:
For detailed installation instructions, please see the Installation Guide.
You can install kubectl-mcp-tool directly from PyPI:
pip install kubectl-mcp-tool
For a specific version:
pip install kubectl-mcp-tool==1.1.0
The package is available on PyPI: https://pypi.org/project/kubectl-mcp-tool/1.1.0/
# Install latest version from PyPI
pip install kubectl-mcp-tool
# Or install development version from GitHub
pip install git+https://github.com/rohitg00/kubectl-mcp-server.git
# Clone the repository
git clone https://github.com/rohitg00/kubectl-mcp-server.git
cd kubectl-mcp-server
# Install in development mode
pip install -e .
After installation, verify the tool is working correctly:
# Check CLI mode
kubectl-mcp --help
Note: This tool is designed to work as an MCP server that AI assistants connect to, not as a direct kubectl replacement. The primary command available is kubectl-mcp serve
which starts the MCP server.
Add the following to your Claude Desktop configuration at ~/.config/claude/mcp.json
(Windows: %APPDATA%\Claude\mcp.json
):
{
"mcpServers": {
"kubernetes": {
"command": "python",
"args": ["-m", "kubectl_mcp_tool.minimal_wrapper"],
"env": {
"KUBECONFIG": "/path/to/your/.kube/config"
}
}
}
}
Add the following to your Cursor AI settings under MCP by adding a new global MCP server:
{
"mcpServers": {
"kubernetes": {
"command": "python",
"args": ["-m", "kubectl_mcp_tool.minimal_wrapper"],
"env": {
"KUBECONFIG": "/path/to/your/.kube/config",
"PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin"
}
}
}
}
Save this configuration to ~/.cursor/mcp.json
for global settings.
Note: Replace
/path/to/your/.kube/config
with the actual path to your kubeconfig file. On most systems, this is~/.kube/config
.
Add the following to your Windsurf configuration at ~/.config/windsurf/mcp.json
(Windows: %APPDATA%\WindSurf\mcp.json
):
{
"mcpServers": {
"kubernetes": {
"command": "python",
"args": ["-m", "kubectl_mcp_tool.minimal_wrapper"],
"env": {
"KUBECONFIG": "/path/to/your/.kube/config"
}
}
}
}
For automatic configuration of all supported AI assistants, run the provided installation script:
bash install.sh
This script will:
List all pods in the default namespace
Create a deployment named nginx-test with 3 replicas using the nginx:latest image
Get logs from the nginx-test pod
Forward local port 8080 to port 80 on the nginx-test pod
# Clone the repository
git clone https://github.com/rohitg00/kubectl-mcp-server.git
cd kubectl-mcp-server
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
# Run tests
python -m python_tests.test_all_features
├── kubectl_mcp_tool/ # Main package
│ ├── __init__.py # Package initialization
│ ├── cli.py # CLI entry point
│ ├── mcp_server.py # MCP server implementation
│ ├── mcp_kubectl_tool.py # Main kubectl MCP tool implementation
│ ├── natural_language.py # Natural language processing
│ ├── diagnostics.py # Diagnostics functionality
│ ├── core/ # Core functionality
│ ├── security/ # Security operations
│ ├── monitoring/ # Monitoring functionality
│ ├── utils/ # Utility functions
│ └── cli/ # CLI functionality components
├── python_tests/ # Test suite
│ ├── run_mcp_tests.py # Test runner script
│ ├── mcp_client_simulator.py # MCP client simulator for mock testing
│ ├── test_utils.py # Test utilities
│ ├── test_mcp_core.py # Core MCP tests
│ ├── test_mcp_security.py # Security tests
│ ├── test_mcp_monitoring.py # Monitoring tests
│ ├── test_mcp_nlp.py # Natural language tests
│ ├── test_mcp_diagnostics.py # Diagnostics tests
│ └── mcp_test_strategy.md # Test strategy documentation
├── docs/ # Documentation
│ ├── README.md # Documentation overview
│ ├── INSTALLATION.md # Installation guide
│ ├── integration_guide.md # Integration guide
│ ├── cursor/ # Cursor integration docs
│ ├── windsurf/ # Windsurf integration docs
│ └── claude/ # Claude integration docs
├── compatible_servers/ # Compatible MCP server implementations
│ ├── cursor/ # Cursor-compatible servers
│ ├── windsurf/ # Windsurf-compatible servers
│ ├── minimal/ # Minimal server implementations
│ └── generic/ # Generic MCP servers
├── requirements.txt # Python dependencies
├── setup.py # Package setup script
├── pyproject.toml # Project configuration
├── MANIFEST.in # Package manifest
├── LICENSE # MIT License
├── CHANGELOG.md # Version history
├── .gitignore # Git ignore file
├── install.sh # Installation script
├── publish.sh # PyPI publishing script
└── start_mcp_server.sh # Server startup script
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.