Skip to content

C-Bjorn/MegaMem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

62 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MegaMem โ€” Obsidian ร— Knowledge Graph ร— MCP

Temporal memory for AI assistants, powered by your Private vault

MegaMem is an Obsidian plugin that syncs your notes into a temporal knowledge graph (powered by Graphiti) and exposes it to AI assistants through the Model Context Protocol (MCP). Claude, and any other MCP-compatible client, can read, search, and write to your vault โ€” and remember things across conversations.

Version Obsidian License: MIT


๐ŸŒŸ Key Features

๐Ÿง  Temporal Knowledge Graph

Sync your Obsidian notes to a graph database. Entities become nodes, relationships are extracted by AI, and every fact is timestamped so the graph evolves as your knowledge does โ€” without losing history.

๐Ÿ” Auto Schema Discovery

The plugin scans your vault's frontmatter and automatically infers entity types, property types, and relationships. No manual schema definition required. Write your notes, the schema emerges.

๐ŸŒ Multi-Database & Multi-Vault (new in v1.5.0)

Configure multiple named graph databases simultaneously โ€” each with its own connection, type (Neo4j/FalkorDB), and embedding model. A masterVault runs the MCP server and manages all databases across all registered vaults. Tell Claude which database to query, or let it discover available databases with list_databases.

๐Ÿค– 21 MCP Tools for AI Assistants

A full MCP server (11 graph tools + 10 vault file tools) gives Claude โ€” or any MCP client โ€” direct, structured access to your knowledge. Search memories, add episodes, read and write notes, explore folders, all from your AI conversation.

๐Ÿ—๏ธ Custom Ontology Manager

Define your own entity types, edge types, and property descriptions. Generate Pydantic models with one click. The AI understands your custom data structures during extraction.

โšก Obsidian CLI Integration

All 10 file operation tools run through the native Obsidian CLI (v1.12+) โ€” stateless subprocess calls with no persistent WebSocket, no connection race conditions, no heartbeat. Multi-vault support via a single vault_id parameter. Non-markdown files (.pdf, .png, .csv, .base, etc.) are now fully supported across all file tools.

๐ŸŒ Streamable HTTP MCP Transport (new in v1.4.0)

Connect Roo Code, Cursor, Claude Code, VS Code, NemoClaw, and any HTTP-capable MCP client directly to MegaMem โ€” no Claude Desktop required. Enable the opt-in Streamable HTTP server (MCP spec 2025-03-26) in Plugin Settings โ†’ Servers. Token Profiles let you create scoped bearer tokens per client, each with a one-click Copy Config for all 6 supported clients. Remote access via Tailscale is supported via a per-profile Endpoint URL field.

๐Ÿ”„ Intelligent Sync

Auto-sync on interval, sync on demand, or trigger from MCP. Filter by folder inclusion/exclusion. Choose "new only" or "new + updated". Sync state is tracked in a local SQLite database (sync.db) โ€” per-note, per-database, with content hashing to skip unchanged notes and full analytics logging (token counts, entity counts, sync duration).

๐Ÿ“Š Sync Analytics Dashboard (new in v1.5.5)

The unified MegaMem panel (brain icon, copper accent) combines Ontology, Sync, and Analytics in a single tabbed sidebar. The Analytics tab provides a comprehensive dashboard: animated summary cards (Synced Notes, Entities Extracted, Edges Created, LLM Cost + Embed sub-label), a Sync Timeline with Entities / Edges / LLM Cost right-axis toggle, Token Usage by Model (Big / Small / Both views), a sortable Model Performance table (Provider, Embed Cost, Total Cost), and a Synced Notes accordion with per-session detail including Embed Model and Embed Cost.

โœฆ MegaMem Pro (new)

A dedicated Pro tab in plugin settings for licensed Stewards. Validate your API key, check and install content packages (vault templates, ontology packs), and access upcoming hosted services โ€” all in-plugin. Free plan users keep all MCP tools; Pro is content delivery and future hosted features.


๐Ÿš€ BETA Launch

MegaMem is stable in daily production use and currently in public beta. We're actively seeking testers to stress-test the system across diverse environments โ€” different vaults, databases, LLM providers, and operating systems. If you find something, open an issue. If it works great, tell someone.

  • Install now via BRAT โ†’ C-Bjorn/megamem-mcp
  • Python components install automatically on first launch โ€” no manual downloads
  • Windows (Neo4j) is most battle-tested; macOS works great; Linux support is there but less tested

๐Ÿ› ๏ธ MCP Tools Reference

All 21 tools are available to Claude Desktop and any MCP-compatible client.

Graph Operations (11)

Tool Description
add_memory Add an episode/memory to the knowledge graph (database_id optional)
add_conversation_memory Store a conversation as a structured memory episode
search_memory_nodes Semantic search for entity nodes in the graph (database_id optional)
search_memory_facts Search for relationships and facts between entities (database_id optional)
get_episodes Retrieve the most recent N episodes from a group
get_entity_edge Get relationships for a specific entity by name
delete_entity_edge Remove a specific relationship edge by UUID
delete_episode Remove a specific episode by ID
list_group_ids List all group IDs (namespaces) in the vault
list_databases List all configured database targets โ€” use before routing with database_id
clear_graph Clear the entire memory graph (use with caution)

Obsidian File Operations (10) โ€” via Obsidian CLI

Non-markdown files (.pdf, .png, .csv, .base, etc.) are supported across all file tools โ€” the _auto_md fix skips .md auto-append when the path already has a recognized extension.

Tool Description
search_obsidian_notes Search vault notes by filename and/or content
read_obsidian_note Read a note's full content (with optional line map for editing)
update_obsidian_note Update a note โ€” 5 modes: full file, frontmatter, append, range, editor
create_obsidian_note Create a new note at a specified path
list_obsidian_vaults List all registered Obsidian vaults
explore_vault_folders Explore vault folder structure (tree/flat/paths output)
create_note_with_template Create a note using a Templater template with intelligent routing
manage_obsidian_folders Create, rename, or delete vault folders
manage_obsidian_notes Delete or rename/move notes (cross-folder moves supported)
manage_obsidian_base Manage Obsidian Bases .base files โ€” operations: list, views, query, create

Full parameter reference: docs/mcp-commands.md โ€” Updated for v1.5 with database_id routing on all graph tools.


๐Ÿ“‹ How It Works

1. Schema Discovery

The plugin scans your vault frontmatter and infers entity types and properties:

---
type: Person
name: "Jane Smith"
role: "Researcher"
organization: "TechCorp"
tags: ["AI", "Knowledge Graphs"]
---

2. Pydantic Model Generation

Your frontmatter patterns become typed Graphiti extraction models:

class Person(BaseNode):
    name: Optional[str] = Field(None, description="Person's full name")
    role: Optional[str] = Field(None, description="Current role or title")
    organization: Optional[str] = Field(None, description="Current employer")

3. Temporal Graph Sync

Notes are processed through Graphiti's extraction pipeline:

  • Entities become graph nodes with versioned properties
  • Relationships are extracted from note content via LLM
  • Sync state tracked in SQLite (sync.db) per-note/per-DB with content hashing โ€” unchanged notes are skipped automatically
  • AI assistants query this structured graph via MCP

๐Ÿš€ Getting Started

Prerequisites

Component Minimum Notes
Obsidian 1.12.4+ (installer) Must run the full installer โ€” in-app updates don't enable CLI
Python 3.11+ Managed automatically via UV
Database Neo4j 5+ or FalkorDB 1+ Neo4j Desktop is easiest for local use

โš ๏ธ Obsidian installer required: Download and run the full installer from obsidian.md/download. In-app auto-update does not update the CLI binary. Then go to Settings โ†’ General โ†’ Command line interface โ†’ Register.

Install via BRAT (recommended)

  1. Install BRAT from Community Plugins
  2. BRAT โ†’ Add Beta Plugin โ†’ paste C-Bjorn/megamem-mcp
  3. A dialog appears after ~3 seconds: click "Install / Update Components"
    • Downloads and installs graphiti_bridge + mcp-server automatically
  4. Plugin is ready

7-Step Setup

Step 0 โ€” Register Obsidian CLI (required for file tools) Run the Obsidian 1.12.4+ installer โ†’ Settings โ†’ General โ†’ CLI โ†’ Register โ†’ restart terminal โ†’ verify with obsidian version

Step 1 โ€” Set up a graph database Neo4j Desktop (recommended) or FalkorDB via Docker. See Database Setup Guide.

Step 2 โ€” Install Python dependencies Plugin Settings โ†’ Python Environment โ†’ "Install Dependencies" (uses UV by default โ€” works on macOS/Windows/Linux).

Step 3 โ€” Configure LLM provider Plugin Settings โ†’ API Keys โ†’ enter your key. Click "Load Defaults" to populate recommended models.

Step 4 โ€” Connect the database Plugin Settings โ†’ Database Configuration โ†’ enter your connection details โ†’ "Test Connection" โ†’ "Initialize Schema".

Step 5 โ€” Connect your MCP client

  • Claude Desktop (stdio): Plugin Settings โ†’ Servers โ†’ STDIO MCP Server โ†’ "Generate Config" โ†’ paste into claude_desktop_config.json โ†’ restart Claude Desktop.
  • HTTP clients (Roo Code, Cursor, Claude Code, VS Code, NemoClaw): Plugin Settings โ†’ Servers โ†’ Streamable HTTP Access โ†’ enable toggle โ†’ expand the Admin token profile โ†’ click the Copy Config button for your client. No Claude Desktop needed.

Step 6 โ€” (Optional) Configure sync Advanced sync settings (auto-sync toggle, sync interval, included folders) are in Plugin Settings โ†’ Advanced Settings tab โ†’ Auto-Sync. Excluded folders and per-note extraction settings are in General โ†’ Sync Configuration.

Step 7 โ€” Start syncing Three ways to sync:

  • Single note: click the sync icon (top-right of any note window) to sync the current note
  • Bulk sync / Analytics: click the ๐Ÿง  brain icon in the ribbon to open the unified MegaMem panel โ†’ switch to the Sync tab for bulk operations
  • Command palette: MegaMem: Open Sync / MegaMem: Open Analytics / MegaMem: Open Ontology

โš ๏ธ Notes must have a type property in their frontmatter to use bulk Sync (when Custom Ontology is enabled).


๐ŸŽฏ Use Cases

Personal Knowledge Management

Build a graph of the people, projects, ideas, and relationships in your life. Ask Claude "what do I know about X?" and get answers drawn from your actual notes, with full temporal context. It works as a personal CRM, project tracker, and second brain โ€” all from your existing vault without restructuring anything.

AI-Assisted Note-Taking

With 9 native Obsidian file tools, Claude can create, search, and update notes directly in your vault mid-conversation. Draft a meeting note, file it in the right folder, sync it to the graph โ€” all in one step, without leaving the chat.

Also great for: research & academia (literature graphs, citation tracking), business intelligence (competitor research, knowledge bases), creative projects (world-building, character arcs), and multi-team knowledge management with namespaced vaults.


๐Ÿ“š Documentation

Getting Started

Guides

Reference

  • MCP Commands โ€” All 19 tools with full parameter reference
  • FAQ โ€” Common questions answered

๐Ÿค Community & Support


๐Ÿ”ฎ Roadmap

Shipped โœ…

  • OpenRouter Embedding Models โ€” Model Library โ†’ Embedding Models now fetches live catalog from /api/v1/embeddings/models (25 embedded seeds available without API key); Multimodal/Free/ZDR filter bar; Python bridge supports embedder_provider: openrouter (v1.6.9)
  • Template Scaffold Return โ€” create_note_with_template returns content + instructions in response; 2-call workflow (create โ†’ update, no read needed) (v1.6.9)
  • Analytics: Embed Cost + Timeline Toggles โ€” Embed cost tracked per sync (content_length/4 ร— embedder pricing); Embed Cost column + Embed Model in Synced Notes detail; Sync Timeline right-axis toggle: Entities | Edges | LLM Cost (v1.6.9)
  • Unified MegaMem Panel & Sync Analytics Dashboard โ€” brain icon ribbon, tabbed panel (Ontology | Sync | Analytics), animated summary cards, Timeline chart, Token Usage by Model (Big/Small/Both), sortable Model Performance table with Provider column, Synced Notes accordion, Sync Health indicators, bundled model pricing (v1.5.5)
  • SQLite Sync Registry โ€” sync.db replaces sync.json; per-note/per-DB content hashing (skip unchanged), full analytics logging (token counts, entity/edge counts, duration, model used), episode UUID chain via SQLite (no more mm_uid frontmatter writes) (v1.5.5)
  • Multi-database support โ€” multiple named Neo4j/FalkorDB targets, per-DB embedding config, sync dropdown per note (v1.5)
  • Multi-vault architecture โ€” masterVault control panel, childVault registration, MCP database_id routing, list_databases tool (v1.5)
  • Temporal knowledge graph sync (Graphiti + Neo4j/FalkorDB)
  • 21 MCP tools โ€” 11 graph operations + 10 Obsidian file tools (including manage_obsidian_base for .base files)
  • Obsidian CLI integration (stateless, multi-vault, no WebSocket)
  • Auto schema discovery from vault frontmatter
  • Custom ontology manager with Pydantic model generation
  • Model Library โ€” live model fetching from LLM providers; OpenRouter now supports embedding model fetch via /api/v1/embeddings/models; pricing synced to analytics DB for cost tracking
  • Constrained ontology generation (edge type cap + deduplication)
  • Ontology file separation (ontology.json split from data.json)
  • Auto-update system โ€” Python components auto-install and self-update
  • MegaMem Pro tab โ€” license validation + content package delivery

In Progress / Near-term ๐Ÿ”„

  • Obsidian Community Plugins submission
  • Graph visualization within Obsidian
  • Advanced query builder

Future ๐ŸŒฑ

  • Built-in LLM chat interface inside Obsidian
  • Cloud-hosted graph option (no local database required)
  • Mobile support
  • Additional database backends (Kuzu, Amazon Neptune)

๐Ÿ’ก Philosophy

MegaMem embraces progressive formalization: start with plain notes, let patterns emerge naturally, then add structure as your knowledge matures. The graph enriches your vault โ€” it doesn't replace the way you write.

Gate services, not tools. All 20 MCP tools are free. Forever.


๐Ÿ™ Built With

๐Ÿ“„ License

MIT โ€” see LICENSE.txt


Transform your notes into knowledge. Give your AI a memory worth having.

Built by Casey Bjรธrn @ ENDOGON

Packages

 
 
 

Contributors

Languages