Problem
session.NewSessionFactory(registry, opts...) at pkg/vmcp/session/factory.go:187 is the only public constructor for MultiSessionFactory. It hardcodes backend.NewHTTPConnector(registry) as the connector.
The internal plumbing for a custom connector exists:
backendConnector type at factory.go:117 (unexported)
newSessionFactoryWithConnector at factory.go:194 (unexported, appears test-only)
backend.Session + backend.NewHTTPConnector live under pkg/vmcp/session/internal/backend/ — Go's internal path rule prevents external use.
Use case
Embedders whose gateway already resolves per-backend capability lists (for conflict resolution, ACL filtering, static catalog composition) need the session factory to present those pre-resolved capabilities instead of re-fetching them over HTTP at every session initialize. Similarly, embedders with stateless dispatch models do not want the factory to open N live MCP client connections per session.
Proposed API
Export the backendConnector interface (or lift it to pkg/vmcp/session/types next to MultiSession), and add a functional option:
func WithBackendConnector(conn BackendConnector) MultiSessionFactoryOption
When supplied, NewSessionFactory uses it instead of backend.NewHTTPConnector. The default stays unchanged.
Separately, expose backend.Session (or a narrower interface specifically for connector implementations) via pkg/vmcp/session/types so external implementations have a target type to return.
Scope
- Additive. No change to the existing HTTP-connector default.
- May require widening
backend.Session to live outside internal/ — suggest moving just the interface, not the HTTP implementation.
Problem
session.NewSessionFactory(registry, opts...)atpkg/vmcp/session/factory.go:187is the only public constructor forMultiSessionFactory. It hardcodesbackend.NewHTTPConnector(registry)as the connector.The internal plumbing for a custom connector exists:
backendConnectortype atfactory.go:117(unexported)newSessionFactoryWithConnectoratfactory.go:194(unexported, appears test-only)backend.Session+backend.NewHTTPConnectorlive underpkg/vmcp/session/internal/backend/— Go'sinternalpath rule prevents external use.Use case
Embedders whose gateway already resolves per-backend capability lists (for conflict resolution, ACL filtering, static catalog composition) need the session factory to present those pre-resolved capabilities instead of re-fetching them over HTTP at every session
initialize. Similarly, embedders with stateless dispatch models do not want the factory to open N live MCP client connections per session.Proposed API
Export the
backendConnectorinterface (or lift it topkg/vmcp/session/typesnext toMultiSession), and add a functional option:When supplied,
NewSessionFactoryuses it instead ofbackend.NewHTTPConnector. The default stays unchanged.Separately, expose
backend.Session(or a narrower interface specifically for connector implementations) viapkg/vmcp/session/typesso external implementations have a target type to return.Scope
backend.Sessionto live outsideinternal/— suggest moving just the interface, not the HTTP implementation.