Repository navigation
Description
Depends on: #2527 (per-agent identities); stacklok/toolhive#6779 (session binding for the list methods), for session reuse only; "vMCP: bind sessions to the client, acting agent, and delegated-access marker, not just the user" (stacklok/toolhive#6888) (binding to the client and agent)
Removes shortcut: a new vMCP session for every gateway call (#2451)
Removes shortcut: the send-once record, parked gateway calls, and vMCP session IDs are in memory, so a restart can send a call twice and loses parked calls and backend state (#2451)
Problem
mecak8s's MCP client sends the gateway calls. It opens a vMCP session per call, so backend state such as a selected repository is lost between an agent's calls. Its record of sent calls and its parked calls are in memory, so a restart could send a call twice or drop a parked one.
Implements
- credentials-and-lifecycle.md: Sessions at the vMCP
- mcp-gateway-modes.md: Sessions at the vMCP
- credentials-and-lifecycle.md: (9) vMCP decision and provider credential: the lost-session row
- credentials-and-lifecycle.md: Pauses and restart
- implementation.md: Parking and recovery: implementation status
- implementation.md: Run owner checks: users never share a vMCP session ID
Scope
- Landing order: send-once and parked-call durability can land before session reuse; only session reuse waits on vMCP: session identity binding is not enforced for
tools/list(and other list methods) toolhive#6779. - Send-once: claims persisted with their argument hash; competing claims across replicas send once; deleting a session clears only its own claims, not a recreated same-ID session's.
- Parked calls: persisted with their operation ID; resumed only after the broker authorizes again, otherwise an explicit unavailable or ambiguous outcome.
- Session reuse: one vMCP session per instance, gateway, and user, outside the broker session; each call's own gateway token; a gone session recreated with one retry; explicit reset; IDs persisted and reattached.
- Storage: mecak8s's own session storage, shared across replicas, pruned when the session or instance ends.
- Not here: the broker's records (Durable broker state and recovery #2563); dropping sessions on sign-out everywhere (Sign-out and revocation #2568).
Decide before starting
- Does the durable send-once record keep the in-memory limit (4096 calls per root session, oldest completed evicted,
send_once_fullotherwise)? If so, what may be evicted, and doessend_once_fullstay model-visible?
Done when
- After a restart, a possibly sent call is not resent and reports an ambiguous outcome; a parked call resumes after a new authorization or reports an explicit outcome; competing claims send once.
- An agent's consecutive calls reuse its vMCP session, reattached after a restart; two agents or users never share one; a gone session is recreated.
Earlier notes: #2730 (closed, merged here).
Activity
tools/list(and other list methods) toolhive#6779[-]Reuse one vMCP session per agent, gateway, and user[/-][+]MCP client state: one vMCP session per agent, durable send-once and parked calls[/+]