### Install cloudflared for Windows Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Install the cloudflared command-line tool on Windows using winget. ```bash # Windows winget install Cloudflare.cloudflared ``` -------------------------------- ### Example Dataview Queries Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Common Dataview Query Language (DQL) examples for listing notes, tables, and grouping. ```sql -- List notes with a tag LIST FROM #project -- Table of tasks TABLE file.name, due, status FROM "Tasks" WHERE !completed -- Notes modified today LIST FROM "" WHERE file.mday = date(today) -- Count notes by folder TABLE length(rows) as Count FROM "" GROUP BY file.folder ``` -------------------------------- ### Build Connect MCP Plugin Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Commands to install dependencies and build the plugin for manual installation. ```bash npm install npm run build ``` -------------------------------- ### Get Dataview Reference Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Returns a Markdown DQL syntax quick-reference sheet. When Dataview is not installed, returns installation instructions instead. ```APIDOC ## MCP Resource: `obsidian://dataview-reference` ### Description Returns a Markdown DQL syntax quick-reference sheet. When Dataview is not installed, returns installation instructions instead. ### Method `resources/read` ### Parameters #### Arguments - **uri** (string) - Required - The URI of the resource to read, in this case `obsidian://dataview-reference`. ### Request Example ```bash curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":4,"method":"resources/read","params":{"uri":"obsidian://dataview-reference"}}' ``` ### Response #### Success Response - Returns Markdown text with DQL syntax reference (LIST, TABLE, TASK, CALENDAR, FROM, WHERE, SORT, LIMIT, built-in fields, functions, and examples). ``` -------------------------------- ### Install cloudflared for macOS Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Install the cloudflared command-line tool on macOS using Homebrew. ```bash # macOS brew install cloudflared ``` -------------------------------- ### Manual Plugin Installation for Testing Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Provides instructions for manually installing a plugin by copying its build artifacts into the Obsidian plugins directory for testing purposes. ```plaintext /.obsidian/plugins// ``` -------------------------------- ### Install Project Dependencies with npm Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Installs all necessary packages defined in the package.json file. This is a prerequisite for building and developing the plugin. ```bash npm install ``` -------------------------------- ### Start Development Server with Watch Mode Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Starts a development server that automatically rebuilds the plugin when source files change. Useful for rapid iteration during development. ```bash npm run dev ``` -------------------------------- ### Install cloudflared for Linux Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Install the cloudflared command-line tool on Debian/Ubuntu based Linux distributions. ```bash # Linux (Debian/Ubuntu) curl -L https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/cloudflare-archive-keyring.gpg] https://pkg.cloudflare.com/cloudflared $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflared.list sudo apt update && sudo apt install cloudflared ``` -------------------------------- ### Example Plugin File Structure Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Illustrates a recommended organization for plugin source files, separating concerns into different modules. ```plaintext src/ main.ts # Plugin entry point, lifecycle management settings.ts # Settings interface and defaults commands/ # Command implementations command1.ts command2.ts ui/ # UI components, modals, views modal.ts view.ts utils/ # Utility functions, helpers helpers.ts constants.ts types.ts # TypeScript interfaces and types ``` -------------------------------- ### Install ESLint for Linting Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Installs the ESLint tool globally, which is used for analyzing and enforcing code style and quality. ```bash npm install -g eslint ``` -------------------------------- ### Fetch Dataview Reference Resource Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Retrieves a Markdown DQL syntax quick-reference sheet using `resources/read` with the `obsidian://dataview-reference` URI. Provides installation instructions if Dataview is not installed. ```bash curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":4,"method":"resources/read","params":{"uri":"obsidian://dataview-reference"}}' # Returns Markdown text with DQL syntax reference (LIST, TABLE, TASK, CALENDAR, FROM, WHERE, SORT, LIMIT, built-in fields, functions, and examples) ``` -------------------------------- ### Test HTTP Endpoints for Prompts Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/prompts.md Examples for listing all available prompts and retrieving the content of a specific prompt using cURL. ```bash # List prompts curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:27124/prompts ``` ```bash # Get specific prompt curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:27124/prompts/gtd ``` -------------------------------- ### Prompt Note Format Example Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/prompts.md Defines the structure for prompt notes, including optional frontmatter for descriptions and the main prompt content. ```markdown --- description: Short description shown in prompt list --- Your prompt content here with DQL examples, instructions, etc. ``` -------------------------------- ### Create Quick Cloudflare Tunnel Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Start a temporary Cloudflare tunnel for remote access without a Cloudflare account. ```bash cloudflared tunnel --url http://localhost:27124 ``` -------------------------------- ### Get Prompt Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Fetches the content of a specific prompt by its name. ```APIDOC ## MCP Prompts (Vault Context Files) ### Description Markdown files placed in the configured `promptsFolder` (default: `prompts/`) are exposed as MCP prompts. Agents can list and fetch them to understand vault structure and conventions. The `description` frontmatter field is shown in the prompt listing. ### Method `prompts/get` ### Parameters #### Arguments - **name** (string) - Required - The name of the prompt to fetch. ### Request Example ```bash curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":6,"method":"prompts/get","params":{"name":"vault-guide"}}' ``` ### Response #### Success Response - Returns the Markdown content of the specified prompt file. ``` -------------------------------- ### MCP Endpoint Info (`GET /mcp`) Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Retrieves a description of the MCP endpoint. Authentication is required. ```bash curl http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" # { # "message": "MCP endpoint active", # "usage": "POST /mcp with MCP protocol messages", # "protocol": "Model Context Protocol", # "transport": "HTTP" # } ``` -------------------------------- ### Health Check Endpoint (`GET /health`) Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use this endpoint to verify the MCP server is running and to get the plugin and vault names. It does not require authentication. ```bash curl http://localhost:27124/health # { # "status": "ok", # "plugin": "obsidian-connect-mcp", # "vault": "My Vault" # } ``` -------------------------------- ### Get MCP Server Information Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Retrieve information about the MCP server, such as its version and capabilities. ```bash curl http://localhost:27124/mcp ``` -------------------------------- ### Copy Plugin Files to Vault Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Commands to copy the built plugin files to the Obsidian plugins directory for manual installation. ```bash mkdir -p /path/to/vault/.obsidian/plugins/connect-mcp cp main.js manifest.json styles.css /path/to/vault/.obsidian/plugins/connect-mcp/ ``` -------------------------------- ### Run MCP Development Watch Mode Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Start the MCP development server in watch mode to automatically recompile on file changes. ```bash npm run dev # Watch mode ``` -------------------------------- ### Execute Templater Commands via MCP Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Example usage of MCP tools to list available Templater commands filtered by a keyword and execute a specific Templater template on the active note. ```markdown # List available wine commands command_list with filter: "wine" # Execute consume template on active bottle note command_execute with commandId: "templater-obsidian:apps/templater/wine/consume.md" ``` -------------------------------- ### Execute Obsidian Command with MCP Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use the `command_execute` tool to run any registered Obsidian command. Requires `allowCommandExecution: true` in settings and write mode. Shows example calls and responses. ```jsonc // MCP tool call { "name": "command_execute", "arguments": { "commandId": "templater-obsidian:apps/templater/wine/consume.md" } } ``` ```jsonc // Success response { "executed": true, "commandId": "templater-obsidian:apps/templater/wine/consume.md", "commandName": "Templater: Run: apps/templater/wine/consume.md" } ``` ```jsonc // Error – command not found { "isError": true, "content": [{ "type": "text", "text": "Command not found: bad:command. Use command_list to see available commands." }] } ``` -------------------------------- ### active_note Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Get the currently open note in Obsidian. ```APIDOC ## active_note ### Description Get the currently open note in Obsidian. ### Input Schema This tool does not require any input parameters. ### Returns - **path** (string) - The path to the active note. - **content** (string) - The content of the active note. - **frontmatter** (object) - The frontmatter of the active note. - **null** - If no note is currently open. ``` -------------------------------- ### Get Specific Prompt Content Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/prompts.md Retrieves the full content of a specific prompt by its name. ```APIDOC ## GET /prompts/:name ### Description Returns the full content of a specific prompt. ### Method GET ### Endpoint /prompts/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the prompt to retrieve. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **content** (string) - The full markdown content of the prompt. #### Response Example { "content": "---\ndescription: Get Things Done workflow queries\n---\n\nUse these DQL queries for GTD workflow..." } ``` -------------------------------- ### Run Persistent Cloudflare Tunnel Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Start the configured named Cloudflare tunnel to maintain a persistent remote access connection. ```bash cloudflared tunnel run obsidian-mcp ``` -------------------------------- ### MCP Verification with Curl Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Commands to verify the MCP installation and health using curl. Includes a health check and an MCP info endpoint. ```bash # Health check curl http://localhost:27124/health ``` ```bash # MCP info curl http://localhost:27124/mcp ``` -------------------------------- ### dataview_query Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Executes a Dataview Query Language (DQL) query. Requires the Dataview plugin to be installed and enabled. Returns structured results for LIST, TABLE, and TASK query types. ```APIDOC ## MCP Tool: `dataview_query` Executes a Dataview Query Language (DQL) query. Requires the Dataview plugin to be installed and enabled. Returns structured results for LIST, TABLE, and TASK query types. ### Example: TABLE query ```json { "name": "dataview_query", "arguments": { "query": "TABLE status, due-date, priority FROM \"projects\" WHERE status != \"completed\" SORT priority DESC" } } ``` ### Example Response (TABLE query) ```json { "type": "table", "headers": ["File", "status", "due-date", "priority"], "rows": [ [{ "type": "link", "path": "projects/website.md", "display": "website" }, "active", { "type": "date", "value": "2025-02-01T00:00:00.000Z" }, "high"] ] } ``` ### Example: TASK query ```json { "name": "dataview_query", "arguments": { "query": "TASK FROM \"Tasks\" WHERE !completed AND file.ctime > date(today) - dur(7 days)" } } ``` ### Example Response (TASK query) ```json { "type": "task", "tasks": [ { "type": "task", "text": "Review PR #42", "completed": false, "path": "Tasks/2025-01-30.md", "line": 5 } ] } ``` ``` -------------------------------- ### Get Active Note Details with active_note Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use 'active_note' to retrieve the content, frontmatter, cursor position, and selection of the currently open Obsidian note. No arguments are required. ```jsonc // MCP tool call (no arguments required) { "name": "active_note", "arguments": {} } ``` ```jsonc // Example response { "active": true, "path": "daily/2025-01-30.md", "content": "# 2025-01-30\n\n## Tasks\n- [ ] Write release notes\n", "frontmatter": null, "cursor": { "line": 4, "ch": 22 }, "selection": "Write release notes" } ``` ```jsonc // No note open { "active": false, "message": "No note is currently open" } ``` -------------------------------- ### Read Obsidian Vault Info Resource Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Fetches static vault metadata using the `resources/read` method with the `obsidian://vault-info` URI. Includes example JSON-RPC request and the decoded resource content. ```bash # Via raw MCP JSON-RPC curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":3,"method":"resources/read","params":{"uri":"obsidian://vault-info"}}' ``` ```json # Decoded resource content { "vault": "My Vault", "plugin": "obsidian-connect-mcp", "version": "1.0.0", "stats": { "markdownFiles": 312, "totalFiles": 398, "folders": 24 }, "dataviewEnabled": true } ``` -------------------------------- ### Get Backlinks and Forward Links with graph_links Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use 'graph_links' to obtain a sorted list of backlinks and forward links for a given note, respecting '.mcpignore' rules. ```jsonc // MCP tool call { "name": "graph_links", "arguments": { "path": "projects/active/website.md" } } ``` ```jsonc // Example response { "path": "projects/active/website.md", "backlinks": ["daily/2025-01-28.md", "projects/index.md"], "forwardLinks": ["people/alice.md", "projects/active/design-spec.md"] } ``` -------------------------------- ### MCP Endpoint Info Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt The GET /mcp endpoint provides information about the Model Context Protocol (MCP) endpoint. Authentication is required to access this endpoint. ```APIDOC ## GET /mcp — MCP Endpoint Info Returns a human-readable description of the MCP endpoint. Authentication is required. ### Method GET ### Endpoint /mcp ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Response #### Success Response (200) - **message** (string) - Confirmation that the MCP endpoint is active. - **usage** (string) - Instructions on how to use the endpoint (e.g., "POST /mcp with MCP protocol messages"). - **protocol** (string) - The name of the protocol being used (e.g., "Model Context Protocol"). - **transport** (string) - The transport mechanism (e.g., "HTTP"). ### Request Example ```bash curl http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response Example ```json { "message": "MCP endpoint active", "usage": "POST /mcp with MCP protocol messages", "protocol": "Model Context Protocol", "transport": "HTTP" } ``` ``` -------------------------------- ### Get Graph Information for a Note with graph_info Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use 'graph_info' to retrieve link statistics for a note without loading its content. This includes inbound/outbound links and tags. ```jsonc // MCP tool call { "name": "graph_info", "arguments": { "path": "projects/active/website.md" } } ``` ```jsonc // Example response { "path": "projects/active/website.md", "inLinks": 4, "outLinks": 7, "unresolvedLinks": 1, "unresolvedLinksList": ["missing-design-doc"], "tags": ["#project", "#web"] } ``` -------------------------------- ### Create Production Build for Plugin Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Bundles the plugin's code and assets into production-ready files. This command should be used before releasing the plugin. ```bash npm run build ``` -------------------------------- ### Manage MCP Prompts (Vault Context Files) Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Markdown files in `promptsFolder` are exposed as MCP prompts. Use `prompts/list` to see available prompts and `prompts/get` to fetch their content. The `description` frontmatter field is displayed in listings. ```markdown --- description: Overview of vault folder structure and naming conventions --- # Vault Guide ## Folder Structure - `projects/` – Active projects with `status` frontmatter (active | waiting | done) - `archive/` – Completed projects - `daily/` – Daily notes in YYYY-MM-DD format - `people/` – Contact notes with `birthday` and `company` fields ## Useful Dataview Queries All incomplete tasks this week: ```dataview TASK FROM "projects" WHERE !completed AND file.ctime > date(today) - dur(7 days) ``` Projects by priority: ```dataview TABLE status, due-date, priority FROM "projects" WHERE status != "done" SORT priority DESC ``` ``` ```bash # List available prompts via MCP curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":5,"method":"prompts/list","params":{}}' # { "prompts": [{ "name": "vault-guide", "description": "Overview of vault folder structure and naming conventions" }] } ``` ```bash # Fetch a specific prompt curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":6,"method":"prompts/get","params":{"name":"vault-guide"}}' ``` -------------------------------- ### List Available Prompts Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/prompts.md Retrieves a list of all available prompts. Each prompt includes its name and a short description extracted from the frontmatter. ```APIDOC ## GET /prompts ### Description Lists available prompts (name + description from frontmatter). ### Method GET ### Endpoint /prompts ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **prompts** (array) - A list of prompt objects, each containing 'name' and 'description'. #### Response Example { "prompts": [ { "name": "gtd", "description": "Get Things Done workflow queries" } ] } ``` -------------------------------- ### Plugin Settings Interface (`DataviewMcpSettings`) Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Defines the default configuration for the MCP server. Runtime settings can be toggled and saved without restarting the server. ```typescript import { DEFAULT_SETTINGS } from "./settings"; // Default configuration const settings: DataviewMcpSettings = { port: 27124, // HTTP port the Express server listens on apiKey: "", // Required – set via "Generate" button or manually autoStart: true, // Start the server automatically when Obsidian opens readOnlyMode: false, // When true, all write operations are blocked allowCommandExecution: false, // Must be true to register command_list / command_execute tools promptsFolder: "prompts", // Vault-relative folder that stores agent prompt files }; // Runtime toggle – no server restart needed plugin.settings.readOnlyMode = true; await plugin.saveSettings(); plugin.updateSecurityMode(); // propagates to the running SecurityManager ``` -------------------------------- ### MCP Prompt Markdown Format Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Define AI agent prompts using markdown files. Include descriptions, folder structures, Dataview queries, and conventions. ```markdown --- description: Brief description the agent sees when listing prompts --- # My Vault Guide ## Folder Structure - `projects/` - Active project notes with status frontmatter - `archive/` - Completed projects - `daily/` - Daily notes in YYYY-MM-DD format ## Useful Queries Find incomplete tasks: ```dataview TASK FROM "projects" WHERE !completed ``` Recent notes: ```dataview LIST FROM "" WHERE file.mtime > date(today) - dur(7 days) SORT file.mtime DESC ``` ## Conventions - Projects use `status` field: active, waiting, done - People notes are in `people/` with `birthday` and `company` fields ``` -------------------------------- ### List Prompts Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Lists available prompts (Markdown files in the configured `promptsFolder`) with their descriptions. ```APIDOC ## MCP Prompts (Vault Context Files) ### Description Markdown files placed in the configured `promptsFolder` (default: `prompts/`) are exposed as MCP prompts. Agents can list and fetch them to understand vault structure and conventions. The `description` frontmatter field is shown in the prompt listing. ### Method `prompts/list` ### Parameters This method does not require any parameters. ### Request Example ```bash curl -s -X POST http://localhost:27124/mcp \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Mcp-Session-Id: " \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":5,"method":"prompts/list","params":{}}' ``` ### Response #### Success Response - **prompts** (array) - An array of prompt objects. - **name** (string) - The name of the prompt. - **description** (string) - The description of the prompt from its frontmatter. ```json { "prompts": [{ "name": "vault-guide", "description": "Overview of vault folder structure and naming conventions" }] } ``` ``` -------------------------------- ### vault_create Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Creates a new note, automatically adding `.md` extension and creating any missing parent folders. ```APIDOC ## vault_create ### Description Creates a new note, automatically adding `.md` extension and creating any missing parent folders. ### Arguments - **path** (string, required) - The desired path for the new note. The `.md` extension will be added automatically. - **content** (string, optional) - The content to write to the new note. Supports Markdown and YAML frontmatter. ### Example Request ```json { "name": "vault_create", "arguments": { "path": "projects/active/new-feature", "content": "---\nstatus: draft\ncreated: 2025-01-30\n---\n\n# New Feature\n\nDescription here." } } ``` ### Example Response ```json { "created": "projects/active/new-feature.md" } ``` ``` -------------------------------- ### Execute Dataview TASK Query with dataview_query Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Execute a Dataview Query Language (DQL) query of type TASK. Requires the Dataview plugin. Returns structured task data. ```jsonc // TASK query { "name": "dataview_query", "arguments": { "query": "TASK FROM \"Tasks\" WHERE !completed AND file.ctime > date(today) - dur(7 days)" } } ``` ```jsonc // Response: { "type": "task", "tasks": [ { "type": "task", "text": "Review PR #42", "completed": false, "path": "Tasks/2025-01-30.md", "line": 5 } ] } ``` -------------------------------- ### Execute Dataview TABLE Query with dataview_query Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Execute a Dataview Query Language (DQL) query of type TABLE. Requires the Dataview plugin. Returns structured table data. ```jsonc // TABLE query { "name": "dataview_query", "arguments": { "query": "TABLE status, due-date, priority FROM \"projects\" WHERE status != \"completed\" SORT priority DESC" } } ``` ```jsonc // Response: { "type": "table", "headers": ["File", "status", "due-date", "priority"], "rows": [ [{ "type": "link", "path": "projects/website.md", "display": "website" }, "active", { "type": "date", "value": "2025-02-01T00:00:00.000Z" }, "high"] ] } ``` -------------------------------- ### Read Vault Note with MCP Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use `vault_read` to get the raw Markdown content and parsed YAML frontmatter of a specific note. Requires the file path as an argument. ```json { "name": "vault_read", "arguments": { "path": "projects/active/website.md" } } ``` ```json { "path": "projects/active/website.md", "content": "---\nstatus: active\ndue: 2025-02-01\n---\n\n# Website Redesign\n\nTask list...", "frontmatter": { "status": "active", "due": "2025-02-01" } } ``` -------------------------------- ### Organize Plugin Code Across Multiple Files Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Structure your plugin by separating lifecycle logic into main.ts, settings into settings.ts, and commands into a dedicated module. This promotes modularity and maintainability. ```typescript import { Plugin } from "obsidian"; import { MySettings, DEFAULT_SETTINGS } from "./settings"; import { registerCommands } from "./commands"; export default class MyPlugin extends Plugin { settings: MySettings; async onload() { this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); registerCommands(this); } } ``` ```typescript export interface MySettings { enabled: boolean; apiKey: string; } export const DEFAULT_SETTINGS: MySettings = { enabled: true, apiKey: "", }; ``` ```typescript import { Plugin } from "obsidian"; import { doSomething } from "./my-command"; export function registerCommands(plugin: Plugin) { plugin.addCommand({ id: "do-something", name: "Do something", callback: () => doSomething(plugin), }); } ``` -------------------------------- ### Client Configuration for MCP Server Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/all-in-one-refactor.md Configure the mcp-remote client to connect to the Obsidian MCP server. Ensure the correct command, arguments, and authentication token are used. ```json { "mcpServers": { "obsidian": { "command": "npx", "args": ["mcp-remote", "http://localhost:27124/mcp"], "env": { "AUTH": "Bearer YOUR_API_KEY" } } } } ``` -------------------------------- ### Vault Create Tool Specification Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Defines the 'vault_create' tool for creating new notes. Requires both 'path' and 'content' properties. ```typescript { name: "vault_create", description: "Create a new note", inputSchema: { type: "object", properties: { path: { type: "string", description: "Note path" }, content: { type: "string", description: "Note content" } }, required: ["path", "content"] } } ``` -------------------------------- ### Dataview Tools Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Functionality for executing Dataview Query Language (DQL) queries. ```APIDOC ## dataview_query ### Description Execute a Dataview Query Language (DQL) query. ### Method Not applicable (Tool Function) ### Parameters #### Query Parameters - **query** (string) - Required - The DQL query to execute. ### Response #### Success Response (200) - **results** (array) - The results of the DQL query. ``` -------------------------------- ### Health Check Endpoint Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt The GET /health endpoint provides a quick way to check if the MCP server is running and retrieve basic information about the plugin and the vault it's connected to. It does not require any authentication. ```APIDOC ## GET /health — Health Check Endpoint Returns the server status and vault name without requiring authentication. Useful for verifying the plugin is running. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - The current status of the server (e.g., "ok"). - **plugin** (string) - The name of the plugin. - **vault** (string) - The name of the Obsidian vault. ### Request Example ```bash curl http://localhost:27124/health ``` ### Response Example ```json { "status": "ok", "plugin": "obsidian-connect-mcp", "vault": "My Vault" } ``` ``` -------------------------------- ### MCP Client Methods Source: https://github.com/joch/obsidian-connect-mcp/blob/master/specs/prompts.md Methods available on the MCP client to interact with prompts. ```APIDOC ## MCP Client Methods ### `listPrompts()` #### Description Calls the `GET /prompts` endpoint to list available prompts. ### `getPrompt(name)` #### Description Calls the `GET /prompts/:name` endpoint to retrieve the full content of a specific prompt. #### Parameters - **name** (string) - Required - The name of the prompt to retrieve. ``` -------------------------------- ### MCP Ignore File Syntax Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Use a .mcpignore file with gitignore-style patterns to block access to sensitive paths or files. ```plaintext # Block private folders private/ journal/ # Block specific files secrets.md ``` -------------------------------- ### MCP Server Dependencies Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Add these dependencies to your project's package.json to include the MCP SDK, Express, and CORS for handling HTTP requests. ```json { "dependencies": { "@modelcontextprotocol/sdk": "^1.25.0", "express": "^5.0.0", "cors": "^2.8.5" }, "devDependencies": { "@types/express": "^5.0.0", "@types/cors": "^2.8.0" } } ``` -------------------------------- ### Create and Run Persistent Cloudflare Tunnel Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Set up a persistent named tunnel for secure HTTPS transport without exposing a port directly to the internet. This requires a Cloudflare account and involves logging in, creating a tunnel, routing DNS, and running the tunnel. ```bash cloudflared tunnel login ``` ```bash cloudflared tunnel create obsidian-mcp ``` ```bash cloudflared tunnel route dns obsidian-mcp obsidian-mcp.yourdomain.com ``` ```bash cloudflared tunnel run obsidian-mcp ``` -------------------------------- ### Create Vault Note with MCP Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use `vault_create` to create a new markdown note. The tool automatically adds the `.md` extension and creates any necessary parent directories. Content can include YAML frontmatter. ```json { "name": "vault_create", "arguments": { "path": "projects/active/new-feature", "content": "---\nstatus: draft\ncreated: 2025-01-30\n---\n\n# New Feature\n\nDescription here." } } ``` ```json { "created": "projects/active/new-feature.md" } ``` -------------------------------- ### command_list Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Lists all registered Obsidian commands (requires `allowCommandExecution: true` in settings). Supports case-insensitive substring filtering on command ID or name. ```APIDOC ## MCP Tool: `command_list` Lists all registered Obsidian commands (requires `allowCommandExecution: true` in settings). Supports case-insensitive substring filtering on command ID or name. ### Example: MCP tool call ```json { "name": "command_list", "arguments": { "filter": "templater" } } ``` ### Example Response ```json { "total": 3, "commands": [ { "id": "templater-obsidian:insert-templater", "name": "Templater: Insert Templater" }, { "id": "templater-obsidian:apps/templater/wine/consume.md", "name": "Templater: Run: apps/templater/wine/consume.md" }, { "id": "templater-obsidian:create-apps/templater/wine/consume.md", "name": "Templater: Create new file from: apps/templater/wine/consume.md" } ] } ``` ``` -------------------------------- ### List Obsidian Commands with command_list Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use 'command_list' to list all registered Obsidian commands, optionally filtering by a substring of the command ID or name. Requires 'allowCommandExecution: true' in settings. ```jsonc // MCP tool call { "name": "command_list", "arguments": { "filter": "templater" } } ``` ```jsonc // Example response { "total": 3, "commands": [ { "id": "templater-obsidian:insert-templater", "name": "Templater: Insert Templater" }, { "id": "templater-obsidian:apps/templater/wine/consume.md", "name": "Templater: Run: apps/templater/wine/consume.md" }, { "id": "templater-obsidian:create-apps/templater/wine/consume.md", "name": "Templater: Create new file from: apps/templater/wine/consume.md" } ] } ``` -------------------------------- ### Configure Persistent Cloudflare Tunnel Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Set up the ingress rules and credentials file for a named Cloudflare tunnel in `~/.cloudflared/config.yml`. ```yaml tunnel: obsidian-mcp credentials-file: ~/.cloudflared/.json ingress: - hostname: obsidian-mcp.yourdomain.com service: http://localhost:27124 - service: http_status:404 ``` -------------------------------- ### Update MCP Client Configuration Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Configure the MCP client to use a specific server, command, arguments, and environment variables. This is useful for directing MCP to a custom endpoint or for setting up authentication. ```json { "mcpServers": { "obsidian": { "command": "npx", "args": [ "mcp-remote", "https://random-words.trycloudflare.com/mcp", "--header", "Authorization:${AUTH}" ], "env": { "AUTH": "Bearer YOUR_API_KEY" } } } } ``` -------------------------------- ### Analyze All Files in Source Directory with ESLint Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Analyzes all TypeScript files within the 'src/' directory for code quality and style adherence. ```bash eslint ./src/ ``` -------------------------------- ### Dataview Query Tool Definition Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Defines a tool for executing Dataview DQL queries. Requires a 'query' string as input. ```typescript { name: "dataview_query", description: "Execute a Dataview DQL query", inputSchema: { type: "object", properties: { query: { type: "string", description: "DQL query (LIST, TABLE, TASK, CALENDAR)" } }, required: ["query"] } } ``` -------------------------------- ### dataview_query Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Execute a Dataview DQL query. ```APIDOC ## dataview_query ### Description Execute a Dataview DQL query. ### Input Schema - **query** (string) - Required - DQL query (LIST, TABLE, TASK, CALENDAR) ``` -------------------------------- ### Execute Obsidian Command Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Executes any registered Obsidian command by its ID. Requires `allowCommandExecution: true` in settings and write mode. Blocked in read-only mode. ```APIDOC ## MCP Tool: `command_execute` ### Description Executes any registered Obsidian command by its ID (requires `allowCommandExecution: true` in settings and write mode). Blocked in read-only mode. ### Method `command_execute` ### Parameters #### Arguments - **commandId** (string) - Required - The ID of the command to execute. ### Request Example ```json { "name": "command_execute", "arguments": { "commandId": "templater-obsidian:apps/templater/wine/consume.md" } } ``` ### Response #### Success Response - **executed** (boolean) - Indicates if the command was executed successfully. - **commandId** (string) - The ID of the executed command. - **commandName** (string) - The name of the executed command. ```json { "executed": true, "commandId": "templater-obsidian:apps/templater/wine/consume.md", "commandName": "Templater: Run: apps/templater/wine/consume.md" } ``` #### Error Response - **isError** (boolean) - Indicates if an error occurred. - **content** (array) - An array of error messages. ```json { "isError": true, "content": [{ "type": "text", "text": "Command not found: bad:command. Use command_list to see available commands." }] } ``` ``` -------------------------------- ### Graph Tools Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Utilities for retrieving information about note links and graph structure. ```APIDOC ## graph_info ### Description Get link statistics for a note. ### Method Not applicable (Tool Function) ### Parameters #### Query Parameters - **path** (string) - Required - Note path ### Response #### Success Response (200) - **inLinks** (number) - Number of incoming links. - **outLinks** (number) - Number of outgoing links. - **unresolvedLinks** (number) - Number of unresolved links. - **tags** (array) - List of tags used in the note. ``` ```APIDOC ## graph_links ### Description Get backlinks and forward links for a note. ### Method Not applicable (Tool Function) ### Parameters #### Query Parameters - **path** (string) - Required - Note path ### Response #### Success Response (200) - **backlinks** (array) - List of notes linking to this note. - **forwardLinks** (array) - List of notes linked from this note. ``` -------------------------------- ### Login to Cloudflare for Named Tunnel Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Authenticate with Cloudflare using the cloudflared CLI to create persistent tunnels. ```bash cloudflared tunnel login ``` -------------------------------- ### Configure Claude Code MCP Server Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md JSON configuration for Claude Code/Desktop to connect to the Obsidian MCP server. Replace YOUR_API_KEY with the key generated in Obsidian settings. ```json { "mcpServers": { "obsidian": { "command": "npx", "args": [ "mcp-remote", "http://localhost:27124/mcp", "--header", "Authorization:${AUTH}" ], "env": { "AUTH": "Bearer YOUR_API_KEY" } } } } ``` -------------------------------- ### Add a Command to the Plugin Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Register a new command with a unique ID, a user-facing name, and a callback function to execute when the command is triggered. Ensure the command ID is stable and not renamed after release. ```typescript this.addCommand({ id: "your-command-id", name: "Do the thing", callback: () => this.doTheThing(), }); ``` -------------------------------- ### List Vault Files with MCP Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use `vault_list` to retrieve a list of markdown files. Supports filtering by path, glob patterns, sorting, and pagination. The response includes folder hierarchy and file metadata. ```json { "name": "vault_list", "arguments": { "path": "projects", // optional – only files under projects/ "pattern": "**/*.md", // optional – glob filter "sort": "modified", // "alphabetical" | "modified" | "created" "limit": 50, // default 100; -1 for all "offset": 0 } } ``` ```json { "folders": ["projects", "projects/active", "projects/archive"], "files": [ { "path": "projects/active/website.md", "mtime": "2025-01-30T10:00:00.000Z", "ctime": "2025-01-01T09:00:00.000Z", "size": 1234 } ], "total": 42, "returned": 50, "offset": 0, "sort": "modified", "hasMore": false } ``` -------------------------------- ### Search Vault Notes with MCP Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Use `vault_search` for full-text searching across vault notes. It returns matching files with snippets of up to 5 lines. For structured metadata searches, prefer `dataview_query`. ```json { "name": "vault_search", "arguments": { "query": "authentication bug", "path": "projects" // optional folder scope } } ``` ```json { "query": "authentication bug", "results": [ { "path": "projects/active/auth-fix.md", "matches": [ "14: Fixed authentication bug in OAuth flow", "27: authentication bug was caused by token expiry" ] } ], "totalMatches": 1, "shown": 1 } ``` -------------------------------- ### Create Named Cloudflare Tunnel Source: https://github.com/joch/obsidian-connect-mcp/blob/master/README.md Create a persistent, named Cloudflare tunnel for a stable remote access URL. ```bash cloudflared tunnel create obsidian-mcp ``` -------------------------------- ### Vault List Tool Specification Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Defines the 'vault_list' tool for listing files and folders. Specify a path to list contents of a specific folder; defaults to the vault root. ```typescript { name: "vault_list", description: "List files and folders in the vault", inputSchema: { type: "object", properties: { path: { type: "string", description: "Folder path (default: root)" } } } } ``` -------------------------------- ### Expose MCP Server via Cloudflare Tunnel Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Create a secure HTTPS tunnel using `cloudflared` to expose the local MCP server to cloud-hosted AI agents without firewall changes. A quick tunnel can be created without a Cloudflare account. ```bash # Quick tunnel (no Cloudflare account needed) cloudflared tunnel --url http://localhost:27124 # Outputs: https://random-words.trycloudflare.com ``` -------------------------------- ### graph_links Source: https://context7.com/joch/obsidian-connect-mcp/llms.txt Returns the full sorted list of backlinks (notes that link to the file) and forward links (notes that the file links to), filtered by `.mcpignore` rules. ```APIDOC ## MCP Tool: `graph_links` Returns the full sorted list of backlinks (notes that link to the file) and forward links (notes that the file links to), filtered by `.mcpignore` rules. ### Example: MCP tool call ```json { "name": "graph_links", "arguments": { "path": "projects/active/website.md" } } ``` ### Example Response ```json { "path": "projects/active/website.md", "backlinks": ["daily/2025-01-28.md", "projects/index.md"], "forwardLinks": ["people/alice.md", "projects/active/design-spec.md"] } ``` ``` -------------------------------- ### Active Note Tool Definition Source: https://github.com/joch/obsidian-connect-mcp/blob/master/docs/plans/2025-01-29-all-in-one-mcp-refactor.md Defines a tool to retrieve information about the currently open note in Obsidian. Returns note path, content, and frontmatter, or null if no note is open. ```typescript { name: "active_note", description: "Get the currently open note in Obsidian", inputSchema: { type: "object", properties: {} } } // Returns: { path: string, content: string, frontmatter: object } or null ``` -------------------------------- ### Analyze Single TypeScript File with ESLint Source: https://github.com/joch/obsidian-connect-mcp/blob/master/AGENTS.md Uses ESLint to analyze the specified TypeScript file for potential issues and style violations. ```bash eslint main.ts ```