kubectl MCP Plugin
An MCP server for kubectl, enabling AI assistants to interact with Kubernetes clusters through a standardized protocol.
kubectl MCP (Model Context Protocol) Plugin
Overview
The kubectl-mcp plugin implements a Model Context Protocol (MCP) server for kubectl. This server enables AI assistants like Amazon Q to interact with kubectl functionality directly through a standardized protocol, allowing for seamless integration of kubectl commands into AI-powered workflows.
What is MCP?
Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context and tools to Large Language Models (LLMs). It enables AI assistants to:
- Discover available tools and their capabilities
- Execute commands and receive structured responses
- Provide contextual information to enhance AI interactions
How the kubectl MCP Plugin Works
The kubectl MCP plugin exposes all kubectl commands as tools that can be invoked by AI assistants. The implementation consists of several key components:
Core Components
main.go: Entry point that starts the MCP serverpkg/mcp/server.go: Creates and configures the MCP server with all kubectl commandspkg/mcp/tools.go: Handles the registration of kubectl commands as MCP tools
Implementation Details
- The server uses the
mcp-golibrary to implement the Model Context Protocol - It dynamically registers all kubectl commands (get, apply, delete, etc.) as MCP tools
- Each command's help text, flags, and parameters are exposed through the protocol
- The server runs as a stdio server, communicating through standard input/output
Command Registration Process
- The server recursively traverses the kubectl command tree
- For each command, it extracts:
- Command description and usage information
- Available flags and their descriptions
- Required and optional parameters
Using the kubectl MCP Plugin with Amazon Q Chat
To use the kubectl MCP plugin with Amazon Q Chat, you need to register it in the Amazon Q configuration file.
Create or edit the file at $HOME/.aws/amazonq/mcp.json with the following content:
{
"mcpServers": {
"kubectl": {
"command": "kubectl-mcp",
"args": []
}
}
}
This configuration tells Amazon Q Chat to:
- Register a server named "kubectl"
- Use the
kubectl-mcpcommand to start the MCP server - Make all kubectl commands available as tools with the prefix
kubectl___
Benefits
- Seamless Integration: AI assistants can execute kubectl commands directly
- Structured Responses: Commands return structured data that can be parsed by AI models
- Discoverability: AI assistants can discover available commands and their parameters
- Context-Aware: Provides rich context about Kubernetes resources
Installation
To install the kubectl MCP plugin:
-
Build the plugin:
make kubectl-mcp -
Move the binary to a location in your PATH:
sudo mv kubectl-mcp /usr/local/bin/ -
Verify the installation:
kubectl plugin list | grep mcp
Quick test for MCP server
To quickly test the MCP server, you can run the following command in your terminal:
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | kubectl-mcp | jq
Recommendations
- Monitor background operations for long-running commands. Commands such as resource creation have a 45-second timeout for command responses but the processes continue in background.
- For complex kubectl operations, consider using the plugin in combination with kubectl apply -f for declarative resource management.
เซิร์ฟเวอร์ที่เกี่ยวข้อง
GetYourGuide
Integrate with the GetYourGuide Partner API to access travel activities and experiences.
Grok MCP Plugin
Integrate with the Grok AI API to access its powerful language models.
CData SAP Concur
A read-only MCP server to query live SAP Concur data, powered by CData.
DeAI API MCP Server
Interact with the DeAI API for token analysis, holder tracking, and wallet portfolio analytics on Ethereum.
Google Cloud MCP
Interact with Google Cloud services and manage your cloud resources.
APS MCP Server
A Node.js server for the Model Context Protocol that provides access to the Autodesk Platform Services (APS) API with fine-grained access control.
Simple OpenStack MCP
Execute OpenStack CLI commands using LLMs. Requires a configured OpenStack CLI environment.
Spotify
Control Spotify playback and manage your liked songs using LLMs.
Pangea MCP Server
An MCP server for integrating with Pangea's security APIs, including Secure Audit Log.
Free Crypto News
Free crypto news API + MCP - real-time aggregator for Bitcoin, Ethereum, DeFi, Solana & altcoins. No API key required. RSS/Atom feeds, JSON REST API, historical archive with market context, embeddable widgets, ChatGPT plugin, Claude MCP server, SDKs (Python, TypeScript, Go, React, PHP). AI/LLM ready. Vibe coding friendly. Open source.