Skip to content

TLS configuration for VirtualMCPServer Redis session storage #6730

Description

@kraashen

Context

VirtualMCPServer Redis session storage always seems to connect in plaintext based on configs and current code layout.

redisconn in toolhive-core already supports TLS, but nothing on the Virtual MCP path sets redisconn.Config.TLS as spec.sessionStorage has no TLS settings (as in here), and therefore it'll behave as nil in the toolhive-core's Redis config side.

A non-nil TLSConfig would enable TLS. A nil one stays plaintext. An empty redisconn.TLSConfig{} would be enough for TLS 1.2+ with system root CAs and certificate verification. Session storage has no field that can produce that value.

Expected behavior

Would it be possible to have sessionStorage to be able to request TLS? Empty TLSConfig would use system CA bundles, and that value could be passed through to redisconn.Config.TLS. go-redis seemigly produces and enabled TLS this way.

Existing use of TLS:

  • The embedded auth server already has this for its own Redis client, having the config wired.
  • Plain self-hosted / saas session storage could follow that shape?

The same config resource is also used by MCPServer and MCPRemoteProxy, so a CRD field would show up on those resources as well?

Activity

  1. Sanskarzz commented on Sep 30, 2026

    @Sanskarzz
    Collaborator

    @kraashen Thanks for reporting this. I confirmed that sessionStorage currently cannot request TLS, although the underlying Redis client supports it. I’ll take ownership of the implementation.

    I propose the following acceptance criteria:

    • An optional sessionStorage.tls setting: omission preserves current plaintext behavior; tls: {} enables certificate-verified TLS using system roots.
    • The setting works across VirtualMCPServer, MCPServer, and MCPRemoteProxy, which share the session-storage API.
    • Both session storage and its separate Redis-backed rate-limiting connection use the requested TLS settings. A failed TLS connection must not fall back to plaintext.
    • The vMCP YAML configuration used by thv vmcp supports the same behavior. This does not appear to require a new CLI flag.
    • Tests cover a TLS-only Redis endpoint, the existing plaintext behavior, and invalid certificate configuration.

    I also plan to support a CA Secret for Redis deployments using a private CA, following the existing embedded auth-server pattern. TLS for the Helm operator-wide defaultRedis fallback is a separate configuration path; I’ll track it in a linked follow-up rather than include it here.

  2. self-assigned this
    on Sep 30, 2026
  3. Sanskarzz commented on Oct 1, 2026

    @Sanskarzz
    Collaborator

    @kraashen Thanks for reporting this. I confirmed that sessionStorage currently cannot request TLS, although the underlying Redis client supports it. I’ll take ownership of the implementation.

    I propose the following acceptance criteria:

    • An optional sessionStorage.tls setting: omission preserves current plaintext behavior; tls: {} enables certificate-verified TLS using system roots.
    • The setting works across VirtualMCPServer, MCPServer, and MCPRemoteProxy, which share the session-storage API.
    • Both session storage and its separate Redis-backed rate-limiting connection use the requested TLS settings. A failed TLS connection must not fall back to plaintext.
    • The vMCP YAML configuration used by thv vmcp supports the same behavior. This does not appear to require a new CLI flag.
    • Tests cover a TLS-only Redis endpoint, the existing plaintext behavior, and invalid certificate configuration.

    I also plan to support a CA Secret for Redis deployments using a private CA, following the existing embedded auth-server pattern. TLS for the Helm operator-wide defaultRedis fallback is a separate configuration path; I’ll track it in a linked follow-up rather than include it here.

    @JAORMX @ChrisJBurns PTAL
    I have already raised a PR accordingly.

  4. peppescg commented on Oct 9, 2026

    @peppescg
    Contributor

    closed #6731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kubernetesItems related to Kubernetes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions