stacklok / stacklok/toolhive

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

Open
#4,928 0 comments 0 reactions 1 assignee View on GitHub

@JAORMX is already working on this.

Since Apr 20, 2026.

enhancement vmcp
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.