Configuring Virtual MCP Server
This guide covers common configuration patterns for VirtualMCPServer. For a complete field reference, see the VirtualMCPServer CRD specification.
Minimal configuration
At minimum, a VirtualMCPServer requires a reference to an MCPGroup:
apiVersion: toolhive.stacklok.dev/v1alpha1
kind: VirtualMCPServer
metadata:
name: my-vmcp
spec:
groupRef:
name: my-group
The MCPGroup must exist in the same namespace and be in a Ready state before the VirtualMCPServer can start.
Adding authentication
Development (no authentication)
For local development only:
spec:
incomingAuth:
type: anonymous
Never use anonymous authentication in production environments.
OIDC authentication
Validate tokens from an external identity provider:
spec:
incomingAuth:
type: oidc
oidcConfig:
type: inline
inline:
issuer: https://your-idp.example.com
audience: vmcp
clientId: your-client-id
Kubernetes service account tokens
For in-cluster clients using service account tokens:
spec:
incomingAuth:
type: oidc
oidcConfig:
type: kubernetes
kubernetes:
audience: toolhive
See Authentication for complete authentication options.
Configuring backend authentication
Control how Virtual MCP authenticates to backend MCP servers:
spec:
outgoingAuth:
source: discovered # Auto-discover from backend MCPServer configs
default:
type: discovered
For backends requiring specific auth, reference an MCPExternalAuthConfig:
spec:
outgoingAuth:
source: mixed
backends:
github:
type: external_auth_config_ref
externalAuthConfigRef:
name: github-auth
Exposing the service
Choose how to expose the Virtual MCP endpoint:
spec:
serviceType: ClusterIP # Default: internal access only
# serviceType: LoadBalancer # External access via cloud load balancer
# serviceType: NodePort # External access via node ports
Monitoring status
Check the VirtualMCPServer status to verify it's ready:
kubectl get virtualmcpserver my-vmcp
Key status fields:
| Field | Description |
|---|---|
phase | Current state (Pending, Ready, Degraded, Failed) |
url | Service URL for client connections |
backendCount | Number of discovered backend MCP servers |
discoveredBackends | Details about each backend and its auth type |