Obsidian CDP MCP Server
Connects to a running Obsidian instance via Chrome DevTools Protocol, providing tools for reading/writing vault files, searching files and folders, managing links/tags/frontmatter, editor selection and cursor operations, templates, plugins and commands, plus CDP-specific screenshots, console output, DOM queries, and arbitrary JavaScript execution.
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 CDP MCP Server create a note called 'Ideas' and apply the daily template"
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 CDP MCP Server
Connect to Obsidian via Chrome DevTools Protocol (CDP), providing MCP tool interfaces.
Features
Compared to REST API, CDP provides more powerful capabilities:
Capability | CDP | REST API |
Read/Write Files | ✅ | ✅ |
Real-time Console Output | ✅ | ❌ |
DOM Inspection/Manipulation | ✅ | ❌ |
Screenshots | ✅ | ❌ |
Execute Arbitrary JS | ✅ | ❌ |
Plugin Management | ✅ | ❌ |
Command Execution | ✅ | ✅ |
Related MCP server: ObsiScripta Bridge
Prerequisites
Obsidian must be started in debug mode:
# macOS
open -a Obsidian --args --remote-debugging-port=9222
# Or run directly
/Applications/Obsidian.app/Contents/MacOS/Obsidian --remote-debugging-port=9222Installation
Using npx (No Installation Required)
You can use npx to run the server directly without installing:
npx obsidian-cdp-mcpGlobal Installation
npm install -g obsidian-cdp-mcpAfter installation, you can use the obsidian-cdp-mcp command directly.
From Source
git clone https://github.com/QianChenglong/obsidian-cdp-mcp.git
cd obsidian-cdp-mcp
npm install
npm run build
npm linkMCP Configuration
CodeBuddy Code
Add to ~/.codebuddy/settings.json:
{
"mcpServers": {
"obsidian-cdp": {
"command": "npx",
"args": ["obsidian-cdp-mcp"],
"env": {
"OBSIDIAN_DEBUG_PORT": "9222"
}
}
}
}Or if installed globally:
{
"mcpServers": {
"obsidian-cdp": {
"command": "obsidian-cdp-mcp",
"env": {
"OBSIDIAN_DEBUG_PORT": "9222"
}
}
}
}Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"obsidian-cdp": {
"command": "npx",
"args": ["obsidian-cdp-mcp"],
"env": {
"OBSIDIAN_DEBUG_PORT": "9222"
}
}
}
}Available Tools
Basic Operations
Tool | Description |
| Get vault information |
| Get currently open file |
| Read file content |
| Write/create file |
| Apply partial edits using search and replace |
| Search files by path (supports |
| Search folders by name or path |
| Full-text search with synonym normalization (requires Omnisearch plugin) |
| Open file |
File & Folder Management
Tool | Description |
| List folder contents |
| Create new folder |
| Move or rename file/folder |
| Delete file/folder |
Links & References
Tool | Description |
| Get incoming links to a file |
| Get outgoing links from a file |
| Resolve wiki link to file path |
Metadata & Properties
Tool | Description |
| Get tags (vault-wide or per file) |
| Search files by tag (supports nested tags) |
| Get file frontmatter/YAML |
| Update frontmatter properties |
| Get all property names in vault |
Editor Operations
Tool | Description |
| Get selected text |
| Replace selected text |
| Insert text at cursor |
| Get cursor position |
Templates
Tool | Description |
| List available templates |
| Apply template to file |
Plugins & Commands
Tool | Description |
| List all plugins |
| Search community plugin repository |
| Install plugin from community repository |
| Enable an installed plugin |
| Disable an installed plugin |
| Uninstall a plugin |
| Get plugin settings |
| Update plugin settings |
| List all commands |
| Execute command |
| Run Dataview query (requires Dataview plugin) |
Debug Capabilities (CDP Exclusive)
Tool | Description |
| Capture Obsidian interface (webp/png/jpeg) |
| Get console output |
| Execute arbitrary JavaScript |
| Query DOM elements |
Usage Examples
Screenshot
{
"name": "obsidian_screenshot",
"arguments": { "format": "webp", "quality": 80 }
}Get Console Logs
{
"name": "obsidian_console",
"arguments": { "limit": 20, "type": "error" }
}Execute JavaScript
{
"name": "obsidian_eval",
"arguments": {
"code": "app.workspace.getActiveFile()?.path"
}
}Search Files
{
"name": "obsidian_search",
"arguments": { "query": "mcp", "limit": 10 }
}Search Files in Specific Folder
{
"name": "obsidian_search",
"arguments": { "query": "config", "path": "技术/kubernetes", "limit": 10 }
}Search Folders
{
"name": "obsidian_search_folders",
"arguments": { "query": "work", "limit": 10 }
}Environment Variables
Variable | Default | Description |
|
| Obsidian debug port |
Troubleshooting
Obsidian not found
Make sure Obsidian is running in debug mode:
curl http://localhost:9222/jsonShould return JSON containing Obsidian page information.
Connection refused
Check if the port is correct, or if Obsidian is blocked by firewall.
License
MIT
Available Tools
42 toolsobsidian_apply_templateB
Apply a template to the current file or create a new file from template.
Inputs: template (required), target.
obsidian_consoleA
Get console output from Obsidian. Useful for debugging plugins and monitoring activity.
When to use proactively:
User reports plugin errors or unexpected behavior
After executing commands that might fail silently
When troubleshooting Obsidian issues
To check for warnings after file/plugin operations
Supports multiple filters that can be combined:
type: Filter by log level (log/warn/error/info/debug)
pattern: Regex to match message content
since: Only messages after this timestamp
Inputs: type, clear, limit, since, +1 more.
obsidian_create_folderC
Create a new folder in the vault.
Inputs: path (required).
obsidian_delete_fileB
Delete a file or folder (moves to system trash by default).
Inputs: path (required), permanent.
obsidian_disable_pluginC
Disable an installed plugin.
Inputs: plugin_id (required).
obsidian_dom_queryC
Query DOM elements in Obsidian UI. Useful for inspecting UI state.
Inputs: selector (required), all, attribute.
obsidian_enable_pluginB
Enable an installed plugin.
Inputs: plugin_id (required).
obsidian_evalA
Execute JavaScript code in Obsidian with full API access.
WHEN TO USE:
Operations not covered by other tools
Complex queries combining multiple APIs
Custom automation workflows
COMMON PATTERNS:
Get active file: app.workspace.getActiveFile()
Read file: await app.vault.read(file)
Modify file: await app.vault.modify(file, content)
Get metadata: app.metadataCache.getFileCache(file)
Execute command: app.commands.executeCommandById('cmd-id')
Access plugin: app.plugins.plugins['plugin-id']
NOTE: Code runs in Obsidian's context. Use 'return' for values. Promises are auto-awaited.
Inputs: code (required), await_promise.
obsidian_execute_commandC
Execute an Obsidian command by its ID.
Inputs: command_id (required).
obsidian_get_active_fileB
Get information about the currently active file in Obsidian.
Inputs: no named parameters.
obsidian_get_all_propertiesB
Get all property names used across the vault with their types and usage count.
Inputs: no named parameters.
obsidian_get_backlinksB
Get all backlinks (incoming links) for a file. Returns files that link to the specified file.
Inputs: path (required).
obsidian_get_cursor_positionB
Get the current cursor position in the active editor.
Inputs: no named parameters.
obsidian_get_frontmatterB
Get the frontmatter (YAML metadata) of a file.
Inputs: path (required).
obsidian_get_outlinksA
Get all outgoing links from a file. Returns files that the specified file links to.
Inputs: path (required).
obsidian_get_plugin_settingsC
Get the settings/configuration of an installed plugin.
Inputs: plugin_id (required).
obsidian_get_selectionB
Get the currently selected text in the active editor.
Inputs: no named parameters.
obsidian_get_tagsA
Get all tags in the vault with their usage count, or get tags for a specific file.
Inputs: path.
obsidian_get_vault_infoB
Get information about the current Obsidian vault.
Inputs: no named parameters.
obsidian_insert_at_cursorB
Insert text at the current cursor position in the active editor.
Inputs: text (required).
obsidian_install_pluginC
Install a plugin from the Obsidian community plugin repository.
Inputs: plugin_id (required), enable.
obsidian_list_commandsC
List all available Obsidian commands.
Inputs: filter.
obsidian_list_folderC
List contents of a folder in the vault.
Inputs: path, recursive.
obsidian_list_pluginsB
List all installed plugins and their status.
Inputs: enabled_only.
obsidian_list_templatesB
List all available templates in the templates folder.
Inputs: no named parameters.
obsidian_move_fileC
Move or rename a file/folder in the vault.
Inputs: to (required), from (required).
obsidian_open_fileC
Open a file in Obsidian.
Inputs: path (required), new_leaf.
obsidian_patch_fileA
Apply partial edits to a file using search and replace. More efficient than write_file for small changes as it doesn't require sending the entire file content.
IMPORTANT: Before calling this tool, you MUST first output a diff visualization in your response to show the user what changes will be made. Use this format:
- old line to be removed
+ new line to be addedThis helps the user understand the changes before they are applied.
Inputs: path (required), patches (required).
obsidian_rag_analyticsA
Get RAG search analytics data for monitoring and optimization.
Returns:
Search quality metrics (avg click rank, no-click rate, first-click rate)
Weekly trends for tracking improvement over time
Synonym suggestions based on user behavior
Low-performing queries that need optimization
Use this to:
Monitor search effectiveness
Discover missing synonyms
Identify queries that need improvement
Requires obsidian-long plugin with ragModule to be installed and enabled.
Inputs: days, format.
obsidian_rag_searchA
Semantic search for finding notes by meaning, not exact keywords.
WHEN TO USE:
Concept/idea search: "DNS 解析原理", "容器网络排障经验"
Cross-language: Chinese query finds English content
Vague memory: "之前遇到的超时问题"
WHEN NOT TO USE:
Finding specific file by name → use obsidian_search
Single generic term (e.g., "kubernetes", "网络") → ASK USER first
QUERY GUIDELINES:
Good: "CoreDNS 解析失败排查" (specific problem)
Bad: "DNS" (too broad, ask user to clarify)
Rule: If query < 4 characters or is a single common term, clarify first
RESPONSE FORMAT:
score: 0-100, higher = more relevant (>70 usually reliable)
path: file path in vault
title: note title
tags: optional, note tags
Returns top 5 results by default. Use limit parameter to adjust.
Inputs: query (required), limit.
obsidian_read_fileC
Read the content of a file from the Obsidian vault.
Inputs: path (required).
obsidian_replace_selectionC
Replace the currently selected text in the active editor.
Inputs: text (required).
obsidian_resolve_linkC
Resolve a wiki link to its actual file path.
Inputs: link (required), source.
obsidian_screenshotA
Take a screenshot of the current Obsidian window. Saves to a temp file and returns the file path. Use webp format for best compression.
Inputs: format, quality.
obsidian_searchA
Search for files by path/name. Fast, exact matching.
WHEN TO USE:
Know exact file name: "DNS 解析.md", "202312 工单"
Find by path pattern: "1_projects/", "4_archives/2024"
Filename contains keywords: "CoreDNS", "排障记录"
WHEN NOT TO USE:
Search by concept/meaning → use obsidian_rag_search
Vague memory ("那个DNS问题") → use obsidian_rag_search
MATCHING:
Case-insensitive substring match on full path
"dns" matches "DNS解析.md", "1_projects/dns-debug/notes.md"
Returns up to 20 files by default. Use path parameter to narrow scope.
Inputs: query (required), path, limit.
obsidian_search_by_tagC
Search for files containing a specific tag.
Inputs: tag (required), include_nested.
obsidian_search_community_pluginsB
Search for plugins in the Obsidian community plugin repository.
Inputs: query (required), limit.
obsidian_search_foldersA
Search for folders by name/path. Fast, exact matching.
WHEN TO USE:
Find folder to move files into
Check if folder exists before creating
Navigate vault structure
MATCHING:
Case-insensitive substring match
"project" matches "1_projects", "old-projects/2024"
Returns up to 20 folders by default.
Inputs: query (required), limit.
obsidian_set_plugin_settingsC
Update the settings/configuration of an installed plugin.
Inputs: settings (required), plugin_id (required).
obsidian_uninstall_pluginC
Uninstall a plugin from Obsidian.
Inputs: plugin_id (required).
obsidian_update_frontmatterC
Update frontmatter properties of a file. Can add, modify, or delete properties.
Inputs: path (required), properties (required).
obsidian_write_fileC
Write or update content to a file in the Obsidian vault.
Inputs: path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
The tools are grouped by clear resources (files, folders, editor, plugins, search, UI), and descriptions explicitly distinguish search vs RAG search and write vs patch vs selection editing. A few adjacent operations (write_file/patch_file/apply_template, the several search variants) could still be confused by a hurried agent, but boundaries are mostly clear.
All tools use the obsidian_ prefix and snake_case, which is highly consistent. Most names are verb_noun, but noun/action names like screenshot, console, eval, rag_analytics, and dom_query are minor deviations from a strict verb_noun pattern.
42 tools is far above the practical range for a single MCP server and risks overwhelming an agent's tool selection. While Obsidian is broad, the surface is large enough that several tools could be consolidated or organized into narrower scopes.
Coverage is broad: file/folder CRUD, metadata/frontmatter, tags, links, templates, plugin lifecycle, commands, search/RAG, UI inspection, and a JS eval fallback are present. Minor gaps remain (e.g., setting cursor position or explicit note-level metadata operations), but most core workflows are covered.
Maintenance
Related MCP Connectors
Hosted MCP server for Obsidian Sync vaults: read, search, edit notes. Not affiliated with Obsidian.
Notes, files, GitHub, and Drive through one MCP connection.
Notes, files, GitHub, and Drive through one MCP connection.
Notes, files, GitHub, and Drive through one MCP connection.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables external applications to interact with an Obsidian vault through MCP tools, including semantic search and file operations.14AGPL 3.0
- AlicenseNot gradedqualityFmaintenanceEnables MCP-based operations on an Obsidian vault, including reading, editing, and custom script tools.BSD Zero Clause
- AlicenseNot gradedqualityDmaintenanceConnects to Obsidian's Electron process via Chrome DevTools Protocol, enabling AI assistants to screenshot, execute JavaScript, capture console logs, and automate UI actions for debugging plugins and testing layouts.ISC
- AlicenseAqualityBmaintenanceControls a running Chrome/Chromium browser via the Chrome DevTools Protocol, enabling navigation, JavaScript evaluation, tab management, and raw CDP commands through MCP tools.10MIT