## DeerFlow Jacob Troubleshooting ## Session: Jacob Hermes MCP Troubleshooting & DeerFlow Upgrade ### Issues Investigated 1. **Jacob couldn't see his SOUL.md** — File existed at `backend/.deer-flow/agents/jacob/SOUL.md` but Jacob had no introspection capability (injected into prompt but no tool to read it). 2. **Jacob had zero Hermes MCP tools** — Multiple root causes found: - ConfigMap pointed to external URL (`https://hermes.fetcherpay.com/mcp`) instead of internal K8s service - `filesystem` and `github` MCP servers were enabled but failing (no `npx` in container) - `MultiServerMCPClient.get_tools()` uses `asyncio.gather()` without `return_exceptions=True` — one failing server kills ALL MCP tools - `.langgraph_api` directory was NOT persisted on PVC — thread data lost on pod restart - **168 commits behind upstream** — critical fix `24fe5fbd` specifically addresses MCP init RuntimeError escaping ### Fixes Applied 1. Updated ConfigMap `deer-flow-app-config`: - Changed hermes-mcp URL to `http://hermes-mcp:3456/sse` (internal K8s service) - Disabled failing `filesystem` and `github` MCP servers - Hermes MCP remains enabled with `x-api-key` auth 2. Made `.langgraph_api` persistent: - Patched `deer-flow-langgraph` deployment to mount `.langgraph_api` from PVC (`deer-flow-data`) - Copied existing `.langgraph_ops.pckl` to PVC 3. **Pulled upstream updates**: - Merged 168 commits from `origin/main` (bytedance/deer-flow) - Key commits: MCP init fix, checkpointer directory fix, memory fixes, docker/k8s improvements 4. **Rebuilt & redeployed**: - Built new backend image: `localhost:32000/deer-flow-backend:c99865f5` - Built new frontend image: `localhost:32000/deer-flow-frontend:c99865f5` - Updated K8s deployments to use tagged images (avoiding `latest` cache issues) - All pods restarted and running with new code ### Current Status - Pods running with updated images (tag `c99865f5`) - Hermes MCP is the only enabled MCP server - Thread persistence fixed via PVC mount - **Ready for testing** — start fresh thread with Jacob and ask about Hermes tools ### TODO / Follow-up - [ ] Verify Jacob can see Hermes MCP tools in fresh thread - [ ] If still failing, check langgraph pod logs for MCP initialization messages - [ ] Consider adding `read_file` tool so Jacob can introspect his own SOUL.md - [ ] Stashed local nginx changes (`docker/nginx/nginx.conf`) — re-apply if needed for Docker dev mode ## Jacob Hermes MCP — Root Cause Found ## Session: Jacob Hermes MCP Troubleshooting & DeerFlow Upgrade (Continued) ### Final Root Cause **SSE transport in `langchain-mcp-adapters` silently hangs when connecting to Hermes MCP.** With `asyncio.gather()` and no timeout, `MultiServerMCPClient.get_tools()` blocked forever on SSE connections. Switching to **HTTP (streamable_http)** transport resolved it immediately. ### Debug Timeline - Added module-level and function-level debug logs to `deerflow.mcp.tools`, `deerflow.mcp.cache`, and `deerflow.agents.lead_agent.agent` - Discovered `make_lead_agent` was never being called during pod startup — graph compilation is lazy (happens on first request) - Forced graph compilation by creating a run via LangGraph API (`curl http://localhost:32024`) - Observed MCP init logs hanging at `MultiServerMCPClient created, calling get_tools()...` with SSE transport - Switched ConfigMap to `type: "http"` and confirmed success: `Successfully loaded 10 tool(s) from MCP servers` ### Final Working ConfigMap (`deer-flow-app-config`) ```json { "mcpServers": { "filesystem": { "enabled": false, ... }, "github": { "enabled": false, ... }, "hermes-mcp": { "enabled": true, "type": "http", "url": "http://hermes-mcp:3456/mcp", "headers": { "x-api-key": "114521f3f9e6858480d6269446a446ef" }, "description": "Hermes MCP - access to Yahoo Mail, FetcherPay emails, and Obsidian vault" }, "postgres": { "enabled": false, ... } } } ``` ### Images Deployed - Backend: `localhost:32000/deer-flow-backend:c99865f5-http` - Frontend: `localhost:32000/deer-flow-frontend:c99865f5` ### Status - ✅ Hermes MCP connected via HTTP transport - ✅ 10 tools loaded (email + Obsidian) - ✅ DeerFlow updated to latest upstream - ✅ Thread persistence fixed - ✅ Ready for testing with fresh Jacob thread