Skip to main content
Glama
README.md
# mcp-server-obsidian

[![Tests](https://github.com/bazylhorsey/mcp-server-obsidian/actions/workflows/test.yml/badge.svg)](https://github.com/bazylhorsey/mcp-server-obsidian/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/mcp-server-obsidian)](https://www.npmjs.com/package/mcp-server-obsidian)

A Model Context Protocol (MCP) server for [Obsidian](https://obsidian.md/) vaults: notes, search, knowledge graph analysis, canvas, Dataview-style queries, templates and periodic notes. It reads the vault folder directly, so it needs no plugin and works whether or not Obsidian is running.

```json
{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["-y", "mcp-server-obsidian"],
      "env": { "OBSIDIAN_VAULT_PATH": "/path/to/your/vault" }
    }
  }
}
```

This is an independent community project. It is not affiliated with or endorsed by Obsidian. It was called `obsidian-mcp-server` before version 2.0.0; links to the old repository name redirect here.

## šŸ“š Documentation

- **[Quick Start Guide](./docs/QUICKSTART.md)** - Get up and running in 5 minutes
- **[Claude Desktop Setup](./docs/CLAUDE_DESKTOP_SETUP.md)** - Connect to Claude Desktop
- **[Vault Types Explained](./docs/VAULT_TYPES.md)** - Understanding local/remote/API configurations
- **[Testing Guide](./docs/TESTING.md)** - Running tests and contributing
- **[API Documentation](#available-mcp-tools)** - Complete tool reference
- **[Changelog](./CHANGELOG.md)** - What changed in each release
- **[Security Policy](./SECURITY.md)** - Reporting a vulnerability

## Features

### šŸ—‚ļø Multi-Vault Support
- **Local Vaults**: Direct file system access; changes made in Obsidian or by a sync tool are picked up automatically
- **Remote Vaults**: HTTP/REST API integration with a self-hosted server, with periodic sync
- Seamless switching between multiple vaults, each optionally read-only

### šŸ”— Knowledge Graph
- Build and analyze complete knowledge graphs from your notes
- Find related notes based on links, tags, and content similarity
- Analyze graph structure (hubs, orphan notes, clusters)
- Suggest potential links between related notes
- Path finding between notes

### šŸ” Advanced Search
- Full-text search across all notes
- Filter by tags (including nested tags) and folders
- Server-side search for remote vaults that offer it, client-side otherwise

### šŸ“ Note Operations
- Read, create, update, and delete notes
- Parse Obsidian-flavored markdown with frontmatter
- Extract and track internal links, embeds, and tags
- Automatic backlink generation, resolving links the way Obsidian does (`[[Plan]]` finds `Projects/Plan.md`)
- Creating a note never silently replaces an existing one; updating a note keeps its frontmatter

### šŸ“Š Analytics
- Vault statistics (note count, word count, link count)
- Tag usage analysis
- Folder structure insights

### šŸŽÆ Obsidian Integration
- Optional integration with community "Local REST API" plugin
- Open notes directly in Obsidian app
- Execute Obsidian commands
- See which note is currently open
- Access to Obsidian URI protocol
- **Note:** Requires plugin installation and app running locally. Everything else works without the Obsidian app.

### šŸŽØ Canvas Support
- Read and manipulate Obsidian Canvas files
- Create and edit canvas nodes (file, text, link, group)
- Manage canvas edges and connections
- Safe under concurrent edits: several tool calls against one canvas do not overwrite each other
- Programmatic canvas generation

### šŸ“Š Dataview Queries
- SQL-like querying over your notes
- Filter by frontmatter metadata and inline fields
- Sort and group results
- Field selection
- Multiple WHERE conditions, with numbers and dates compared as numbers and dates
- Extract metadata from notes (frontmatter + inline fields)

### šŸ“ Template System
- Dynamic template rendering with variable substitution
- Built-in date/time variables (`{{date}}`, `{{time}}`, `{{weekday}}`, etc.)
- Custom variable support
- Default values (`{{variable|default}}`)
- Date formatting (`{{date:YYYY-MM-DD}}`)
- Frontmatter merging
- Create notes from templates programmatically

### šŸ“… Periodic Notes
- Daily, weekly, monthly, and yearly notes
- Automatic date-based naming and organization
- Custom templates for each note type
- Date range calculations
- List and query periodic notes
- Configurable folder structure and formats; daily notes follow Obsidian's own Daily notes settings when nothing is configured

## Architecture

The server is built with a clean, modular architecture:

```
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│           MCP Server Layer              │
│  (Tools, Resources, Protocol Handling)  │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
               │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│        Service Layer                     │
│  • Knowledge Graph Service               │
│  • Canvas Service                        │
│  • Dataview Service                      │
│  • Template Service                      │
│  • Periodic Notes Service                │
│  • Configuration Management              │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
               │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│        Connector Layer (Adapters)        │
│  • Local Vault Connector (File System)  │
│  • Remote Vault Connector (HTTP API)    │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
               │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│        Integration Layer                 │
│  • Obsidian API Client                   │
│  • Markdown Parser                       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
```

### Key Design Patterns

- **Adapter Pattern**: Abstract `BaseConnector` interface allows seamless switching between local and remote vaults
- **Service Layer**: Separates business logic (knowledge graph) from data access
- **Configuration Management**: Flexible config from files, environment, or defaults
- **Always current**: Local vaults are re-checked against the folder (file size and modification time) before answering; remote vaults sync periodically

## Installation

Requires Node.js 22.13 or newer. There is nothing to install by hand: an MCP client starts the server with `npx`, which downloads it on first use.

```json
{
  "mcpServers": {
    "obsidian": {
      "command": "npx",
      "args": ["-y", "mcp-server-obsidian"],
      "env": {
        "OBSIDIAN_VAULT_PATH": "/path/to/your/vault"
      }
    }
  }
}
```

With Claude Code:

```bash
claude mcp add obsidian -e OBSIDIAN_VAULT_PATH=/path/to/your/vault -- npx -y mcp-server-obsidian
```

See [Claude Desktop Setup](./docs/CLAUDE_DESKTOP_SETUP.md) for a walk-through. To install the `mcp-server-obsidian` command instead of using `npx`:

```bash
npm install -g mcp-server-obsidian
```

### From source

```bash
git clone https://github.com/bazylhorsey/mcp-server-obsidian.git
cd mcp-server-obsidian
npm install
npm run build
node dist/index.js --help
```

## Configuration

One local vault needs no file: set `OBSIDIAN_VAULT_PATH` as shown above. For several vaults or any other option, create an `obsidian-mcp.json` configuration file, for example at `~/.obsidian-mcp.json`:

```json
{
  "vaults": [
    {
      "name": "my-local-vault",
      "type": "local",
      "path": "/path/to/obsidian/vault"
    },
    {
      "name": "my-cloud-vault",
      "type": "remote",
      "url": "https://your-sync-server.com/api",
      "apiKey": "your-api-key",
      "syncInterval": 60000
    }
  ],
  "obsidianApi": {
    "restApiUrl": "http://127.0.0.1:27123",
    "apiKey": "your-api-key",
    "vaultName": "my-local-vault"
  }
}
```

### Where the configuration is read from

The first of these that exists is used:

1. the file given with `--config <file>`
2. the file named by the `OBSIDIAN_MCP_CONFIG` environment variable
3. `obsidian-mcp.json` in the current working directory
4. `obsidian-mcp.json` next to the server (the folder that contains `dist/`; useful when running from source)
5. `~/.obsidian-mcp.json`
6. the environment variables below

MCP clients such as Claude Desktop start the server from a working directory of their own, so option 1, 2 or 5 is the reliable choice there (option 4 too when running from source).

A configuration file that exists but is invalid stops the server with an explanation; it is never skipped in favour of the next location.

### Vault options

| Option | Vaults | Meaning |
|---|---|---|
| `name` | all | Name used in the `vault` argument of every tool. Must be unique. |
| `type` | all | `"local"` or `"remote"`. |
| `path` | local | Vault folder. `~` is expanded; a relative path is relative to the config file. |
| `url`, `apiKey` | remote | Base URL of the sync server and its bearer token. |
| `syncInterval` | remote | Milliseconds between re-reads of the remote vault. |
| `readOnly` | all | `true` refuses every tool that would create, change or delete something. |
| `allowSymlinksOutsideVault` | local | `true` follows symbolic links that lead out of the vault folder. Off by default. |
| `rescanIntervalMs` | local | Minimum time between checks of the folder for outside changes. Default `1000`. |
| `periodicNotes`, `templates` | local | Per-vault versions of the top-level sections of the same name. |

### Vault Types Explained

**Local Vault (`type: "local"`)**
- Direct filesystem access to your Obsidian vault folder
- Fastest performance, always reflects what is on disk
- Use this for vaults stored on your computer or mounted network drives
- Does not need Obsidian: any folder of Markdown files works, including [Foam](https://foambubble.github.io/) workspaces

**Remote Vault (`type: "remote"`)**
- Connects to a self-hosted sync server via HTTP/REST API
- For vaults hosted on your own cloud infrastructure (not Obsidian's sync service)
- Requires a server that implements the small REST contract described in [Vault Types Explained](./docs/VAULT_TYPES.md#the-remote-vault-rest-contract)

**Obsidian API (Optional)**
- Only needed if you want to control the Obsidian desktop app
- Requires the "Local REST API" community plugin in Obsidian
- Enables: Opening notes in app, executing commands, reading the active note
- NOT used for reading/writing vault content (use local/remote vaults for that)

### Configuration via Environment Variables

Alternatively, use environment variables:

```bash
# Local vault
export OBSIDIAN_VAULT_PATH="/path/to/vault"
export OBSIDIAN_VAULT_NAME="my-vault"
export OBSIDIAN_READ_ONLY="true"   # optional

# Remote vault
export OBSIDIAN_REMOTE_URL="https://your-sync-server.com/api"
export OBSIDIAN_REMOTE_NAME="cloud"
export OBSIDIAN_REMOTE_API_KEY="your-key"
export OBSIDIAN_SYNC_INTERVAL="60000"

# Obsidian API (optional)
export OBSIDIAN_API_URL="http://127.0.0.1:27123"
export OBSIDIAN_API_KEY="your-key"
```

### Common Configuration Scenarios

**Scenario 1: Just a local vault (most common)**
```json
{
  "vaults": [
    {
      "name": "personal",
      "type": "local",
      "path": "/home/user/Documents/ObsidianVault"
    }
  ]
}
```

**Scenario 2: Local vault + iCloud/Dropbox (also use local type)**
```json
{
  "vaults": [
    {
      "name": "synced",
      "type": "local",
      "path": "/home/user/iCloud/ObsidianVault"
    }
  ]
}
```
Note: iCloud/Dropbox sync is handled by the cloud service itself - just point to the synced folder.

**Scenario 3: Multiple local vaults**
```json
{
  "vaults": [
    {
      "name": "personal",
      "type": "local",
      "path": "/home/user/Documents/PersonalVault"
    },
    {
      "name": "work",
      "type": "local",
      "path": "/home/user/Documents/WorkVault",
      "readOnly": true
    }
  ]
}
```

**Scenario 4: Self-hosted remote server (advanced)**
```json
{
  "vaults": [
    {
      "name": "cloud",
      "type": "remote",
      "url": "https://your-server.com/obsidian-api",
      "apiKey": "your-api-key",
      "syncInterval": 60000
    }
  ]
}
```
Note: Requires you to implement or deploy a compatible REST API server.

## Usage

### Start the Server

An MCP client normally starts the server for you. To run it by hand:

```bash
OBSIDIAN_VAULT_PATH=/path/to/your/vault npx -y mcp-server-obsidian
npx -y mcp-server-obsidian --config /path/to/obsidian-mcp.json
```

From source, `npm start` or `node dist/index.js` does the same.

`npx -y mcp-server-obsidian --help` lists the options. The server speaks MCP on stdin/stdout and logs to stderr; it exits when the client disconnects.

### Available MCP Tools

The server exposes the following tools through the MCP protocol. Every tool takes a `vault` argument; it may be omitted when only one vault is configured.

#### Note Operations
- `get_note` - Retrieve a note by path
- `search_notes` - Search notes with filters
- `create_note` - Create a new note (fails if it exists, unless `overwrite` is set)
- `update_note` - Replace the content of an existing note, keeping its frontmatter unless a new one is given
- `delete_note` - Delete a note permanently

Note paths are relative to the vault and may omit `.md`.

#### Vault Information
- `list_vaults` - List the configured vaults and their status
- `get_vault_stats` - Get vault statistics
- `list_tags` - List all tags
- `list_folders` - List all folders

#### Knowledge Graph
- `get_knowledge_graph` - Get complete graph structure
- `get_related_notes` - Find related notes
- `analyze_graph` - Analyze graph structure
- `suggest_links` - Suggest potential links
- `find_path` - Find the shortest chain of links between two notes

#### Canvas Operations
- `get_canvas` - Read a canvas file
- `create_canvas` - Create a new empty canvas
- `list_canvas_files` - List all canvas files in vault
- `add_canvas_node` - Add a node (file, text, link, or group)
- `add_canvas_edge` - Add an edge/connection between nodes
- `delete_canvas_node` - Delete a node from canvas
- `delete_canvas_edge` - Delete an edge from canvas

#### Dataview Queries
- `dataview_query` - Execute Dataview-style queries on notes
- `get_note_metadata` - Get metadata for a specific note
- `get_unique_values` - Get all unique values for a field

#### Template System
- `list_templates` - List all available templates
- `render_template` - Render a template with variables
- `create_from_template` - Create a new note from a template

#### Periodic Notes
- `create_daily_note` - Create or get daily note
- `create_weekly_note` - Create or get weekly note
- `create_monthly_note` - Create or get monthly note
- `create_yearly_note` - Create or get yearly note
- `get_periodic_note_info` - Get info about a periodic note
- `list_periodic_notes` - List periodic notes in a date range

#### Obsidian App (only when `obsidianApi` is configured)
- `open_in_obsidian` - Open a note in the Obsidian app
- `get_active_note` - Get the note currently open in Obsidian
- `list_obsidian_commands` - List command palette commands
- `execute_obsidian_command` - Run a command palette command

Canvas, template and periodic-note tools work on files and need a local vault.

A tool that fails reports an MCP tool error (`isError`) with `{"error": "..."}`; a tool that succeeds returns its result as JSON.

### MCP Resources

All notes are exposed as resources with URIs:
```
obsidian://{vault-name}/{note-path}
```

Vault names and paths are percent-encoded, so `My Vault/Daily Notes/2024-01-15.md` is `obsidian://My%20Vault/Daily%20Notes/2024-01-15.md`.

## Development

### Project Structure

```
src/
ā”œā”€ā”€ index.ts                      # Command-line entry point
ā”œā”€ā”€ server.ts                     # MCP server: tools and resources
ā”œā”€ā”€ types/                        # TypeScript type definitions
│   ā”œā”€ā”€ index.ts                 # Core types
│   ā”œā”€ā”€ canvas.ts                # Canvas types
│   ā”œā”€ā”€ dataview.ts              # Dataview types
│   ā”œā”€ā”€ template.ts              # Template types
│   └── periodic.ts              # Periodic notes types
ā”œā”€ā”€ connectors/                   # Vault connectors (adapters)
│   ā”œā”€ā”€ BaseConnector.ts
│   ā”œā”€ā”€ LocalConnector.ts
│   └── RemoteConnector.ts
ā”œā”€ā”€ services/                     # Business logic services
│   ā”œā”€ā”€ KnowledgeGraph.ts        # Knowledge graph analysis
│   ā”œā”€ā”€ CanvasService.ts         # Canvas file operations
│   ā”œā”€ā”€ DataviewService.ts       # Dataview query processing
│   ā”œā”€ā”€ TemplateService.ts       # Template rendering
│   └── PeriodicNotesService.ts  # Periodic notes management
ā”œā”€ā”€ api/                          # External API integrations
│   └── ObsidianAPI.ts
└── utils/                        # Utilities
    ā”œā”€ā”€ config.ts                # Configuration loading and validation
    ā”œā”€ā”€ paths.ts                 # Vault path safety
    ā”œā”€ā”€ frontmatter.ts           # YAML frontmatter
    ā”œā”€ā”€ markdown.ts              # Links, tags, note parsing
    ā”œā”€ā”€ links.ts                 # Link resolution and backlinks
    ā”œā”€ā”€ date.ts                  # Calendar dates and formats
    ā”œā”€ā”€ fs.ts                    # Vault walking, file locks
    ā”œā”€ā”€ http.ts                  # HTTP client
    └── errors.ts
```

### Build

```bash
npm run build
```

### Watch Mode

```bash
npm run watch
```

### Checks

```bash
npm run lint          # ESLint
npm run typecheck     # TypeScript, sources and tests
npm test              # Jest
npm run check         # all of the above, with coverage, plus a build
```

### Releasing

1. Set the version in `package.json` (`npm version X.Y.Z --no-git-tag-version`) and in `server.json`, and add a `## [X.Y.Z] - YYYY-MM-DD` section to `CHANGELOG.md`.
2. Commit.
3. Run `npm run release` (or `scripts/release.sh`). It runs the checks, pushes the branch, publishes the package to npm, tags the version and creates the GitHub release with the notes from `CHANGELOG.md`.

`scripts/release.sh --help` lists its options; `--dry-run` shows what it would do without changing anything. It needs `gh` and `npm` to be logged in (`gh auth login`, `npm login`), and it can be run again after a failure: steps that already happened are skipped.

To list a release in the [MCP Registry](https://registry.modelcontextprotocol.io) once it is on npm, publish `server.json` with the registry's own tool: `mcp-publisher login github`, then `mcp-publisher publish`.

## Integration with Obsidian

For advanced features, install the [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) plugin:

1. Install the plugin from Obsidian Community Plugins
2. Enable the plugin and note the API key
3. Either turn on the plugin's plain HTTP server (port 27123) and use `http://127.0.0.1:27123`, or use `https://127.0.0.1:27124` and make Node.js trust the plugin's certificate by setting `NODE_EXTRA_CA_CERTS` to the certificate file downloaded from the plugin settings
4. Configure the `obsidianApi` section in your config

With only `vaultName` set (no `restApiUrl`), `open_in_obsidian` returns an `obsidian://` link instead of opening the note itself.

## Use Cases

### For AI Assistants
- Access and navigate your Obsidian knowledge base
- Create and update notes based on conversations
- Find related information across notes
- Suggest connections between ideas

### For Automation
- Automated note creation and organization
- Batch processing of notes
- Knowledge graph analysis and visualization
- Link maintenance and suggestions

### For Integrations
- Connect Obsidian with other tools via MCP
- Build custom workflows
- Create dashboards and reports
- Sync with external systems

## Advanced Features

### Canvas Support

Obsidian Canvas is a powerful visual workspace. This server provides full programmatic access to create and manipulate canvas files:

**Example: Create a visual mind map**
```typescript
// Create a new canvas
await mcp.callTool('create_canvas', { path: 'diagrams/mindmap.canvas' });

// Add nodes; each call returns the new node, including its id
const idea = await mcp.callTool('add_canvas_node', {
  canvasPath: 'diagrams/mindmap.canvas',
  nodeType: 'file',
  file: 'notes/central-idea.md',
  x: 0, y: 0, width: 400, height: 200
});

const concept = await mcp.callTool('add_canvas_node', {
  canvasPath: 'diagrams/mindmap.canvas',
  nodeType: 'text',
  text: '# Key Concept',
  x: 500, y: 0, width: 300, height: 150,
  color: '1'  // Red; "#rrggbb" also works
});

// Connect nodes with edges, using the ids returned above
await mcp.callTool('add_canvas_edge', {
  canvasPath: 'diagrams/mindmap.canvas',
  fromNode: '<id of the first node>',
  toNode: '<id of the second node>',
  label: 'relates to'
});
```

### Dataview Queries

Query your notes like a database with SQL-like syntax:

**Example: Find recent project notes**
```typescript
await mcp.callTool('dataview_query', {
  from: '#project',
  where: [
    { field: 'status', operator: 'eq', value: 'active' },
    { field: 'modified', operator: 'gte', value: '2024-01-01' }
  ],
  sort: [{ field: 'modified', direction: 'desc' }],
  limit: 10
});
```

**Example: Group notes by status**
```typescript
await mcp.callTool('dataview_query', {
  from: 'projects/',
  groupBy: 'status',
  select: ['modified', 'tags']
});
```

Each result row is the note's `path` and `title` plus its metadata fields. Besides frontmatter and inline fields, every note has `path`, `title`, `tags`, `aliases`, `created` and `modified`.

A date in a filter is a calendar day in the server's time zone. Compared with a time of day it stands for the whole day: `modified` `eq` `2024-01-15` matches every note changed on 15 January, and `lte` includes that day. Give a time (`2024-01-15T14:30`) to compare to the minute.

**Example: Get metadata from inline fields**
```typescript
// Note content: "Status:: In Progress\nPriority:: High"
const metadata = await mcp.callTool('get_note_metadata', {
  path: 'projects/my-project.md'
});
// Returns: { Status: 'In Progress', Priority: 'High', ... }
```

### Template System

Create reusable templates with variable substitution and automatic date handling:

**Example: Create a meeting note template**
```markdown
---
tags: [meeting]
templateVariables:
  - name: attendees
    type: string
    description: Meeting attendees
---

# Meeting: {{title}}

**Date:** {{date}}
**Time:** {{time}}
**Attendees:** {{attendees|TBD}}

## Agenda

-

## Notes

## Action Items

- [ ]
```

**Example: Use the template**
```typescript
await mcp.callTool('create_from_template', {
  templatePath: 'Templates/meeting.md',
  targetPath: 'Meetings/2024-01-15-team-sync.md',
  variables: {
    attendees: 'Alice, Bob, Charlie'
  },
  frontmatter: {
    project: 'Q1 Planning'
  }
});
```

**Built-in Variables:**
- `{{date}}` - Current date (YYYY-MM-DD)
- `{{time}}` - Current time (HH:mm)
- `{{datetime}}` - Current datetime
- `{{year}}`, `{{month}}`, `{{day}}` - Date components
- `{{weekday}}` - Day of week (Monday, Tuesday, etc.)
- `{{week}}` - Week number (01-53)
- `{{title}}`, `{{filename}}`, `{{folder}}` - File context

Formats use [Moment.js tokens](https://momentjs.com/docs/#/displaying/format/), as in Obsidian: `{{date:dddd, MMMM Do}}`, `{{time:HH:mm:ss}}`. Text in `[square brackets]` is literal.

The templates folder and the default formats of `{{date}}` and `{{time}}` are taken from the vault's own Templates plugin settings, or from a `templates` section in the config:

```json
{
  "templates": {
    "folder": "Templates",
    "dateFormat": "YYYY-MM-DD",
    "timeFormat": "HH:mm"
  }
}
```

### Periodic Notes

Automatically create and organize daily, weekly, monthly, and yearly notes:

**Example: Create today's daily note**
```typescript
await mcp.callTool('create_daily_note', {
  vault: 'my-vault'
});
// Creates: Daily Notes/2024-01-15.md
```

**Example: Create this week's note**
```typescript
await mcp.callTool('create_weekly_note', {
  vault: 'my-vault',
  variables: {
    goals: 'Complete project proposal'
  }
});
// Creates: Weekly Notes/2024-W03.md
```

**Example: List all monthly notes**
```typescript
await mcp.callTool('list_periodic_notes', {
  vault: 'my-vault',
  type: 'monthly',
  startDate: '2024-01-01',
  endDate: '2024-12-31'
});
```

Dates are calendar days in the server's time zone: `2024-01-15` is 15 January wherever the server runs.

**Configuration:**
Periodic notes can be configured with custom folders, formats, and templates, for all vaults at the top level of the config or per vault inside a vault entry:
```json
{
  "periodicNotes": {
    "daily": {
      "folder": "Journal/Daily",
      "format": "YYYY-MM-DD",
      "template": "Templates/daily-note.md"
    },
    "weekly": {
      "folder": "Journal/Weekly",
      "format": "GGGG-[W]WW"
    }
  }
}
```

Defaults: `Daily Notes/YYYY-MM-DD`, `Weekly Notes/GGGG-[W]WW`, `Monthly Notes/YYYY-MM`, `Yearly Notes/YYYY`. When daily notes are not configured here and the vault has Obsidian's Daily notes plugin set up, its folder, format and template are used. Week numbers follow ISO 8601; `GGGG` is the year the week belongs to, so the week of 29 December 2025 is `2026-W01`. The locale-dependent tokens `ww` and `gggg` (the default of the Periodic Notes plugin) are treated as `WW` and `GGGG`, so weeks always start on Monday.

## Technical Highlights

### Markdown Parsing
- Full support for Obsidian-flavored markdown
- Frontmatter extraction (YAML, parsed as data only)
- Internal link parsing (`[[link]]`, `[[link|alias]]`, `[[link#heading]]`, relative `[text](note.md)`)
- Embed detection (`![[embed]]`)
- Tag extraction (`#tag`, `#nested/tag`), ignoring code blocks, headings in links and URL fragments
- Inline field parsing (`key:: value` pattern)

### Canvas Operations
- Complete Canvas file format support (JSON-based)
- All node types: file, text, link, group
- Edge/connection management with customization
- Color and styling support
- Programmatic canvas generation

### Dataview Integration
- SQL-like query language for notes
- Multiple filter operators (eq, neq, gt, gte, lt, lte, contains, startsWith, endsWith, exists)
- Sorting and grouping capabilities
- Field selection and projection
- Support for frontmatter and inline fields
- Nested field access with dot notation

### Template System
- Variable substitution with `{{variable}}` syntax
- Built-in date/time variables with formatting
- Default values: `{{variable|default}}`
- Date formatting: `{{date:YYYY-MM-DD}}`
- Frontmatter merging and manipulation
- Template discovery and listing

### Periodic Notes
- Automatic date-based note generation
- Configurable folder structure and naming
- Template integration for custom layouts
- Date range calculations (daily, weekly, monthly, yearly)
- ISO week number support
- Flexible date format patterns

### Link Resolution
- Smart link resolution (file name, path and title based)
- Automatic backlink generation
- Bidirectional link tracking

### Performance
- Notes are indexed in memory; only files whose size or modification time changed are read again
- Folder checks are spaced out (`rescanIntervalMs`)

## Security Considerations

- **Vault boundary**: every path a tool receives is resolved inside the selected vault. Absolute paths, `..` segments and symbolic links that lead out of the vault are refused (the latter unless the vault sets `allowSymlinksOutsideVault`).
- **File types**: note tools only touch `.md` files and canvas tools only `.canvas` files, whatever path they are given.
- **Read-only mode**: `"readOnly": true` on a vault disables every tool that changes it.
- **Frontmatter is data**: YAML is parsed with a data-only schema; nothing in a note is ever executed.
- **No silent overwrites**: creating a note, a canvas or a note from a template fails if the target exists.
- **`delete_note` is permanent**: the file is removed, not moved to a trash folder.
- **Obsidian app tools**: `execute_obsidian_command` can do anything the command palette can. It exists only when `obsidianApi` is configured.
- Remote vaults: Use HTTPS and secure API keys
- API keys: Never commit to version control

To report a vulnerability, see the [Security Policy](./SECURITY.md).

## Requirements

- Node.js 22.13 or higher
- Access to Obsidian vault(s)

## License

MIT. Obsidian is a trademark of its respective owner; this project is independent and not endorsed by it.

## Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

## Related Projects

- [Obsidian](https://obsidian.md/) - The knowledge base application
- [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) - REST API plugin
- [Model Context Protocol](https://modelcontextprotocol.io/) - MCP specification

## Support

For issues and questions:
- GitHub Issues: [Create an issue](https://github.com/bazylhorsey/mcp-server-obsidian/issues)
- Documentation: See this README

---

Built with ā¤ļø for the Obsidian and MCP communities

TDQS

B3.1/5.0

Scored across 37 tools

Disambiguation4/5

Most tools target distinct resources and actions, and descriptions clarify boundaries between similar areas like graph analysis, periodic notes, and canvas editing. A few graph-related tools (get_related_notes, analyze_graph, suggest_links, find_path, get_knowledge_graph) could be confused at a glance, but descriptions reduce ambiguity.

Naming Consistency4/5

The tool set overwhelmingly uses snake_case and predictable verb_noun or noun-based names (list_vaults, create_note, add_canvas_node). Minor deviations like dataview_query and open_in_obsidian are still readable, but they slightly break the otherwise consistent verb-first pattern.

Tool Count2/5

37 tools is well above the typical well-scoped range and makes the server feel overloaded even though it covers several Obsidian subdomains. The breadth is real, but many operations could likely be consolidated or exposed through fewer parameterized tools.

Completeness4/5

Core note CRUD, templates, periodic notes, canvas manipulation, graph analysis, commands, and Dataview queries are covered. There are notable gaps such as listing all notes directly, moving/renaming notes, and managing folders beyond listing, but most workflows can be worked around via search or direct note updates.

Maintenance

ActivityMaintained
ResponsivenessLimited data