Bug
mcp_serve.channels_list returns {"count": 0, "channels": []} even when channel_directory.json is populated and the gateway has Discord/Slack/etc. connected.
Reproduce
- Run
hermes mcp serve with at least one platform adapter connected.
- Wait for
build_channel_directory to write ~/.hermes/channel_directory.json (gateway startup or 5-min refresh).
- From an MCP client, call
channels_list.
- Result:
{"count": 0, "channels": []} — despite the file containing populated platforms.
conversations_list works correctly; only channels_list is affected.
Root cause
Schema mismatch between writer and reader.
Writer — gateway/channel_directory.py:99-102:
directory = {
"updated_at": datetime.now().isoformat(),
"platforms": platforms, # {"discord": [...], "telegram": [...], ...}
}
Reader — mcp_serve.py:805:
for plat, entries_list in directory.items():
...
if isinstance(entries_list, list):
...
Iterating directory.items() yields ("updated_at", str) and ("platforms", dict). Neither passes isinstance(entries_list, list), so the inner loop never runs.
The fallback-to-sessions branch at mcp_serve.py:780 (if not directory:) doesn't trigger because the file loads non-empty.
Every other reader in the codebase (gateway/channel_directory.py:261, 277, 317) correctly unwraps directory.get("platforms", {}). mcp_serve.channels_list is the only consumer with this bug.
Fix
--- a/mcp_serve.py
+++ b/mcp_serve.py
@@ -802,7 +802,7 @@ def create_mcp_server(event_bridge: Optional[EventBridge] = None) -> "FastMCP":
return json.dumps({"count": len(targets), "channels": targets}, indent=2)
channels = []
- for plat, entries_list in directory.items():
+ for plat, entries_list in directory.get("platforms", {}).items():
if platform and plat.lower() != platform.lower():
continue
if isinstance(entries_list, list):
Affected versions
Confirmed on origin/main at 62c2f5d8d2a6a21adfdea2d8d1f28fd8f04b5dd7.
Bug
mcp_serve.channels_listreturns{"count": 0, "channels": []}even whenchannel_directory.jsonis populated and the gateway has Discord/Slack/etc. connected.Reproduce
hermes mcp servewith at least one platform adapter connected.build_channel_directoryto write~/.hermes/channel_directory.json(gateway startup or 5-min refresh).channels_list.{"count": 0, "channels": []}— despite the file containing populated platforms.conversations_listworks correctly; onlychannels_listis affected.Root cause
Schema mismatch between writer and reader.
Writer —
gateway/channel_directory.py:99-102:Reader —
mcp_serve.py:805:Iterating
directory.items()yields("updated_at", str)and("platforms", dict). Neither passesisinstance(entries_list, list), so the inner loop never runs.The fallback-to-sessions branch at
mcp_serve.py:780(if not directory:) doesn't trigger because the file loads non-empty.Every other reader in the codebase (
gateway/channel_directory.py:261, 277, 317) correctly unwrapsdirectory.get("platforms", {}).mcp_serve.channels_listis the only consumer with this bug.Fix
Affected versions
Confirmed on
origin/mainat62c2f5d8d2a6a21adfdea2d8d1f28fd8f04b5dd7.