Skip to main content
Glama
Obsidian CDP MCP Server

Obsidian CDP MCP Server

Obsidian CDP MCP Server

English | 中文

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=9222

Installation

Using npx (No Installation Required)

You can use npx to run the server directly without installing:

npx obsidian-cdp-mcp

Global Installation

npm install -g obsidian-cdp-mcp

After 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 link

MCP 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

obsidian_get_vault_info

Get vault information

obsidian_get_active_file

Get currently open file

obsidian_read_file

Read file content

obsidian_write_file

Write/create file

obsidian_patch_file

Apply partial edits using search and replace

obsidian_search

Search files by path (supports path param to limit scope)

obsidian_search_folders

Search folders by name or path

obsidian_smart_search

Full-text search with synonym normalization (requires Omnisearch plugin)

obsidian_open_file

Open file

File & Folder Management

Tool

Description

obsidian_list_folder

List folder contents

obsidian_create_folder

Create new folder

obsidian_move_file

Move or rename file/folder

obsidian_delete_file

Delete file/folder

Tool

Description

obsidian_get_backlinks

Get incoming links to a file

obsidian_get_outlinks

Get outgoing links from a file

obsidian_resolve_link

Resolve wiki link to file path

Metadata & Properties

Tool

Description

obsidian_get_tags

Get tags (vault-wide or per file)

obsidian_search_by_tag

Search files by tag (supports nested tags)

obsidian_get_frontmatter

Get file frontmatter/YAML

obsidian_update_frontmatter

Update frontmatter properties

obsidian_get_all_properties

Get all property names in vault

Editor Operations

Tool

Description

obsidian_get_selection

Get selected text

obsidian_replace_selection

Replace selected text

obsidian_insert_at_cursor

Insert text at cursor

obsidian_get_cursor_position

Get cursor position

Templates

Tool

Description

obsidian_list_templates

List available templates

obsidian_apply_template

Apply template to file

Plugins & Commands

Tool

Description

obsidian_list_plugins

List all plugins

obsidian_search_community_plugins

Search community plugin repository

obsidian_install_plugin

Install plugin from community repository

obsidian_enable_plugin

Enable an installed plugin

obsidian_disable_plugin

Disable an installed plugin

obsidian_uninstall_plugin

Uninstall a plugin

obsidian_get_plugin_settings

Get plugin settings

obsidian_set_plugin_settings

Update plugin settings

obsidian_list_commands

List all commands

obsidian_execute_command

Execute command

obsidian_dataview_query

Run Dataview query (requires Dataview plugin)

Debug Capabilities (CDP Exclusive)

Tool

Description

obsidian_screenshot

Capture Obsidian interface (webp/png/jpeg)

obsidian_console

Get console output

obsidian_eval

Execute arbitrary JavaScript

obsidian_dom_query

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

9222

Obsidian debug port

Troubleshooting

Obsidian not found

Make sure Obsidian is running in debug mode:

curl http://localhost:9222/json

Should 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 tools
obsidian_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_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_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 added

This 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_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_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_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

    B3.2/5.0

    Scored across 42 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count2/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers