Skip to content

Expose host vMCP session TTL with 12h default - #164

Merged
JAORMX merged 1 commit into
mainfrom
mcp-session-ttl
May 25, 2026
Merged

Expose host vMCP session TTL with 12h default#164
JAORMX merged 1 commit into
mainfrom
mcp-session-ttl

Conversation

@JAORMX

@JAORMX JAORMX commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • toolhive's vmcpserver.Config.SessionTTL defaults to 30 min of idle time. bbox previously passed an empty Config{}, so that default silently applied — short enough that stepping away from an interactive bbox session over lunch / a meeting could cause an MCP session eviction and force re-initialize.
  • Add MCP.SessionTTL to the global config (mcp.session_ttl in YAML, parsed via time.ParseDuration) and a matching --mcp-session-ttl flag. Threaded through NewVMCPProvider into vmcpserver.Config.SessionTTL.
  • Default is 12 h. Validation rejects malformed / negative values at load time and at the CLI boundary.
  • Workspace-local .broodbox.yaml cannot override the TTL (operational, not policy — same handling as review.enabled).

Resolution precedence

--mcp-session-ttl (non-zero) > mcp.session_ttl in global config > 12 h default.

What this depends on / doesn't depend on

  • The toolhive bump to v0.28.1 (Update module github.com/stacklok/toolhive to v0.28.1 #159) already carries the related session-liveness fixes from aaf3d4db3 / 8d237da74 (SSE keep-alive TTL refresh, streamable HTTP memory leak, sessionless routing UUIDs) — those live in the per-workload transport proxies and are inherited transparently.
  • This PR is just about turning the knob that's exposed on the vMCP server bbox already uses.

Test plan

  • task fmt && task lint && task test (already green locally)
  • bbox claude-code honors the 12h default — start a session, leave idle past 30 min, run an MCP tool, confirm no re-init stall
  • bbox claude-code --mcp-session-ttl 1m evicts the session as expected
  • --mcp-session-ttl -5s rejected with a clear error
  • mcp.session_ttl: not-a-duration in ~/.config/broodbox/config.yaml rejected at load time
  • Workspace-local .broodbox.yaml: mcp.session_ttl: 1m is ignored (global value wins)

🤖 Generated with Claude Code

toolhive's vmcpserver.Config.SessionTTL defaults to 30 minutes of idle
time, which is short for interactive coding-agent sessions where the
user steps away for lunch or meetings. bbox previously passed an empty
Config, so this default was silently in effect.

Add an MCP.SessionTTL field (string, parsed via time.ParseDuration) to
the global config and a corresponding --mcp-session-ttl flag, plumbed
through VMCPProvider into vmcpserver.Config. Validation rejects
malformed or negative values at load time and at the CLI boundary.

Default is 12h. Workspace-local .broodbox.yaml cannot override it
(operational, not policy — same handling as review.enabled).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JAORMX
JAORMX merged commit e52610a into main May 25, 2026
8 checks passed
@JAORMX
JAORMX deleted the mcp-session-ttl branch May 25, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant