Skip to content

[Feature Request] Sliding session lifetime (idle timeout instead of absolute timeout) #245

@sgaluza

Description

@sgaluza

Summary

Currently, the session lifetime feature (added in PR #175) uses an absolute timeout from session creation time. This means a session will be terminated after the configured duration regardless of whether it's actively being used.

Current behavior:

  • Session created at 10:00
  • Lifetime = 30 minutes
  • Session terminated at 10:30, even if actively used at 10:29

Proposed behavior (sliding/idle timeout):

  • Session created at 10:00
  • Lifetime = 30 minutes (idle timeout)
  • Each request resets the timer
  • If last request was at 10:25, session terminates at 10:55

Use Case

When using MetaMCP with AI coding assistants (Claude Code, Cursor, GitHub Copilot, etc.), sessions can be long-lived with intermittent activity. The current absolute timeout forces session recreation during active work sessions, which:

  1. Interrupts ongoing work
  2. Requires clients to handle session expiration and reconnection
  3. May cause tool state loss in stateful MCP servers

A sliding/idle timeout would only terminate truly inactive sessions while keeping active ones alive.

Question

Does this approach make sense for MetaMCP? I'd be happy to submit a PR if this feature aligns with the project's goals.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions