vmcp/session: expose a pluggable backendConnector on NewSessionFactory
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
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:
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 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.Sessionto live outsideinternal/— suggest moving just the interface, not the HTTP implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/vmcp/session/factory.go around backendConnector at line 117, NewSessionFactory at line 187, and newSessionFactoryWithConnector at line 194; then inspect backend.Session and NewHTTPConnector under pkg/vmcp/session/internal/backend/. Done means external connector implementations have a public target type and option, while the existing HTTP connector remains the default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100