otrebu/obsidian-plugin-virtual-memories
If you are the rightful owner of obsidian-plugin-virtual-memories and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Virtual Memories - Obsidian MCP Integration is a cloud-based system that enables AI assistants to write notes directly to your Obsidian vault using the Model Context Protocol (MCP).
Virtual Memories - Obsidian MCP Integration
A cloud-based integration system that allows AI assistants to write notes directly to your Obsidian vault using the Model Context Protocol (MCP). This project consists of two main components:
- MCP Server - A Cloudflare Worker that provides an MCP endpoint for AI assistants
- Obsidian Plugin - A plugin that syncs notes from the cloud to your vault
Architecture
AI Assistant (Claude/ChatGPT)
ā (MCP Protocol)
Cloudflare MCP Server
ā (Cloudflare KV - Buffer Storage)
Obsidian Plugin
ā (Vault API)
Your Obsidian Vault
The system uses a "store-and-forward" approach where notes are buffered in Cloudflare KV and then synced to your local vault by the Obsidian plugin.
Features
- š¤ AI Integration - Connect AI assistants to Obsidian via MCP
- āļø Cloud Buffer - Notes are stored in the cloud until synced
- š Auto-sync - Automatic periodic syncing with configurable intervals
- š Secure - API key authentication support
- š Flexible Storage - Choose target folder for notes
- šÆ Multiple Notes - Support for different note names
- ā” Real-time - Manual sync available via command/ribbon
Setup Instructions
1. Deploy the MCP Server
Prerequisites
- Cloudflare account
- Node.js installed
- Wrangler CLI installed
Steps
- Clone this repository:
git clone https://github.com/otrebu/obsidian-plugin-virtual-memories.git
cd obsidian-plugin-virtual-memories/mcp-server
- Install dependencies:
npm install
- Create a KV namespace:
wrangler kv:namespace create "NOTES_KV"
wrangler kv:namespace create "NOTES_KV" --preview
-
Update
wrangler.toml
with your KV namespace IDs (from step 3) -
(Optional) Set an API key for authentication:
wrangler secret put API_KEY
# Enter your secret API key when prompted
- Deploy to Cloudflare:
npm run deploy
- Note your Worker URL (e.g.,
https://obsidian-mcp-server.your-account.workers.dev
)
2. Configure MCP Client (AI Assistant)
For Claude Desktop, add to your claude_desktop_config.json
:
{
"mcpServers": {
"obsidian": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-remote",
"https://obsidian-mcp-server.your-account.workers.dev/sse"
]
}
}
}
Replace the URL with your actual Worker URL.
3. Install the Obsidian Plugin
Development Installation
- Build the plugin:
cd obsidian-plugin-virtual-memories/obsidian-plugin
npm install
npm run build
- Copy the built files to your vault:
# Create plugin directory
mkdir -p /path/to/your/vault/.obsidian/plugins/virtual-memories
# Copy files
cp main.js manifest.json /path/to/your/vault/.obsidian/plugins/virtual-memories/
- Enable the plugin in Obsidian:
- Open Settings ā Community Plugins
- Disable "Safe Mode" if needed
- Find "Virtual Memories" and enable it
Plugin Configuration
- Open Settings ā Virtual Memories
- Configure:
- MCP Server URL: Your Worker URL (e.g.,
https://obsidian-mcp-server.your-account.workers.dev
) - API Key: Your API key (if you set one in the Worker)
- Target Folder: Optional folder for notes (e.g.,
MCP Notes
) - Auto Sync: Enable/disable automatic syncing
- Sync Interval: How often to sync (in seconds)
- MCP Server URL: Your Worker URL (e.g.,
Usage
From AI Assistant
In your AI conversation (e.g., Claude):
Please save this summary to my Obsidian notes:
## Meeting Notes
- Discussed project timeline
- Action items for next week
- Budget considerations
The AI will use the obsidian_append_note
tool to buffer the content.
In Obsidian
- Manual Sync: Click the cloud icon in the ribbon or use Command Palette ā "Sync MCP Notes Now"
- Auto Sync: Will sync automatically if enabled in settings
- On Startup: Plugin syncs on Obsidian startup
MCP Server API
Tools
obsidian_append_note
Append text to a note in Obsidian.
Parameters:
text
(string, required) - The markdown text to appendnoteName
(string, optional) - Name of the note (without .md). Defaults to "MCP Inbox"
Example:
{
"text": "## New Section\\n\\nSome content here",
"noteName": "Daily Notes"
}
HTTP Endpoints
GET /
- Health checkPOST /sse
- MCP SSE endpointGET /fetch
- Fetch buffered notes (used by plugin)
Development
MCP Server
cd mcp-server
npm install
npm run dev # Start local development server
Obsidian Plugin
cd obsidian-plugin
npm install
npm run dev # Watch mode for development
Testing
- Use the MCP Inspector to test the server:
npx @modelcontextprotocol/inspector https://your-worker.workers.dev/sse
- Test the plugin by manually triggering sync and checking logs
Project Structure
.
āāā mcp-server/ # Cloudflare Worker MCP server
ā āāā src/
ā ā āāā index.ts # Main server code
ā āāā wrangler.toml # Cloudflare config
ā āāā package.json
ā
āāā obsidian-plugin/ # Obsidian plugin
ā āāā main.ts # Plugin main file
ā āāā manifest-template.json
ā āāā esbuild.config.mjs
ā āāā package.json
ā
āāā README.md
Security Considerations
- API Key: Always use an API key in production to prevent unauthorized access
- HTTPS: All communication uses HTTPS
- KV Storage: Notes are deleted after fetching to prevent duplicates
- Local First: The plugin only writes to your local vault
Troubleshooting
Plugin doesn't sync
- Check MCP Server URL in settings
- Verify API key is correct
- Check browser console (Ctrl+Shift+I) for errors
- Ensure Worker is deployed and accessible
AI can't use the tool
- Verify MCP client configuration
- Check Worker logs:
wrangler tail
- Test with MCP Inspector
Notes appear duplicated
- This shouldn't happen as notes are deleted after fetch
- If it does, check for multiple plugin instances or sync conflicts
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
MIT
Acknowledgments
Based on the concept described in the project documentation, combining:
- Cloudflare's MCP server examples
- Obsidian's plugin API
- Model Context Protocol specification