|
| 1 | +# MCP Prompts Support |
| 2 | + |
| 3 | +The Kubernetes MCP Server supports [MCP Prompts](https://modelcontextprotocol.io/docs/concepts/prompts), which provide pre-defined workflow templates and guidance to AI assistants. |
| 4 | + |
| 5 | +## What are MCP Prompts? |
| 6 | + |
| 7 | +MCP Prompts are pre-defined templates that guide AI assistants through specific workflows. They combine: |
| 8 | +- **Structured guidance**: Step-by-step instructions for common tasks |
| 9 | +- **Parameterization**: Arguments that customize the prompt for specific contexts |
| 10 | +- **Conversation templates**: Pre-formatted messages that guide the interaction |
| 11 | + |
| 12 | +## Creating Custom Prompts |
| 13 | + |
| 14 | +Define custom prompts in your `config.toml` file - no code changes or recompilation needed! |
| 15 | + |
| 16 | +### Example |
| 17 | + |
| 18 | +```toml |
| 19 | +[[prompts]] |
| 20 | +name = "check-pod-logs" |
| 21 | +title = "Check Pod Logs" |
| 22 | +description = "Quick way to check pod logs" |
| 23 | + |
| 24 | +[[prompts.arguments]] |
| 25 | +name = "pod_name" |
| 26 | +description = "Name of the pod" |
| 27 | +required = true |
| 28 | + |
| 29 | +[[prompts.arguments]] |
| 30 | +name = "namespace" |
| 31 | +description = "Namespace of the pod" |
| 32 | +required = false |
| 33 | + |
| 34 | +[[prompts.messages]] |
| 35 | +role = "user" |
| 36 | +content = "Show me the logs for pod {{pod_name}} in {{namespace}}" |
| 37 | + |
| 38 | +[[prompts.messages]] |
| 39 | +role = "assistant" |
| 40 | +content = "I'll retrieve and analyze the logs for you." |
| 41 | +``` |
| 42 | + |
| 43 | +## Configuration Reference |
| 44 | + |
| 45 | +### Prompt Fields |
| 46 | +- **name** (required): Unique identifier for the prompt |
| 47 | +- **title** (optional): Human-readable display name |
| 48 | +- **description** (required): Brief explanation of what the prompt does |
| 49 | +- **arguments** (optional): List of parameters the prompt accepts |
| 50 | +- **messages** (required): Conversation template with role/content pairs |
| 51 | + |
| 52 | +### Argument Fields |
| 53 | +- **name** (required): Argument identifier |
| 54 | +- **description** (optional): Explanation of the argument's purpose |
| 55 | +- **required** (optional): Whether the argument must be provided (default: false) |
| 56 | + |
| 57 | +### Argument Substitution |
| 58 | +Use `{{argument_name}}` placeholders in message content. The template engine replaces these with actual values when the prompt is called. |
| 59 | + |
| 60 | +## Built-in Prompts |
| 61 | + |
| 62 | +The Kubernetes MCP Server includes several built-in prompts that are always available: |
| 63 | + |
| 64 | +### `cluster-health-check` |
| 65 | + |
| 66 | +Performs a comprehensive health assessment of your Kubernetes or OpenShift cluster. |
| 67 | + |
| 68 | +**Arguments:** |
| 69 | +- `namespace` (optional): Limit the health check to a specific namespace. Default: all namespaces. |
| 70 | +- `verbose` (optional): Enable detailed resource-level information. Values: `true` or `false`. Default: `false`. |
| 71 | +- `check_events` (optional): Include recent warning/error events in the analysis. Values: `true` or `false`. Default: `true`. |
| 72 | + |
| 73 | +**What it checks:** |
| 74 | +- **Nodes**: Status and conditions (Ready, MemoryPressure, DiskPressure, etc.) |
| 75 | +- **Cluster Operators** (OpenShift only): Available and degraded status |
| 76 | +- **Pods**: Phase, container statuses, restart counts, and common issues (CrashLoopBackOff, ImagePullBackOff, etc.) |
| 77 | +- **Workload Controllers**: Deployments, StatefulSets, and DaemonSets replica status |
| 78 | +- **Persistent Volume Claims**: Binding status |
| 79 | +- **Events**: Recent warning and error events from the last hour |
| 80 | + |
| 81 | +**Example usage:** |
| 82 | +``` |
| 83 | +Check the health of my cluster |
| 84 | +``` |
| 85 | + |
| 86 | +Or with specific parameters: |
| 87 | +``` |
| 88 | +Check the health of namespace production with verbose output |
| 89 | +``` |
| 90 | + |
| 91 | +The prompt gathers comprehensive diagnostic data and presents it to the LLM for analysis, which will provide: |
| 92 | +1. Overall health status (Healthy, Warning, or Critical) |
| 93 | +2. Critical issues requiring immediate attention |
| 94 | +3. Warnings and recommendations |
| 95 | +4. Summary by component |
| 96 | + |
| 97 | +## Configuration File Location |
| 98 | + |
| 99 | +Place your prompts in the `config.toml` file used by the MCP server. Specify the config file path using the `--config` flag when starting the server. |
0 commit comments