|
| 1 | +# Claude Code Usage Examples |
| 2 | + |
| 3 | +This directory contains configuration examples and usage prompts for integrating StackRox MCP with Claude Code. |
| 4 | + |
| 5 | +## Prerequirements |
| 6 | + |
| 7 | +- **Build binary**: |
| 8 | + ```bash |
| 9 | + make build |
| 10 | + ``` |
| 11 | + |
| 12 | +## Setup |
| 13 | + |
| 14 | +1. **Start the StackRox MCP server**: |
| 15 | + ```bash |
| 16 | + STACKROX_MCP__CENTRAL__URL=<StackRox host with port> ./stackrox-mcp --config=examples/config-read-only.yaml |
| 17 | + ``` |
| 18 | + |
| 19 | +2. **Configure Claude Code**: |
| 20 | + |
| 21 | + Copy the `mcp.json` file to your workspace directory (this will scope claude to use StackRox MCP only in this directory): |
| 22 | + ```bash |
| 23 | + mkdir -p ~/stackrox-workspace |
| 24 | +
|
| 25 | + cp examples/claude-code/mcp.json ~/stackrox-workspace/.mcp.json |
| 26 | +
|
| 27 | + cd ~/stackrox-workspace |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Update the API token**: |
| 31 | + |
| 32 | + Edit `~/stackrox-workspace/.mcp.json` and replace `<YOUR_STACKROX_API_TOKEN>` with your actual StackRox API token. |
| 33 | + |
| 34 | +4. **Verify the connection**: |
| 35 | + |
| 36 | + Start Claude Code |
| 37 | + ```bash |
| 38 | + claude |
| 39 | + ``` |
| 40 | + |
| 41 | + You can get prompt to allow using MCP server. After that you can run `/mcp` to see if `stackrox-mcp` is in the list. |
| 42 | + |
| 43 | +## Example Prompts |
| 44 | + |
| 45 | +Once configured, you can use natural language prompts with Claude Code: |
| 46 | + |
| 47 | +### List all clusters |
| 48 | +``` |
| 49 | +Can you list all the clusters secured by StackRox? |
| 50 | +``` |
| 51 | + |
| 52 | +### Check for a specific CVE |
| 53 | +``` |
| 54 | +Is CVE-2021-44228 detected in any of my clusters? |
| 55 | +``` |
| 56 | + |
| 57 | +### CVE analysis in specific namespace |
| 58 | +``` |
| 59 | +Check if CVE-2021-44228 is present in deployments in namespace "backend" |
| 60 | +``` |
| 61 | +
|
| 62 | +### Filter by cluster |
| 63 | +``` |
| 64 | +Show me all deployments affected by CVE-2021-44228 in the dev-cluster |
| 65 | +``` |
| 66 | +
|
| 67 | +## Notes |
| 68 | +
|
| 69 | +- The server must be running before using Claude Code |
| 70 | +- Make sure your API token has appropriate permissions for the operations you want to perform |
| 71 | +- The default configuration uses `http://localhost:8080/mcp` - adjust if your server runs on a different port or host |
0 commit comments