hermes - 💡(How to fix) Fix [Bug]: MCP over HTTP (SSE) Transport failing to maintain session ID [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#20349Fetched 2026-05-06 06:37:16
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3closed ×1commented ×1

Error Message

"id": "server-error", "error": {

  • An SSE-ready request (using text/event-stream) returns 400 Bad Request with the error: {"jsonrpc":"2.0","id":"server-error","error":{"code":-32600,"message":"Bad Request: Missing session ID"}}.

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Code Example

--- hermes dump ---
version:          0.12.0 (2026.4.30) [6bc5d722]
os:               Linux 6.8.0-100-generic x86_64
python:           3.11.15
openai_sdk:       2.32.0
profile:          default
hermes_home:      ~/.hermes
model:            gemma-4-26b-a4b-it
provider:         gemini
terminal:         local

api_keys:
  openrouter           set
  openai               not set
  anthropic            not set
  anthropic_token      not set
  nous                 not set
  google/gemini        set
  gemini               not set
  glm/zai              not set
  zai                  not set
  kimi                 not set
  minimax              not set
  deepseek             not set
  dashscope            not set
  huggingface          not set
  nvidia               not set
  ai_gateway           not set
  opencode_zen         not set
  opencode_go          not set
  kilocode             not set
  firecrawl            not set
  tavily               not set
  browserbase          not set
  fal                  not set
  elevenlabs           not set
  github               not set

features:
  toolsets:           hermes-cli
  mcp_servers:        1
  memory_provider:    built-in
  gateway:            stopped (systemd (user))
  platforms:          none
  cron_jobs:          2 active / 2 total
  skills:             108

config_overrides:
  agent.max_turns: 60
  display.streaming: True
--- end dump ---


--- agent.log (last 200 lines) ---
(file empty)

--- errors.log (last 100 lines) ---
(file empty)

--- gateway.log (last 100 lines) ---
(file not found)




-----------


O comando hermes debug share --local não exibe essas falhas de comunicação de ferramentas, pois elas são tratadas como falhas de execução de função (tool calls) e não como crashes do processo hermes-agent.

---
RAW_BUFFERClick to expand / collapse

Bug Description

When attempting to connect to an MCP server using the HTTP/SSE transport (configured via mcp.servers in config.yaml), the hermes-agent gateway fails to successfully establish and maintain a valid session. This prevents the agent from invoking any tools provided by the MCP server.

Steps to Reproduce

1. Configure an MCP server in ~/.hermes/config.yaml using an HTTP URL (e.g., url: http://127.0.0.1:8000/mcp).
2. Ensure the MCP server is running and expects text/event-stream (SSE).
3. Attempt to use a tool that is provided by that MCP server.

Technical Evidence
Diagnostic httpx test results:
json
{
  "jsonrpc": "2.0",
  "id": "server-error",
  "error": {
    "code": -32600,
    "message": "Bad Request: Missing session ID"
  }
}

lsof confirms that other agents (e.g., claude CLI) are successfully maintaining established connections to the same endpoint, confirming the server implementation is correct and the issue resides in the hermes-agent gateway's transport logic.

Expected Behavior

The hermes-agent gateway should:
1. Initiate an SSE connection to the endpoint.
2. Capture the mcp-session-id from the server's response headers.
3. Include this mcp-session-id in subsequent JSON-RPC requests to maintain the session.

Actual Behavior

The gateway fails to manage the session ID correctly. Based on diagnostic testing:
- A standard GET request without the correct Accept header returns 406 Not Acceptable.
- An SSE-ready request (using text/event-stream) returns 400 Bad Request with the error: {"jsonrpc":"2.0","id":"server-error","error":{"code":-32600,"message":"Bad Request: Missing session ID"}}.

This indicates that while the connection is being attempted, the mcp-session-id provided by the server during the handshake is not being correctly propagated by the gateway in subsequent calls.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

--- hermes dump ---
version:          0.12.0 (2026.4.30) [6bc5d722]
os:               Linux 6.8.0-100-generic x86_64
python:           3.11.15
openai_sdk:       2.32.0
profile:          default
hermes_home:      ~/.hermes
model:            gemma-4-26b-a4b-it
provider:         gemini
terminal:         local

api_keys:
  openrouter           set
  openai               not set
  anthropic            not set
  anthropic_token      not set
  nous                 not set
  google/gemini        set
  gemini               not set
  glm/zai              not set
  zai                  not set
  kimi                 not set
  minimax              not set
  deepseek             not set
  dashscope            not set
  huggingface          not set
  nvidia               not set
  ai_gateway           not set
  opencode_zen         not set
  opencode_go          not set
  kilocode             not set
  firecrawl            not set
  tavily               not set
  browserbase          not set
  fal                  not set
  elevenlabs           not set
  github               not set

features:
  toolsets:           hermes-cli
  mcp_servers:        1
  memory_provider:    built-in
  gateway:            stopped (systemd (user))
  platforms:          none
  cron_jobs:          2 active / 2 total
  skills:             108

config_overrides:
  agent.max_turns: 60
  display.streaming: True
--- end dump ---


--- agent.log (last 200 lines) ---
(file empty)

--- errors.log (last 100 lines) ---
(file empty)

--- gateway.log (last 100 lines) ---
(file not found)




-----------


O comando hermes debug share --local não exibe essas falhas de comunicação de ferramentas, pois elas são tratadas como falhas de execução de função (tool calls) e não como crashes do processo hermes-agent.

Operating System

Linux Mint 22.1 Xia

Python Version

3.12.3

Hermes Version

0.12.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The hermes-agent gateway likely needs to correctly capture and propagate the mcp-session-id from the server's response headers to maintain the session with the MCP server.

Guidance

  1. Verify SSE Connection: Ensure the hermes-agent gateway is correctly initiating an SSE connection to the MCP server endpoint and that the server is responding with the mcp-session-id in its response headers.
  2. Check Header Handling: Review the gateway's logic for handling response headers from the MCP server, specifically how it captures and stores the mcp-session-id.
  3. Session ID Propagation: Confirm that the gateway includes the captured mcp-session-id in subsequent JSON-RPC requests to the MCP server.
  4. Debug Logging: Enable detailed logging in the hermes-agent gateway to trace the SSE connection establishment, response header handling, and session ID propagation to identify where the issue occurs.

Example

No specific code example can be provided without modifying the existing codebase, but reviewing the hermes-agent code for SSE connection handling and session ID management is crucial.

Notes

The issue seems to be specific to the hermes-agent gateway's handling of SSE connections and session IDs. Ensuring the gateway correctly implements the SSE protocol and manages session IDs as expected by the MCP server is key to resolving the issue.

Recommendation

Apply a workaround by manually verifying the SSE connection and session ID handling in the hermes-agent gateway, as the provided information does not imply a straightforward code fix or version upgrade.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING