|
| 1 | +# MCP Gateway Integration |
| 2 | + |
| 3 | +This guide describes how to integrate the StackRox MCP server with [MCP Gateway](https://github.com/Kuadrant/mcp-gateway), enabling tool aggregation behind a centralized gateway endpoint. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +MCP Gateway is an Envoy-based system that aggregates multiple MCP servers behind a single endpoint. It uses Gateway API resources and a custom `MCPServerRegistration` CRD to discover and route requests to backend MCP servers. |
| 8 | + |
| 9 | +When enabled, the Helm chart creates: |
| 10 | +- **HTTPRoute** — routes `/mcp` traffic from the gateway to the StackRox MCP service |
| 11 | +- **MCPServerRegistration** — registers the server with the gateway using a tool prefix to avoid naming conflicts |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- [MCP Gateway](https://github.com/Kuadrant/mcp-gateway) installed on the cluster ([OpenShift installation guide](https://github.com/Kuadrant/mcp-gateway/tree/main/config/openshift)) |
| 16 | + |
| 17 | +The Helm chart validates that the required CRDs are available and fails with a descriptive error if they are not. |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +**Important:** When MCP Gateway is enabled, `replicaCount` must be set to `1`. The Gateway API's HTTPRoute bypasses Kubernetes Service-level session affinity, so multiple replicas would cause MCP client connections to land on different pods, breaking stateful MCP sessions. |
| 22 | + |
| 23 | +```bash |
| 24 | +helm install stackrox-mcp charts/stackrox-mcp \ |
| 25 | + --namespace stackrox-mcp \ |
| 26 | + --create-namespace \ |
| 27 | + --set replicaCount=1 \ |
| 28 | + --set mcpGateway.enabled=true \ |
| 29 | + --set mcpGateway.hostname=stackrox-mcp.mcp.local \ |
| 30 | + --set config.central.url=<your-central-url> |
| 31 | +``` |
| 32 | + |
| 33 | +## Configuration Reference |
| 34 | + |
| 35 | +| Parameter | Description | Default | |
| 36 | +|-----------|-------------|---------| |
| 37 | +| `mcpGateway.enabled` | Enable MCP Gateway integration | `false` | |
| 38 | +| `mcpGateway.gateway.name` | Name of the MCP Gateway resource | `mcp-gateway` | |
| 39 | +| `mcpGateway.gateway.namespace` | Namespace of the MCP Gateway resource | `gateway-system` | |
| 40 | +| `mcpGateway.hostname` | Internal routing hostname for the HTTPRoute | `<fullname>.mcp.local` | |
| 41 | +| `mcpGateway.toolPrefix` | Prefix for tools exposed via the gateway | `stackrox_` | |
| 42 | + |
| 43 | +## Verification |
| 44 | + |
| 45 | +```bash |
| 46 | +curl -X POST https://$(oc get routes -n gateway-system -o jsonpath='{ .items[0].spec.host }')/mcp \ |
| 47 | + -H "Content-Type: application/json" \ |
| 48 | + -d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' |
| 49 | +``` |
| 50 | + |
| 51 | +## Architecture |
| 52 | + |
| 53 | +``` |
| 54 | +MCP Client |
| 55 | + → MCP Gateway (gateway-system namespace) |
| 56 | + → HTTPRoute (/mcp) |
| 57 | + → StackRox MCP Service (stackrox-mcp namespace) |
| 58 | + → StackRox MCP Pod(s) |
| 59 | + → StackRox Central API |
| 60 | +``` |
| 61 | + |
| 62 | +The gateway aggregates tools from all registered MCP servers. StackRox MCP tools are exposed with the configured prefix (e.g., `stackrox_get_deployments_for_cve`). |
0 commit comments