Skip to main content
Glama

Kubectl MCP Tool

cursor_integration.md2.96 kB
# Cursor Integration Guide for kubectl-mcp-tool This guide explains how to integrate the kubectl-mcp-tool with Cursor AI assistant for natural language Kubernetes operations. ## Prerequisites - kubectl-mcp-tool installed - Cursor AI assistant - Python 3.8+ ## Setup 1. Install the kubectl-mcp-tool: ```bash pip install -e /path/to/kubectl-mcp-tool ``` 2. Start the MCP server with Cursor compatibility mode: ```bash python -m kubectl_mcp_tool.cli serve --cursor ``` 3. Configure Cursor to use the kubectl-mcp-tool: - Open Cursor AI assistant - Go to Settings > Tools - Add a new tool with the following configuration: - Tool Name: `kubectl-mcp-tool` - Command: `python -m kubectl_mcp_tool.cli serve --cursor` - Working Directory: `/path/to/kubectl-mcp-tool` ## Available Tools The kubectl-mcp-tool provides the following tools through the MCP interface: | Tool Name | Description | Parameters | |-----------|-------------|------------| | `process_natural_language` | Process natural language queries for kubectl operations | `query`: The natural language query to process | | `get_pods` | Get all pods in a namespace | `namespace`: The namespace to get pods from (optional) | | `get_namespaces` | Get all namespaces in the cluster | None | | `switch_namespace` | Switch to a different namespace | `namespace`: The namespace to switch to | | `get_current_namespace` | Get the current namespace | None | | `get_deployments` | Get all deployments in a namespace | `namespace`: The namespace to get deployments from (optional) | ## Example Natural Language Commands You can use the following natural language commands with Cursor: - "Get all pods" - "Show namespaces" - "Switch to namespace kube-system" - "What is my current namespace" - "Get deployments" - "Get services" - "Describe pod nginx-pod" ## Troubleshooting If you encounter issues with the Cursor integration, try the following: 1. **Client Closed Status**: If Cursor shows "Client closed" status, try restarting Cursor and the MCP server. 2. **Check Logs**: Look for error messages in the following log files: - `simple_mcp_server.log` - `simple_mcp_debug.log` - `kubectl_mcp_tool_cli.log` 3. **Test the Server**: Run the test script to verify the MCP server is working correctly: ```bash python test_simple_mcp_server.py ``` 4. **Cursor Configuration**: Ensure the tool is registered correctly in Cursor's configuration. 5. **Direct Server Run**: Try running the simple MCP server directly: ```bash python simple_mcp_server.py ``` ## Advanced Configuration For advanced configuration options, see the [Configuration Guide](./configuration.md). ## Example Usage in Cursor Once configured, you can use the kubectl-mcp-tool in Cursor by typing natural language commands like: ``` Get all pods in the default namespace ``` Cursor will use the kubectl-mcp-tool to execute the command and return the results.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rohitg00/kubectl-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server