docs/mcp-server.md
The Kubescape MCP (Model Context Protocol) Server enables AI assistants to query your Kubernetes cluster's security posture using natural language. It exposes Kubescape's vulnerability and configuration scan data through the MCP protocol.
The MCP server allows AI assistants (like Claude, ChatGPT, or custom AI tools) to:
Before using the MCP server, you need:
helm repo add kubescape https://kubescape.github.io/helm-charts/
helm repo update
helm upgrade --install kubescape kubescape/kubescape-operator \
--namespace kubescape \
--create-namespace \
--set capabilities.vulnerabilityScan=enable \
--set capabilities.configurationScan=enable
Wait for the operator to complete initial scans:
kubectl -n kubescape get vulnerabilitymanifests
kubectl -n kubescape get workloadconfigurationscans
kubescape mcpserver
The server starts and communicates via stdio, making it compatible with MCP-enabled AI tools.
The MCP server exposes the following tools to AI assistants:
list_vulnerability_manifestsDiscover available vulnerability manifests at image and workload levels.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Filter by namespace |
level | string | No | Type of manifests: "image", "workload", or "both" (default) |
Example Response:
{
"vulnerability_manifests": {
"manifests": [
{
"type": "workload",
"namespace": "default",
"manifest_name": "deployment-nginx-nginx",
"image-level": false,
"workload-level": true,
"image-id": "sha256:abc123...",
"image-tag": "nginx:1.21",
"resource_uri": "kubescape://vulnerability-manifests/default/deployment-nginx-nginx"
}
]
}
}
list_vulnerabilities_in_manifestList all vulnerabilities (CVEs) found in a specific manifest.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Namespace of the manifest (default: "kubescape") |
manifest_name | string | Yes | Name of the manifest |
Example Response:
[
{
"id": "CVE-2023-12345",
"severity": "High",
"description": "Buffer overflow in libfoo",
"fix": {
"versions": ["1.2.4"],
"state": "fixed"
}
}
]
list_vulnerability_matches_for_cveGet detailed information about a specific CVE in a manifest, including affected packages and fix information.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Namespace of the manifest (default: "kubescape") |
manifest_name | string | Yes | Name of the manifest |
cve_id | string | Yes | CVE identifier (e.g., "CVE-2023-12345") |
list_configuration_security_scan_manifestsDiscover available security configuration scan results at the workload level.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Filter by namespace (default: "kubescape") |
Example Response:
{
"configuration_manifests": {
"manifests": [
{
"namespace": "default",
"manifest_name": "deployment-nginx",
"resource_uri": "kubescape://configuration-manifests/default/deployment-nginx"
}
]
}
}
get_configuration_security_scan_manifestGet detailed configuration scan results for a specific workload, including failed controls and remediation guidance.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Namespace of the manifest (default: "kubescape") |
manifest_name | string | Yes | Name of the configuration manifest |
The MCP server also exposes resource templates for direct access to data:
kubescape://vulnerability-manifests/{namespace}/{manifest_name}
kubescape://configuration-manifests/{namespace}/{manifest_name}
Add to your Claude Desktop configuration (~/.config/claude/config.json on Linux or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"kubescape": {
"command": "kubescape",
"args": ["mcpserver"]
}
}
}
For custom AI applications using the MCP SDK:
from mcp import Client
async with Client("kubescape", ["kubescape", "mcpserver"]) as client:
# List vulnerability manifests
result = await client.call_tool(
"list_vulnerability_manifests",
{"level": "workload"}
)
print(result)
Once connected, you can ask your AI assistant questions like:
Ensure the Kubescape operator has completed vulnerability scanning:
kubectl -n kubescape get vulnerabilitymanifests
If empty, check operator logs:
kubectl -n kubescape logs -l app=kubescape
Verify your kubeconfig is correctly configured:
kubectl get nodes
Check that you're running Kubescape v3.x or later:
kubescape version