obsidian-mermaid-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@obsidian-mermaid-mcpRender the mermaid diagrams in my Obsidian note to SVG."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
obsidian-mermaid-mcp
Local, Zero-Token, Lossless Mermaid rendering and reversible note synchronization for Obsidian vaults across all AI Agents.
π Key Highlights
βοΈ Zero-Prompt Agent Writing Experience AI Agents (Codex, Claude Code, Antigravity, Cursor, Windsurf, Cline, etc.) can write standard Markdown with
```mermaidcode blocks naturally. The background Watcher automatically converts them to embedded SVGs within ~2 seconds without requiring special prompts.π 100% Local & Private Renders locally via headless Chrome/Puppeteer. No cloud rendering APIs, no token costs, and zero network leaks.
π Lossless & Fully Reversible Original Mermaid code is safely preserved in both
.mmdsidecar files and SVG<metadata>. Revert back to original Mermaid code blocks anytime with one click.π§ Smart Vault Adaptation Automatically detects
.obsidian/app.json(supports folder-relativeassets/${filename}, vault-rootattachments, and same-folder setups) with zero configuration.β‘ Dual Operation Modes
Automatic Watcher Mode (background file watcher for seamless authoring)
MCP Tool Mode (4 standard stdio MCP tools for direct Agent invocation)
π» Universal Platform Support macOS, Linux, Windows, WSL, and Docker.
Related MCP server: Vizdown-MCP
π Quick Start
Requirements
Node.js:
>= 20.0.0Chrome / Chromium / Edge / Brave / Arc: Installed in a standard location, or specify via
PUPPETEER_EXECUTABLE_PATH.
Installation & Build (Local Node.js)
git clone https://github.com/IPromise-23/obsidian-mermaid-mcp.git
cd obsidian-mermaid-mcp
npm ci
npm run build
npm testInstallation & Build (Docker Alternative)
git clone https://github.com/IPromise-23/obsidian-mermaid-mcp.git
cd obsidian-mermaid-mcp
docker build -t obsidian-mermaid-mcp:latest .π Detailed Docker Guide (MCP Server & Docker Compose): docs/docker-guide.md
π οΈ Usage Mode 1: Automatic Watcher (Recommended)
Run the watcher in the background to automatically convert any newly written or edited Mermaid blocks in your Obsidian notes.
Foreground Test
node packages/watcher/dist/index.js watch \
--vault-root /path/to/your/obsidian/vault \
--apply \
--debounce-ms 3000Note:
--applyis required for actual file writes. Without--apply, the watcher operates in preview-only mode.
Background Daemon Setup
We provide ready-to-use background service templates for all major platforms:
macOS (LaunchAgent): See
examples/daemons/com.obsidian-mermaid.watch.plistLinux (systemd user service): See
examples/daemons/obsidian-mermaid-watch.serviceWindows (Task Scheduler / PowerShell): See
examples/daemons/register-task-windows.bat
π Detailed Daemon Setup Guide: docs/daemon-setup.md
π Usage Mode 2: MCP Tool Mode
Configure obsidian-mermaid-mcp as a standard MCP server in your favorite AI host.
MCP Configuration Example
{
"mcpServers": {
"obsidian-mermaid": {
"command": "node",
"args": ["/absolute/path/to/obsidian-mermaid-mcp/packages/mcp-server/dist/index.js"],
"env": {
"OBSIDIAN_MERMAID_VAULT_ROOT": "/absolute/path/to/your/vault"
}
}
}
}π Complete Configuration Guide for 10+ AI Hosts (Codex, Claude Code, Cursor, Windsurf, Cline, Roo Code, Goose, Zed, etc.):
See docs/host-configs.md.
Available MCP Tools
Tool Name | Default Mode | Description |
| preview | Scan Mermaid fences in a note, render to SVG, and insert embed markers (requires |
| preview | Restore managed SVG embed markers back to original Mermaid code fences. |
| read-only | Render raw Mermaid source to sanitized SVG. |
| read-only | Extract or recover Mermaid source from a note or managed SVG file. |
π How It Works: Vault Transformation
Before Conversion (Standard Markdown)
# Architecture Overview
```mermaid
flowchart LR
Client --> Server
Server --> Database
```After Conversion (Clean Embedded SVG + Sidecar)
# Architecture Overview
![[assets/Architecture/mermaid-001-f97437d9e714d8ee.svg|600]]Generated File Structure
MyVault/
βββ Architecture.md
βββ assets/
βββ Architecture/
βββ mermaid-001-f974.svg # Sanitized, high-resolution SVG
βββ mermaid-001-f974.mmd # Exact Mermaid source backupβοΈ Configuration Reference
You can customize behavior via a JSON configuration file (--config /path/to/config.json) or environment variables.
Example config.json:
{
"configVersion": 1,
"vaultRoot": "/path/to/vault",
"assetRoot": "assets",
"attachmentPattern": "{note_dir}/assets/{note_name}/mermaid-{index}-{hash}.svg",
"sourcePattern": "{note_dir}/assets/{note_name}/mermaid-{index}-{hash}.mmd",
"embedWidth": 600,
"theme": "default",
"background": "transparent",
"sourceStorage": "both",
"failurePolicy": "partial",
"renderer": {
"timeoutMs": 30000,
"browserIdleTimeoutMs": 300000,
"maxConcurrentRenders": 1,
"htmlLabels": false,
"securityLevel": "strict",
"executablePath": ""
},
"watcher": {
"enabled": true,
"debounceMs": 3000,
"apply": true
}
}Template Placeholders
{note_dir}: Subdirectory of the note relative to vault root (e.g.SEM_AI/chapter1or empty for root notes).{note_name}: Safe filename of the note without.mdextension.{asset_root}: Configured asset root (default:assets).{index}: 3-digit index of the diagram within the note (001,002, etc.).{hash}: 16-character SHA-256 fingerprint of the Mermaid source.{ext}: File extension (svgormmd).
π Troubleshooting & FAQ
1. Browser not found
By default, the server searches standard macOS, Linux, and Windows directories for Google Chrome, Chromium, Microsoft Edge, Brave, or Arc. If installed in a custom location, set:
export PUPPETEER_EXECUTABLE_PATH="/custom/path/to/chrome"Or specify "renderer.executablePath" in your config.json.
2. Dark theme support
Set "theme": "dark" in config.json or pass "theme": "dark" in MCP tool calls. You can also use "theme": "auto" with "themeContext": "dark".
3. How to edit an already converted diagram
Option A: Run
restore_note(via MCP or CLI) to restore the note back to```mermaidcode blocks, edit it, and let it re-sync.Option B: Directly edit the generated
.mmdsidecar file in theassets/folder. The Watcher / Sync engine will automatically detect the sidecar change and regenerate the SVG!
π License
MIT License. See LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagrβ¦
Let Claude, Cursor, or ChatGPT author Mermaid diagrams your team can read and share.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Create and manage Mermaid.js flowcharts and diagrams with AI agents via MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to generate and render Mermaid diagrams (flowcharts, sequence diagrams, etc.) as PNG/SVG images with local file saving and HTTP access URLs. Supports batch processing and intelligent caching for efficient diagram creation.17 npm1MIT
- AlicenseAqualityDmaintenanceConverts Markdown files into professional diagrams such as flowcharts, mind maps, and architecture diagrams using Mermaid.js and custom SVG renderers. It enables users to list, render, and export visualizations in multiple formats including SVG, PNG, and PDF.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables creating, manipulating, and managing Mermaid diagrams with automatic saving and multi-format conversion from JSON, CSV, Python, Markdown, and plain text.7MIT
- AlicenseAqualityDmaintenanceRenders Mermaid diagram markup to PNG images using Puppeteer/Chromium. Enables AI-generated diagrams to be previewed inline and saved to disk.112 npmMIT