Skip to content

[Feature]: MCP HTTP: make the session cap (100) and idle TTL (30 min) configurable #2283

Open

Description

@miheico

Version: 0.87.7 (also 0.86.18; code unchanged on main)

What happens
packages/server/src/mcp-http.ts uses maxSessions = opts.maxSessions ?? 100 and sessionTtlMs = opts.sessionTtlMs ?? 30 * 60 * 1000. Nothing in the project config or environment reaches these options, so a project-bound HTTP server always caps at 100 sessions.

We run one ok start --only server on a Linux host for three long-running agents (two MCP clients plus short-lived scripts). Some clients open a new session per task and never send DELETE /mcp. Within a busy day the server reached 100 sessions. From then on every new initialize got 503 Too many active MCP sessions until idle sessions expired, so all agents lost TX access for up to 30 minutes. The server is still healthy at that point.

Ask (any one would solve it)

  1. A config key or env var for maxSessions and sessionTtlMs.
  2. When the cap is hit, evict the least-recently-used idle session instead of refusing the new one.
  3. At minimum, document the cap and the 30-minute TTL in the MCP reference, so client authors know to send DELETE.

Activity

  1. xubenqiang commented on Oct 26, 2026

    @xubenqiang

    I have a small patch for the configurability ask ready: OK_MCP_MAX_SESSIONS and OK_MCP_SESSION_TTL_MS read at boot, plus the docs rows and a Session limits section in the MCP reference (branch feat/mcp-http-session-limits-env on my fork, xubenqiang/open-knowledge, commit 8d17080, 13 new unit tests passing).

    GitHub is refusing PR creation from my account on this repository (createPullRequest returns FORBIDDEN), so I could not open it here. If a maintainer wants it, the branch is ready to pull; otherwise ignore this note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions