MCP session lost on every container restart (Hermes re-init required) #5

Open
opened 2026-07-16 12:40:54 +00:00 by Hermes · 0 comments
Owner

Problem

Every time the MCP container restarts (docker compose up -d), Hermes MCP client sessions are invalidated. The next tool call returns McpError: Session terminated and the agent must re-initialize (which sometimes requires 2-3 retries before succeeding).

Impact

During debugging (July 16 session), the container was restarted ~6 times for network/key fixes. Each restart required session renegotiation, adding friction to an already fragile flow.

Proposed Fix

  • Support stateless MCP requests where feasible (e.g., for idempotent read-only tools like list_folders)
  • Add a health-check endpoint the agent can ping before tool calls to detect stale sessions early
  • Investigate client-side auto-reconnect on 404/session-terminated responses

Context

This is primarily an MCP protocol / client issue, but the server should be robust against it.

## Problem Every time the MCP container restarts (`docker compose up -d`), Hermes MCP client sessions are invalidated. The next tool call returns `McpError: Session terminated` and the agent must re-initialize (which sometimes requires 2-3 retries before succeeding). ## Impact During debugging (July 16 session), the container was restarted ~6 times for network/key fixes. Each restart required session renegotiation, adding friction to an already fragile flow. ## Proposed Fix - Support stateless MCP requests where feasible (e.g., for idempotent read-only tools like `list_folders`) - Add a health-check endpoint the agent can ping before tool calls to detect stale sessions early - Investigate client-side auto-reconnect on 404/session-terminated responses ## Context This is primarily an MCP protocol / client issue, but the server should be robust against it.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Hermes/ayon-mcp#5