Skip to content

vmcp: allow embedders to plug a custom session DataStorage into server.Server #4928

@JAORMX

Description

@JAORMX

Problem

pkg/vmcp/server.Server accepts a SessionStorage *vmcpconfig.SessionStorageConfig whose Provider field is enum-validated at memory or redis. The internal helper buildSessionDataStorage (pkg/vmcp/server/server.go:263-291) hardcodes transportsession.NewLocalSessionDataStorage or transportsession.NewRedisSessionDataStorage based on that enum. There is no way for an embedder to inject a transportsession.DataStorage implementation of its own — the interface is public but the server has no seam to accept one.

Use case

Deployments that already run an operational datastore other than Redis (Postgres, DynamoDB, Spanner, MongoDB, etc.) can satisfy transportsession.DataStorage against that datastore to avoid adding Redis purely for MCP session persistence. Today they have to either fork server.go or fall back to in-memory sessions (no persistence across pod restarts).

Proposed API

Add a DataStorage transportsession.DataStorage field to server.Config (or a functional-option equivalent). When set, buildSessionDataStorage short-circuits and returns the caller-supplied implementation; when nil, existing behaviour is preserved. Backwards-compatible.

Alternative: add server.WithDataStorage(ds transportsession.DataStorage) Option and thread it through New(...).

Scope

  • Purely additive.
  • No change to transportsession.DataStorage itself — the contract is already public and stable.
  • No change to the memory / redis fast paths.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestvmcpVirtual MCP Server related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions