Skip to content

make session TTL configurable via MCP_SESSION_TTL_MS#360

Open
prachishah-harness wants to merge 2 commits into
harness:mainfrom
prachishah-harness:configurable-session-ttl
Open

make session TTL configurable via MCP_SESSION_TTL_MS#360
prachishah-harness wants to merge 2 commits into
harness:mainfrom
prachishah-harness:configurable-session-ttl

Conversation

@prachishah-harness

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the hardcoded SESSION_TTL_MS = 30 * 60_000 constant in src/index.ts with a MCP_SESSION_TTL_MS config field (Zod-validated, z.coerce.number().min(1))
  • Default value is 5 minutes (300000 ms)
  • Documented in .env.example alongside the other timeout/retry knobs
  • The value is read from config.MCP_SESSION_TTL_MS inside startHttp, so it correctly picks up the parsed+validated config rather than a module-level constant

Test plan

  • Start the HTTP server without MCP_SESSION_TTL_MS set — sessions should expire after 5 minutes (new default)
  • Set MCP_SESSION_TTL_MS=60000 and confirm sessions are reaped after 1 minute of inactivity
  • Set MCP_SESSION_TTL_MS=0 and confirm config validation rejects it (min(1))

Made with Cursor

Replace the hardcoded SESSION_TTL_MS constant (30 min) with a
MCP_SESSION_TTL_MS config field defaulting to 5 minutes, so operators
can tune idle-session expiry without a code change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

…mple entry

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants