Repository navigation
Description
Summary
When a VirtualMCPServer references an MCPOIDCConfig whose spec.inline.caBundleRef points at a ConfigMap holding a custom CA, the operator mounts the CA into the pod but never tells the vmcp binary where it is. OIDC discovery against an issuer fronted by a self-signed CA consequently fails with:
tls: failed to verify certificate: x509: certificate signed by unknown authority
The analogous path for MCPServer was fixed in #3142 / #3391 — the vMCP converter wasn't updated at the same time. Reproduced on operator v0.21.0.
Expected
ThvCABundlePath is auto-computed by the resolver (as it is for MCPServer) and rendered into the vMCP config so the incoming-OIDC middleware trusts the supplied CA.
Actual
The vMCP OIDCConfig struct has no CA-bundle field, and the vMCP converter silently drops resolved.ThvCABundlePath. The volume mount at /config/certs/<configmap-name>/<key> lands on the pod but nothing reads it.
Code references (tag v0.21.0)
pkg/vmcp/config/config.go:203-252—OIDCConfigstruct definesIssuer,ClientID,ClientSecretEnv,Audience,Resource,JWKSURL,IntrospectionURL,Scopes,ProtectedResourceAllowPrivateIP,JwksAllowPrivateIP,InsecureAllowHTTP— noCACertPath/ThvCABundlePath/CABundlePath.cmd/thv-operator/pkg/vmcpconfig/converter.go—mapResolvedOIDCToVmcpConfigFromRef(around line 237+) never referencesresolved.ThvCABundlePath.cmd/thv-operator/controllers/virtualmcpserver_deployment.go:300-308— the operator does correctly add the volume viaAddOIDCConfigRefCABundleVolumes.cmd/thv-operator/pkg/controllerutil/oidc_volumes.go:17-57— mount path is/config/certs/<configmap-name>/<key>.
Compare to the working MCPServer path: cmd/thv-operator/controllers/mcpserver_runconfig.go correctly plumbs resolvedOIDCConfig.ThvCABundlePath into RunConfig → TokenValidatorConfig.CACertPath (pkg/runner/config_builder.go:453,470).
Minimal reproduction
Issuer with a self-signed CA (e.g. a kind cluster behind Traefik using a *.traefik.me cert):
apiVersion: toolhive.stacklok.dev/v1alpha1
kind: MCPOIDCConfig
metadata:
name: example-oidc
namespace: toolhive-system
spec:
type: inline
inline:
issuer: https://auth.example.internal/realms/demo
caBundleRef:
configMapRef:
name: example-ca # holds ca.crt
key: ca.crt
jwksAllowPrivateIP: true
---
apiVersion: toolhive.stacklok.dev/v1alpha1
kind: VirtualMCPServer
metadata:
name: example-vmcp
namespace: toolhive-system
spec:
groupRef:
name: some-group
incomingAuth:
type: oidc
oidcConfigRef:
name: example-oidc
audience: example-audience
outgoingAuth:
source: inline
serviceType: ClusterIPThe vmcp pod comes up, mounts /config/certs/example-ca/ca.crt, but the rendered incomingAuth.oidc section of the operator-produced config ConfigMap contains no CA-path field, and the binary errors on the first OIDC discovery fetch.
Suggested fix
Mirror the MCPServer change: add a CACertPath (or ThvCABundlePath) field to pkg/vmcp/config/config.go's OIDCConfig, plumb resolved.ThvCABundlePath through mapResolvedOIDCToVmcpConfigFromRef, and have the vMCP incoming-OIDC middleware pass it to its HTTP client when discovering the issuer / fetching JWKS.
Workarounds
None via CRD config. Options are:
insecureAllowHTTP: truewith a plaintext issuer (not useful if the issuer uses OIDC's browser-redirect flows over HTTPS).- Publicly-trusted cert for the issuer (not available in offline / demo setups).
Context
Surfaced while wiring Keycloak → LibreChat → vmcp-chat end-to-end authentication in our demo-sandbox. Happy to test a fix.
Activity
Propagate MCPOIDCConfig CA bundle to vmcp OIDC config
Plumb Keycloak auth through to a new vmcp-chat gateway
Add Cedar authz policies for vmcp-chat
Plumb Keycloak auth through to a new vmcp-chat gateway
Add Cedar authz policies for vmcp-chat
Propagate MCPOIDCConfig CA bundle to vmcp OIDC config (stacklok#4923)
Plumb Keycloak auth through to a new vmcp-chat gateway
Add Cedar authz policies for vmcp-chat
Drop the vmcp-chat operator workarounds now that both fixes shipped
Plumb Keycloak auth through to a new vmcp-chat gateway
Add Cedar authz policies for vmcp-chat
Drop the vmcp-chat operator workarounds now that both fixes shipped
LibreChat: Keycloak auth and role-based tool authz via a new vmcp-cha…