This project ships with end-to-end integration tests that prove an MCP agent can connect to a live Kubernetes cluster, discover the generated tools, and execute operations. The tests are designed for manual validation on a developer workstation and CI automation.
- Docker Engine (the KIND nodes run as Docker containers)
kind,kubectl,npm, andnpxavailable on yourPATHtsx(installed automatically with project dependencies)- A working Anthropic API configuration (e.g.,
ANTHROPIC_API_KEYalready set) - macOS or Linux host with permissions to run Docker
Note: Authentication is not validated by these scripts - they assume your CLI environment is already authorized before executing any calls.
The Claude Agent SDK integration test provisions a disposable KIND cluster, runs the MCP server against it, and drives Claude via the TypeScript Agent SDK so the whole stack is exercised together.
npm run test:integration| Variable | Default | Description |
|---|---|---|
CLUSTER_NAME |
mcp-int |
KIND cluster name |
KIND_BIN |
kind |
Custom path to the kind binary |
KUBECTL_BIN |
kubectl |
Custom path to kubectl |
CLAUDE_INT_MODEL |
(unset) | Optional override for the Claude model |
All generated artifacts (kubeconfig, Claude response JSON, logs) live under artifacts/integration/.
The scripts/integration/run-kind-integration.sh script performs the following:
- Cluster Setup - Spins up a KIND cluster (
kind create cluster --name $CLUSTER_NAME) - Deploy Workloads - Applies
tests/fixtures/sample-workload.yaml, which creates a namespace plus a two-replica StatefulSet so pod names are deterministic - Wait for Ready - Waits until both pods in
demo-intare Ready - Build - Builds the MCP server (
npm run build) - Run Claude Driver - Invokes
scripts/integration/claude-driver.ts, which:- Uses the TypeScript Agent SDK to start the MCP server via stdio transport, attaching Claude to it with the structured-output schema
- Runs in bypass-permissions mode so no manual approvals are needed
- Prompts Claude to list the pods in
demo-intand forces JSON output - Writes the structured output to
artifacts/integration/claude-output.json - When run with
npm run test:integration -- --verbose, streams key SDK events (tool calls, thinking updates, final result) to the console for debugging
- Verify Output - Runs
scripts/integration/verify-claude-output.tsto ensure Claude reported both StatefulSet pods (demo-nginx-0,demo-nginx-1) - Cleanup - Tears everything down by deleting the KIND cluster
If any step fails, the script aborts immediately and still attempts to delete the cluster.
- Logs from the runner stream to stdout; rerun with
bash -xfor more detail - KIND clusters stick around only if teardown fails. Inspect them with
kind get clustersor delete manually viakind delete cluster --name mcp-int - The Claude driver writes progress to stdout - review
artifacts/integration/whenever verification fails
Note: CI currently skips this workflow; it is intended for manual validation on a developer workstation.
The project also includes automated container integration tests that run in CI. These tests verify the sandbox-server works correctly when deployed as a container in a Kubernetes cluster.
./scripts/integration/run-container-integration.shOr with a custom local port (to avoid conflicts):
LOCAL_PORT=50053 ./scripts/integration/run-container-integration.sh| File | Description |
|---|---|
scripts/integration/run-container-integration.sh |
Creates KIND cluster, builds/loads Docker image, deploys, and runs tests |
scripts/integration/container-tests.ts |
TypeScript tests for health check, code execution, K8s API access, caching, and error handling |
.github/workflows/ci.yml |
The container-integration job |
- Create Cluster - Creates a KIND cluster (
sandbox-int) - Build Image - Builds the sandbox-server Docker image
- Load and Deploy - Loads the image into KIND and deploys using K8s manifests
- Port Forward - Sets up port-forwarding to the sandbox-server service
- Run Test Suite - Verifies:
- Health check returns healthy with
inClusterContext - Simple code and TypeScript execution
- Kubernetes API access (list namespaces, list pods)
- Script caching
- Error and timeout handling
- Health check returns healthy with
- Cleanup - Cleans up the KIND cluster
| Variable | Default | Description |
|---|---|---|
CLUSTER_NAME |
sandbox-int |
KIND cluster name for container tests |
LOCAL_PORT |
50052 |
Local port for port-forwarding (avoids conflicts) |
KIND_BIN |
kind |
Custom path to the kind binary |
KUBECTL_BIN |
kubectl |
Custom path to kubectl |
Container integration test artifacts are stored in artifacts/container-integration/:
| Artifact | Description |
|---|---|
kubeconfig |
Kubeconfig for the test cluster |
deployment.yaml |
The actual manifest applied to the cluster |
- gRPC Sandbox Architecture - Architecture details for the sandbox server being tested
- searchTools Reference - Documentation for the API discovery tools