feat(mcp): add hermes-memory MCP server for bidirectional memory access#10833
Closed
easyvibecoding wants to merge 4 commits into
Closed
feat(mcp): add hermes-memory MCP server for bidirectional memory access#10833easyvibecoding wants to merge 4 commits into
easyvibecoding wants to merge 4 commits into
Conversation
Expose Hermes memory stores (MEMORY.md, USER.md) and session history (state.db FTS5 search) to any MCP client via a lightweight FastMCP stdio server. This enables Claude Code, Cursor, and other MCP-compatible tools to read/write Hermes memory directly. Tools: read_memory, add_memory_entry, memory_status, session_search Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mory - Atomic writes (tempfile + os.replace + fsync) aligned with Hermes MemoryStore - File locking (fcntl.flock) to prevent race conditions with concurrent Hermes writes - Prompt-injection scanning (role hijacking, invisible Unicode) matching memory_tool.py - New remove_memory_entry tool for pruning stale memory sections - New session_read tool to read full session transcripts - New recent_sessions tool to list sessions for dream consolidation - memory_status now includes state.db session count - SKILL.md v2.0.0 with dream workflow documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers all 7 tools and safety features: - Security scanning (injection, chat templates, invisible Unicode, role hijack) - read_memory (empty, content, user-only, invalid store) - add_memory_entry (add, append, replace, char limit, injection block) - remove_memory_entry (section, not found, last section) - memory_status (empty, with content, with state.db) - session_search (FTS5 match, no match, source filter, limit) - session_read (transcript, nonexistent, limit, truncation) - recent_sessions (list, filter, limit, empty db) - Atomic write and file locking primitives Uses tmp_path isolation with real SQLite (no mocks), matching repo test patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace Unix-only fcntl.flock with platform-aware locking: - Unix: fcntl.flock (unchanged) - Windows: msvcrt.locking - Fallback: no locking if neither available Per CONTRIBUTING.md cross-platform compatibility guidelines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcp-servers/hermes-memory-mcp.py) that exposes Hermes memory stores (MEMORY.md, USER.md) and session history (state.db) to any MCP-compatible clienthermes mcp servedoesn't cover (conversation browsing only, no memory access)os.replace+fsync), file locking (fcntl.flock), prompt-injection scanning,§-delimited sections, char limitsMotivation
hermes mcp serveexposes 10 conversation/messaging tools but zero memory tools. Users running Hermes alongside Claude Code (or other MCP clients) have no way to share persistent memory between agents. This server fills that gap with 7 tools covering memory CRUD + session browsing for dream-consolidation workflows.Tools (7)
Memory
read_memory(store)add_memory_entry(store, entry, old_text)remove_memory_entry(store, old_text)memory_status()Session (Dream Workflow)
recent_sessions(limit, source)session_read(session_id, last_n)session_search(query, limit, source)Safety (aligned with
tools/memory_tool.py)os.replace()+fsync, no corruption on crashfcntl.flock()prevents race conditions with concurrent Hermes writes?mode=roDream Workflow
Inspired by Honcho's
on_session_endand Holographic's auto-extraction:recent_sessions()→ review what happenedsession_read(id)→ read the transcriptadd_memory_entry()/remove_memory_entry()→ consolidatememory_status()→ verify capacityAutomatable via Claude Code hooks, cron, or manual commands.
Files
Test Plan
43 pytest tests covering all tools and safety features:
tmp_pathisolation with real SQLite — no mocks, matching repo test patterns