From a6203839b4ed3c344e188e811fab4e8c1c483b84 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 7 Jul 2026 13:53:27 -0700 Subject: [PATCH] docs(mcp): document idle_timeout_seconds / max_lifetime_seconds recycle keys + handshake-bound note --- website/docs/user-guide/features/mcp.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/website/docs/user-guide/features/mcp.md b/website/docs/user-guide/features/mcp.md index fc0c27301f8..bf946fde10e 100644 --- a/website/docs/user-guide/features/mcp.md +++ b/website/docs/user-guide/features/mcp.md @@ -296,7 +296,9 @@ Hermes reads MCP config from `~/.hermes/config.yaml` under `mcp_servers`. | `client_cert` | string \| list | Client certificate for mTLS — a combined PEM path, or `[cert, key]` / `[cert, key, password]` | | `client_key` | string | Client private-key PEM path (when separate from `client_cert`) | | `timeout` | number | Tool call timeout | -| `connect_timeout` | number | Initial connection timeout | +| `connect_timeout` | number | Initial connection timeout (also bounds the MCP `initialize` handshake) | +| `idle_timeout_seconds` | number | Recycle a stdio server after this many seconds without a tool call (`0` = never, default). The server restarts transparently on the next tool call. | +| `max_lifetime_seconds` | number | Recycle a stdio server after this total age (`0` = never, default). Restarts transparently on next use. | | `enabled` | bool | If `false`, Hermes skips the server entirely | | `supports_parallel_tool_calls` | bool | If `true`, tools from this server may run concurrently | | `tools` | mapping | Per-server tool filtering and utility policy | @@ -310,6 +312,23 @@ mcp_servers: args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"] ``` +### Recycling memory-heavy stdio servers + +Browser-based MCP servers (e.g. `@playwright/mcp`) keep a full Chromium +resident after their first tool call — hundreds of MB that never get +released. Opt in to automatic recycling and the server is torn down after +the idle/lifetime limit, then restarted transparently the next time one of +its tools is called (its tools stay registered the whole time): + +```yaml +mcp_servers: + playwright: + command: "npx" + args: ["-y", "@playwright/mcp@latest", "--headless"] + idle_timeout_seconds: 900 # recycle after 15 min without a tool call + max_lifetime_seconds: 86400 # and at least once a day regardless +``` + ### Minimal HTTP example ```yaml