mcp-server-obsidian 0.0.0-stage → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/LICENSE +21 -0
  3. package/README.md +819 -2
  4. package/SECURITY.md +56 -0
  5. package/dist/api/ObsidianAPI.d.ts +69 -0
  6. package/dist/api/ObsidianAPI.d.ts.map +1 -0
  7. package/dist/api/ObsidianAPI.js +205 -0
  8. package/dist/api/ObsidianAPI.js.map +1 -0
  9. package/dist/connectors/BaseConnector.d.ts +109 -0
  10. package/dist/connectors/BaseConnector.d.ts.map +1 -0
  11. package/dist/connectors/BaseConnector.js +153 -0
  12. package/dist/connectors/BaseConnector.js.map +1 -0
  13. package/dist/connectors/LocalConnector.d.ts +53 -0
  14. package/dist/connectors/LocalConnector.d.ts.map +1 -0
  15. package/dist/connectors/LocalConnector.js +363 -0
  16. package/dist/connectors/LocalConnector.js.map +1 -0
  17. package/dist/connectors/RemoteConnector.d.ts +33 -0
  18. package/dist/connectors/RemoteConnector.d.ts.map +1 -0
  19. package/dist/connectors/RemoteConnector.js +331 -0
  20. package/dist/connectors/RemoteConnector.js.map +1 -0
  21. package/dist/index.d.ts +10 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +125 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/server.d.ts +61 -0
  26. package/dist/server.d.ts.map +1 -0
  27. package/dist/server.js +831 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/services/CanvasService.d.ts +112 -0
  30. package/dist/services/CanvasService.d.ts.map +1 -0
  31. package/dist/services/CanvasService.js +343 -0
  32. package/dist/services/CanvasService.js.map +1 -0
  33. package/dist/services/DataviewService.d.ts +50 -0
  34. package/dist/services/DataviewService.d.ts.map +1 -0
  35. package/dist/services/DataviewService.js +524 -0
  36. package/dist/services/DataviewService.js.map +1 -0
  37. package/dist/services/KnowledgeGraph.d.ts +86 -0
  38. package/dist/services/KnowledgeGraph.d.ts.map +1 -0
  39. package/dist/services/KnowledgeGraph.js +364 -0
  40. package/dist/services/KnowledgeGraph.js.map +1 -0
  41. package/dist/services/PeriodicNotesService.d.ts +65 -0
  42. package/dist/services/PeriodicNotesService.d.ts.map +1 -0
  43. package/dist/services/PeriodicNotesService.js +309 -0
  44. package/dist/services/PeriodicNotesService.js.map +1 -0
  45. package/dist/services/TemplateService.d.ts +51 -0
  46. package/dist/services/TemplateService.d.ts.map +1 -0
  47. package/dist/services/TemplateService.js +308 -0
  48. package/dist/services/TemplateService.js.map +1 -0
  49. package/dist/types/canvas.d.ts +57 -0
  50. package/dist/types/canvas.d.ts.map +1 -0
  51. package/dist/types/canvas.js +13 -0
  52. package/dist/types/canvas.js.map +1 -0
  53. package/dist/types/dataview.d.ts +60 -0
  54. package/dist/types/dataview.d.ts.map +1 -0
  55. package/dist/types/dataview.js +5 -0
  56. package/dist/types/dataview.js.map +1 -0
  57. package/dist/types/index.d.ts +122 -0
  58. package/dist/types/index.d.ts.map +1 -0
  59. package/dist/types/index.js +12 -0
  60. package/dist/types/index.js.map +1 -0
  61. package/dist/types/periodic.d.ts +45 -0
  62. package/dist/types/periodic.d.ts.map +1 -0
  63. package/dist/types/periodic.js +31 -0
  64. package/dist/types/periodic.js.map +1 -0
  65. package/dist/types/template.d.ts +63 -0
  66. package/dist/types/template.d.ts.map +1 -0
  67. package/dist/types/template.js +5 -0
  68. package/dist/types/template.js.map +1 -0
  69. package/dist/utils/config.d.ts +65 -0
  70. package/dist/utils/config.d.ts.map +1 -0
  71. package/dist/utils/config.js +290 -0
  72. package/dist/utils/config.js.map +1 -0
  73. package/dist/utils/date.d.ts +64 -0
  74. package/dist/utils/date.d.ts.map +1 -0
  75. package/dist/utils/date.js +483 -0
  76. package/dist/utils/date.js.map +1 -0
  77. package/dist/utils/errors.d.ts +16 -0
  78. package/dist/utils/errors.d.ts.map +1 -0
  79. package/dist/utils/errors.js +27 -0
  80. package/dist/utils/errors.js.map +1 -0
  81. package/dist/utils/frontmatter.d.ts +58 -0
  82. package/dist/utils/frontmatter.d.ts.map +1 -0
  83. package/dist/utils/frontmatter.js +124 -0
  84. package/dist/utils/frontmatter.js.map +1 -0
  85. package/dist/utils/fs.d.ts +50 -0
  86. package/dist/utils/fs.d.ts.map +1 -0
  87. package/dist/utils/fs.js +177 -0
  88. package/dist/utils/fs.js.map +1 -0
  89. package/dist/utils/http.d.ts +41 -0
  90. package/dist/utils/http.d.ts.map +1 -0
  91. package/dist/utils/http.js +122 -0
  92. package/dist/utils/http.js.map +1 -0
  93. package/dist/utils/links.d.ts +28 -0
  94. package/dist/utils/links.d.ts.map +1 -0
  95. package/dist/utils/links.js +140 -0
  96. package/dist/utils/links.js.map +1 -0
  97. package/dist/utils/markdown.d.ts +58 -0
  98. package/dist/utils/markdown.d.ts.map +1 -0
  99. package/dist/utils/markdown.js +262 -0
  100. package/dist/utils/markdown.js.map +1 -0
  101. package/dist/utils/paths.d.ts +120 -0
  102. package/dist/utils/paths.d.ts.map +1 -0
  103. package/dist/utils/paths.js +225 -0
  104. package/dist/utils/paths.js.map +1 -0
  105. package/docs/CLAUDE_DESKTOP_SETUP.md +315 -0
  106. package/docs/QUICKSTART.md +195 -0
  107. package/docs/TESTING.md +232 -0
  108. package/docs/VAULT_TYPES.md +264 -0
  109. package/obsidian-mcp.example.json +37 -0
  110. package/package.json +82 -4
package/README.md CHANGED
@@ -1,3 +1,820 @@
1
- # Temporary Holding Version
1
+ # mcp-server-obsidian
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![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)
4
+ [![npm](https://img.shields.io/npm/v/mcp-server-obsidian)](https://www.npmjs.com/package/mcp-server-obsidian)
5
+
6
+ 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.
7
+
8
+ ```json
9
+ {
10
+ "mcpServers": {
11
+ "obsidian": {
12
+ "command": "npx",
13
+ "args": ["-y", "mcp-server-obsidian"],
14
+ "env": { "OBSIDIAN_VAULT_PATH": "/path/to/your/vault" }
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ 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.
21
+
22
+ ## 📚 Documentation
23
+
24
+ - **[Quick Start Guide](./docs/QUICKSTART.md)** - Get up and running in 5 minutes
25
+ - **[Claude Desktop Setup](./docs/CLAUDE_DESKTOP_SETUP.md)** - Connect to Claude Desktop
26
+ - **[Vault Types Explained](./docs/VAULT_TYPES.md)** - Understanding local/remote/API configurations
27
+ - **[Testing Guide](./docs/TESTING.md)** - Running tests and contributing
28
+ - **[API Documentation](#available-mcp-tools)** - Complete tool reference
29
+ - **[Changelog](./CHANGELOG.md)** - What changed in each release
30
+ - **[Security Policy](./SECURITY.md)** - Reporting a vulnerability
31
+
32
+ ## Features
33
+
34
+ ### 🗂️ Multi-Vault Support
35
+ - **Local Vaults**: Direct file system access; changes made in Obsidian or by a sync tool are picked up automatically
36
+ - **Remote Vaults**: HTTP/REST API integration with a self-hosted server, with periodic sync
37
+ - Seamless switching between multiple vaults, each optionally read-only
38
+
39
+ ### 🔗 Knowledge Graph
40
+ - Build and analyze complete knowledge graphs from your notes
41
+ - Find related notes based on links, tags, and content similarity
42
+ - Analyze graph structure (hubs, orphan notes, clusters)
43
+ - Suggest potential links between related notes
44
+ - Path finding between notes
45
+
46
+ ### 🔍 Advanced Search
47
+ - Full-text search across all notes
48
+ - Filter by tags (including nested tags) and folders
49
+ - Server-side search for remote vaults that offer it, client-side otherwise
50
+
51
+ ### 📝 Note Operations
52
+ - Read, create, update, and delete notes
53
+ - Parse Obsidian-flavored markdown with frontmatter
54
+ - Extract and track internal links, embeds, and tags
55
+ - Automatic backlink generation, resolving links the way Obsidian does (`[[Plan]]` finds `Projects/Plan.md`)
56
+ - Creating a note never silently replaces an existing one; updating a note keeps its frontmatter
57
+
58
+ ### 📊 Analytics
59
+ - Vault statistics (note count, word count, link count)
60
+ - Tag usage analysis
61
+ - Folder structure insights
62
+
63
+ ### 🎯 Obsidian Integration
64
+ - Optional integration with community "Local REST API" plugin
65
+ - Open notes directly in Obsidian app
66
+ - Execute Obsidian commands
67
+ - See which note is currently open
68
+ - Access to Obsidian URI protocol
69
+ - **Note:** Requires plugin installation and app running locally. Everything else works without the Obsidian app.
70
+
71
+ ### 🎨 Canvas Support
72
+ - Read and manipulate Obsidian Canvas files
73
+ - Create and edit canvas nodes (file, text, link, group)
74
+ - Manage canvas edges and connections
75
+ - Safe under concurrent edits: several tool calls against one canvas do not overwrite each other
76
+ - Programmatic canvas generation
77
+
78
+ ### 📊 Dataview Queries
79
+ - SQL-like querying over your notes
80
+ - Filter by frontmatter metadata and inline fields
81
+ - Sort and group results
82
+ - Field selection
83
+ - Multiple WHERE conditions, with numbers and dates compared as numbers and dates
84
+ - Extract metadata from notes (frontmatter + inline fields)
85
+
86
+ ### 📝 Template System
87
+ - Dynamic template rendering with variable substitution
88
+ - Built-in date/time variables (`{{date}}`, `{{time}}`, `{{weekday}}`, etc.)
89
+ - Custom variable support
90
+ - Default values (`{{variable|default}}`)
91
+ - Date formatting (`{{date:YYYY-MM-DD}}`)
92
+ - Frontmatter merging
93
+ - Create notes from templates programmatically
94
+
95
+ ### 📅 Periodic Notes
96
+ - Daily, weekly, monthly, and yearly notes
97
+ - Automatic date-based naming and organization
98
+ - Custom templates for each note type
99
+ - Date range calculations
100
+ - List and query periodic notes
101
+ - Configurable folder structure and formats; daily notes follow Obsidian's own Daily notes settings when nothing is configured
102
+
103
+ ## Architecture
104
+
105
+ The server is built with a clean, modular architecture:
106
+
107
+ ```
108
+ ┌─────────────────────────────────────────┐
109
+ │ MCP Server Layer │
110
+ │ (Tools, Resources, Protocol Handling) │
111
+ └──────────────┬──────────────────────────┘
112
+ │
113
+ ┌──────────────┴──────────────────────────┐
114
+ │ Service Layer │
115
+ │ • Knowledge Graph Service │
116
+ │ • Canvas Service │
117
+ │ • Dataview Service │
118
+ │ • Template Service │
119
+ │ • Periodic Notes Service │
120
+ │ • Configuration Management │
121
+ └──────────────┬──────────────────────────┘
122
+ │
123
+ ┌──────────────┴──────────────────────────┐
124
+ │ Connector Layer (Adapters) │
125
+ │ • Local Vault Connector (File System) │
126
+ │ • Remote Vault Connector (HTTP API) │
127
+ └──────────────┬──────────────────────────┘
128
+ │
129
+ ┌──────────────┴──────────────────────────┐
130
+ │ Integration Layer │
131
+ │ • Obsidian API Client │
132
+ │ • Markdown Parser │
133
+ └──────────────────────────────────────────┘
134
+ ```
135
+
136
+ ### Key Design Patterns
137
+
138
+ - **Adapter Pattern**: Abstract `BaseConnector` interface allows seamless switching between local and remote vaults
139
+ - **Service Layer**: Separates business logic (knowledge graph) from data access
140
+ - **Configuration Management**: Flexible config from files, environment, or defaults
141
+ - **Always current**: Local vaults are re-checked against the folder (file size and modification time) before answering; remote vaults sync periodically
142
+
143
+ ## Installation
144
+
145
+ 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.
146
+
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "obsidian": {
151
+ "command": "npx",
152
+ "args": ["-y", "mcp-server-obsidian"],
153
+ "env": {
154
+ "OBSIDIAN_VAULT_PATH": "/path/to/your/vault"
155
+ }
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ With Claude Code:
162
+
163
+ ```bash
164
+ claude mcp add obsidian -e OBSIDIAN_VAULT_PATH=/path/to/your/vault -- npx -y mcp-server-obsidian
165
+ ```
166
+
167
+ See [Claude Desktop Setup](./docs/CLAUDE_DESKTOP_SETUP.md) for a walk-through. To install the `mcp-server-obsidian` command instead of using `npx`:
168
+
169
+ ```bash
170
+ npm install -g mcp-server-obsidian
171
+ ```
172
+
173
+ ### From source
174
+
175
+ ```bash
176
+ git clone https://github.com/bazylhorsey/mcp-server-obsidian.git
177
+ cd mcp-server-obsidian
178
+ npm install
179
+ npm run build
180
+ node dist/index.js --help
181
+ ```
182
+
183
+ ## Configuration
184
+
185
+ 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`:
186
+
187
+ ```json
188
+ {
189
+ "vaults": [
190
+ {
191
+ "name": "my-local-vault",
192
+ "type": "local",
193
+ "path": "/path/to/obsidian/vault"
194
+ },
195
+ {
196
+ "name": "my-cloud-vault",
197
+ "type": "remote",
198
+ "url": "https://your-sync-server.com/api",
199
+ "apiKey": "your-api-key",
200
+ "syncInterval": 60000
201
+ }
202
+ ],
203
+ "obsidianApi": {
204
+ "restApiUrl": "http://127.0.0.1:27123",
205
+ "apiKey": "your-api-key",
206
+ "vaultName": "my-local-vault"
207
+ }
208
+ }
209
+ ```
210
+
211
+ ### Where the configuration is read from
212
+
213
+ The first of these that exists is used:
214
+
215
+ 1. the file given with `--config <file>`
216
+ 2. the file named by the `OBSIDIAN_MCP_CONFIG` environment variable
217
+ 3. `obsidian-mcp.json` in the current working directory
218
+ 4. `obsidian-mcp.json` next to the server (the folder that contains `dist/`; useful when running from source)
219
+ 5. `~/.obsidian-mcp.json`
220
+ 6. the environment variables below
221
+
222
+ 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).
223
+
224
+ A configuration file that exists but is invalid stops the server with an explanation; it is never skipped in favour of the next location.
225
+
226
+ ### Vault options
227
+
228
+ | Option | Vaults | Meaning |
229
+ |---|---|---|
230
+ | `name` | all | Name used in the `vault` argument of every tool. Must be unique. |
231
+ | `type` | all | `"local"` or `"remote"`. |
232
+ | `path` | local | Vault folder. `~` is expanded; a relative path is relative to the config file. |
233
+ | `url`, `apiKey` | remote | Base URL of the sync server and its bearer token. |
234
+ | `syncInterval` | remote | Milliseconds between re-reads of the remote vault. |
235
+ | `readOnly` | all | `true` refuses every tool that would create, change or delete something. |
236
+ | `allowSymlinksOutsideVault` | local | `true` follows symbolic links that lead out of the vault folder. Off by default. |
237
+ | `rescanIntervalMs` | local | Minimum time between checks of the folder for outside changes. Default `1000`. |
238
+ | `periodicNotes`, `templates` | local | Per-vault versions of the top-level sections of the same name. |
239
+
240
+ ### Vault Types Explained
241
+
242
+ **Local Vault (`type: "local"`)**
243
+ - Direct filesystem access to your Obsidian vault folder
244
+ - Fastest performance, always reflects what is on disk
245
+ - Use this for vaults stored on your computer or mounted network drives
246
+ - Does not need Obsidian: any folder of Markdown files works, including [Foam](https://foambubble.github.io/) workspaces
247
+
248
+ **Remote Vault (`type: "remote"`)**
249
+ - Connects to a self-hosted sync server via HTTP/REST API
250
+ - For vaults hosted on your own cloud infrastructure (not Obsidian's sync service)
251
+ - Requires a server that implements the small REST contract described in [Vault Types Explained](./docs/VAULT_TYPES.md#the-remote-vault-rest-contract)
252
+
253
+ **Obsidian API (Optional)**
254
+ - Only needed if you want to control the Obsidian desktop app
255
+ - Requires the "Local REST API" community plugin in Obsidian
256
+ - Enables: Opening notes in app, executing commands, reading the active note
257
+ - NOT used for reading/writing vault content (use local/remote vaults for that)
258
+
259
+ ### Configuration via Environment Variables
260
+
261
+ Alternatively, use environment variables:
262
+
263
+ ```bash
264
+ # Local vault
265
+ export OBSIDIAN_VAULT_PATH="/path/to/vault"
266
+ export OBSIDIAN_VAULT_NAME="my-vault"
267
+ export OBSIDIAN_READ_ONLY="true" # optional
268
+
269
+ # Remote vault
270
+ export OBSIDIAN_REMOTE_URL="https://your-sync-server.com/api"
271
+ export OBSIDIAN_REMOTE_NAME="cloud"
272
+ export OBSIDIAN_REMOTE_API_KEY="your-key"
273
+ export OBSIDIAN_SYNC_INTERVAL="60000"
274
+
275
+ # Obsidian API (optional)
276
+ export OBSIDIAN_API_URL="http://127.0.0.1:27123"
277
+ export OBSIDIAN_API_KEY="your-key"
278
+ ```
279
+
280
+ ### Common Configuration Scenarios
281
+
282
+ **Scenario 1: Just a local vault (most common)**
283
+ ```json
284
+ {
285
+ "vaults": [
286
+ {
287
+ "name": "personal",
288
+ "type": "local",
289
+ "path": "/home/user/Documents/ObsidianVault"
290
+ }
291
+ ]
292
+ }
293
+ ```
294
+
295
+ **Scenario 2: Local vault + iCloud/Dropbox (also use local type)**
296
+ ```json
297
+ {
298
+ "vaults": [
299
+ {
300
+ "name": "synced",
301
+ "type": "local",
302
+ "path": "/home/user/iCloud/ObsidianVault"
303
+ }
304
+ ]
305
+ }
306
+ ```
307
+ Note: iCloud/Dropbox sync is handled by the cloud service itself - just point to the synced folder.
308
+
309
+ **Scenario 3: Multiple local vaults**
310
+ ```json
311
+ {
312
+ "vaults": [
313
+ {
314
+ "name": "personal",
315
+ "type": "local",
316
+ "path": "/home/user/Documents/PersonalVault"
317
+ },
318
+ {
319
+ "name": "work",
320
+ "type": "local",
321
+ "path": "/home/user/Documents/WorkVault",
322
+ "readOnly": true
323
+ }
324
+ ]
325
+ }
326
+ ```
327
+
328
+ **Scenario 4: Self-hosted remote server (advanced)**
329
+ ```json
330
+ {
331
+ "vaults": [
332
+ {
333
+ "name": "cloud",
334
+ "type": "remote",
335
+ "url": "https://your-server.com/obsidian-api",
336
+ "apiKey": "your-api-key",
337
+ "syncInterval": 60000
338
+ }
339
+ ]
340
+ }
341
+ ```
342
+ Note: Requires you to implement or deploy a compatible REST API server.
343
+
344
+ ## Usage
345
+
346
+ ### Start the Server
347
+
348
+ An MCP client normally starts the server for you. To run it by hand:
349
+
350
+ ```bash
351
+ OBSIDIAN_VAULT_PATH=/path/to/your/vault npx -y mcp-server-obsidian
352
+ npx -y mcp-server-obsidian --config /path/to/obsidian-mcp.json
353
+ ```
354
+
355
+ From source, `npm start` or `node dist/index.js` does the same.
356
+
357
+ `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.
358
+
359
+ ### Available MCP Tools
360
+
361
+ 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.
362
+
363
+ #### Note Operations
364
+ - `get_note` - Retrieve a note by path
365
+ - `search_notes` - Search notes with filters
366
+ - `create_note` - Create a new note (fails if it exists, unless `overwrite` is set)
367
+ - `update_note` - Replace the content of an existing note, keeping its frontmatter unless a new one is given
368
+ - `delete_note` - Delete a note permanently
369
+
370
+ Note paths are relative to the vault and may omit `.md`.
371
+
372
+ #### Vault Information
373
+ - `list_vaults` - List the configured vaults and their status
374
+ - `get_vault_stats` - Get vault statistics
375
+ - `list_tags` - List all tags
376
+ - `list_folders` - List all folders
377
+
378
+ #### Knowledge Graph
379
+ - `get_knowledge_graph` - Get complete graph structure
380
+ - `get_related_notes` - Find related notes
381
+ - `analyze_graph` - Analyze graph structure
382
+ - `suggest_links` - Suggest potential links
383
+ - `find_path` - Find the shortest chain of links between two notes
384
+
385
+ #### Canvas Operations
386
+ - `get_canvas` - Read a canvas file
387
+ - `create_canvas` - Create a new empty canvas
388
+ - `list_canvas_files` - List all canvas files in vault
389
+ - `add_canvas_node` - Add a node (file, text, link, or group)
390
+ - `add_canvas_edge` - Add an edge/connection between nodes
391
+ - `delete_canvas_node` - Delete a node from canvas
392
+ - `delete_canvas_edge` - Delete an edge from canvas
393
+
394
+ #### Dataview Queries
395
+ - `dataview_query` - Execute Dataview-style queries on notes
396
+ - `get_note_metadata` - Get metadata for a specific note
397
+ - `get_unique_values` - Get all unique values for a field
398
+
399
+ #### Template System
400
+ - `list_templates` - List all available templates
401
+ - `render_template` - Render a template with variables
402
+ - `create_from_template` - Create a new note from a template
403
+
404
+ #### Periodic Notes
405
+ - `create_daily_note` - Create or get daily note
406
+ - `create_weekly_note` - Create or get weekly note
407
+ - `create_monthly_note` - Create or get monthly note
408
+ - `create_yearly_note` - Create or get yearly note
409
+ - `get_periodic_note_info` - Get info about a periodic note
410
+ - `list_periodic_notes` - List periodic notes in a date range
411
+
412
+ #### Obsidian App (only when `obsidianApi` is configured)
413
+ - `open_in_obsidian` - Open a note in the Obsidian app
414
+ - `get_active_note` - Get the note currently open in Obsidian
415
+ - `list_obsidian_commands` - List command palette commands
416
+ - `execute_obsidian_command` - Run a command palette command
417
+
418
+ Canvas, template and periodic-note tools work on files and need a local vault.
419
+
420
+ A tool that fails reports an MCP tool error (`isError`) with `{"error": "..."}`; a tool that succeeds returns its result as JSON.
421
+
422
+ ### MCP Resources
423
+
424
+ All notes are exposed as resources with URIs:
425
+ ```
426
+ obsidian://{vault-name}/{note-path}
427
+ ```
428
+
429
+ 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`.
430
+
431
+ ## Development
432
+
433
+ ### Project Structure
434
+
435
+ ```
436
+ src/
437
+ ├── index.ts # Command-line entry point
438
+ ├── server.ts # MCP server: tools and resources
439
+ ├── types/ # TypeScript type definitions
440
+ │ ├── index.ts # Core types
441
+ │ ├── canvas.ts # Canvas types
442
+ │ ├── dataview.ts # Dataview types
443
+ │ ├── template.ts # Template types
444
+ │ └── periodic.ts # Periodic notes types
445
+ ├── connectors/ # Vault connectors (adapters)
446
+ │ ├── BaseConnector.ts
447
+ │ ├── LocalConnector.ts
448
+ │ └── RemoteConnector.ts
449
+ ├── services/ # Business logic services
450
+ │ ├── KnowledgeGraph.ts # Knowledge graph analysis
451
+ │ ├── CanvasService.ts # Canvas file operations
452
+ │ ├── DataviewService.ts # Dataview query processing
453
+ │ ├── TemplateService.ts # Template rendering
454
+ │ └── PeriodicNotesService.ts # Periodic notes management
455
+ ├── api/ # External API integrations
456
+ │ └── ObsidianAPI.ts
457
+ └── utils/ # Utilities
458
+ ├── config.ts # Configuration loading and validation
459
+ ├── paths.ts # Vault path safety
460
+ ├── frontmatter.ts # YAML frontmatter
461
+ ├── markdown.ts # Links, tags, note parsing
462
+ ├── links.ts # Link resolution and backlinks
463
+ ├── date.ts # Calendar dates and formats
464
+ ├── fs.ts # Vault walking, file locks
465
+ ├── http.ts # HTTP client
466
+ └── errors.ts
467
+ ```
468
+
469
+ ### Build
470
+
471
+ ```bash
472
+ npm run build
473
+ ```
474
+
475
+ ### Watch Mode
476
+
477
+ ```bash
478
+ npm run watch
479
+ ```
480
+
481
+ ### Checks
482
+
483
+ ```bash
484
+ npm run lint # ESLint
485
+ npm run typecheck # TypeScript, sources and tests
486
+ npm test # Jest
487
+ npm run check # all of the above, with coverage, plus a build
488
+ ```
489
+
490
+ ### Releasing
491
+
492
+ 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`.
493
+ 2. Commit.
494
+ 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`.
495
+
496
+ `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.
497
+
498
+ 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`.
499
+
500
+ ## Integration with Obsidian
501
+
502
+ For advanced features, install the [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) plugin:
503
+
504
+ 1. Install the plugin from Obsidian Community Plugins
505
+ 2. Enable the plugin and note the API key
506
+ 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
507
+ 4. Configure the `obsidianApi` section in your config
508
+
509
+ With only `vaultName` set (no `restApiUrl`), `open_in_obsidian` returns an `obsidian://` link instead of opening the note itself.
510
+
511
+ ## Use Cases
512
+
513
+ ### For AI Assistants
514
+ - Access and navigate your Obsidian knowledge base
515
+ - Create and update notes based on conversations
516
+ - Find related information across notes
517
+ - Suggest connections between ideas
518
+
519
+ ### For Automation
520
+ - Automated note creation and organization
521
+ - Batch processing of notes
522
+ - Knowledge graph analysis and visualization
523
+ - Link maintenance and suggestions
524
+
525
+ ### For Integrations
526
+ - Connect Obsidian with other tools via MCP
527
+ - Build custom workflows
528
+ - Create dashboards and reports
529
+ - Sync with external systems
530
+
531
+ ## Advanced Features
532
+
533
+ ### Canvas Support
534
+
535
+ Obsidian Canvas is a powerful visual workspace. This server provides full programmatic access to create and manipulate canvas files:
536
+
537
+ **Example: Create a visual mind map**
538
+ ```typescript
539
+ // Create a new canvas
540
+ await mcp.callTool('create_canvas', { path: 'diagrams/mindmap.canvas' });
541
+
542
+ // Add nodes; each call returns the new node, including its id
543
+ const idea = await mcp.callTool('add_canvas_node', {
544
+ canvasPath: 'diagrams/mindmap.canvas',
545
+ nodeType: 'file',
546
+ file: 'notes/central-idea.md',
547
+ x: 0, y: 0, width: 400, height: 200
548
+ });
549
+
550
+ const concept = await mcp.callTool('add_canvas_node', {
551
+ canvasPath: 'diagrams/mindmap.canvas',
552
+ nodeType: 'text',
553
+ text: '# Key Concept',
554
+ x: 500, y: 0, width: 300, height: 150,
555
+ color: '1' // Red; "#rrggbb" also works
556
+ });
557
+
558
+ // Connect nodes with edges, using the ids returned above
559
+ await mcp.callTool('add_canvas_edge', {
560
+ canvasPath: 'diagrams/mindmap.canvas',
561
+ fromNode: '<id of the first node>',
562
+ toNode: '<id of the second node>',
563
+ label: 'relates to'
564
+ });
565
+ ```
566
+
567
+ ### Dataview Queries
568
+
569
+ Query your notes like a database with SQL-like syntax:
570
+
571
+ **Example: Find recent project notes**
572
+ ```typescript
573
+ await mcp.callTool('dataview_query', {
574
+ from: '#project',
575
+ where: [
576
+ { field: 'status', operator: 'eq', value: 'active' },
577
+ { field: 'modified', operator: 'gte', value: '2024-01-01' }
578
+ ],
579
+ sort: [{ field: 'modified', direction: 'desc' }],
580
+ limit: 10
581
+ });
582
+ ```
583
+
584
+ **Example: Group notes by status**
585
+ ```typescript
586
+ await mcp.callTool('dataview_query', {
587
+ from: 'projects/',
588
+ groupBy: 'status',
589
+ select: ['modified', 'tags']
590
+ });
591
+ ```
592
+
593
+ 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`.
594
+
595
+ 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.
596
+
597
+ **Example: Get metadata from inline fields**
598
+ ```typescript
599
+ // Note content: "Status:: In Progress\nPriority:: High"
600
+ const metadata = await mcp.callTool('get_note_metadata', {
601
+ path: 'projects/my-project.md'
602
+ });
603
+ // Returns: { Status: 'In Progress', Priority: 'High', ... }
604
+ ```
605
+
606
+ ### Template System
607
+
608
+ Create reusable templates with variable substitution and automatic date handling:
609
+
610
+ **Example: Create a meeting note template**
611
+ ```markdown
612
+ ---
613
+ tags: [meeting]
614
+ templateVariables:
615
+ - name: attendees
616
+ type: string
617
+ description: Meeting attendees
618
+ ---
619
+
620
+ # Meeting: {{title}}
621
+
622
+ **Date:** {{date}}
623
+ **Time:** {{time}}
624
+ **Attendees:** {{attendees|TBD}}
625
+
626
+ ## Agenda
627
+
628
+ -
629
+
630
+ ## Notes
631
+
632
+ ## Action Items
633
+
634
+ - [ ]
635
+ ```
636
+
637
+ **Example: Use the template**
638
+ ```typescript
639
+ await mcp.callTool('create_from_template', {
640
+ templatePath: 'Templates/meeting.md',
641
+ targetPath: 'Meetings/2024-01-15-team-sync.md',
642
+ variables: {
643
+ attendees: 'Alice, Bob, Charlie'
644
+ },
645
+ frontmatter: {
646
+ project: 'Q1 Planning'
647
+ }
648
+ });
649
+ ```
650
+
651
+ **Built-in Variables:**
652
+ - `{{date}}` - Current date (YYYY-MM-DD)
653
+ - `{{time}}` - Current time (HH:mm)
654
+ - `{{datetime}}` - Current datetime
655
+ - `{{year}}`, `{{month}}`, `{{day}}` - Date components
656
+ - `{{weekday}}` - Day of week (Monday, Tuesday, etc.)
657
+ - `{{week}}` - Week number (01-53)
658
+ - `{{title}}`, `{{filename}}`, `{{folder}}` - File context
659
+
660
+ 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.
661
+
662
+ 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:
663
+
664
+ ```json
665
+ {
666
+ "templates": {
667
+ "folder": "Templates",
668
+ "dateFormat": "YYYY-MM-DD",
669
+ "timeFormat": "HH:mm"
670
+ }
671
+ }
672
+ ```
673
+
674
+ ### Periodic Notes
675
+
676
+ Automatically create and organize daily, weekly, monthly, and yearly notes:
677
+
678
+ **Example: Create today's daily note**
679
+ ```typescript
680
+ await mcp.callTool('create_daily_note', {
681
+ vault: 'my-vault'
682
+ });
683
+ // Creates: Daily Notes/2024-01-15.md
684
+ ```
685
+
686
+ **Example: Create this week's note**
687
+ ```typescript
688
+ await mcp.callTool('create_weekly_note', {
689
+ vault: 'my-vault',
690
+ variables: {
691
+ goals: 'Complete project proposal'
692
+ }
693
+ });
694
+ // Creates: Weekly Notes/2024-W03.md
695
+ ```
696
+
697
+ **Example: List all monthly notes**
698
+ ```typescript
699
+ await mcp.callTool('list_periodic_notes', {
700
+ vault: 'my-vault',
701
+ type: 'monthly',
702
+ startDate: '2024-01-01',
703
+ endDate: '2024-12-31'
704
+ });
705
+ ```
706
+
707
+ Dates are calendar days in the server's time zone: `2024-01-15` is 15 January wherever the server runs.
708
+
709
+ **Configuration:**
710
+ 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:
711
+ ```json
712
+ {
713
+ "periodicNotes": {
714
+ "daily": {
715
+ "folder": "Journal/Daily",
716
+ "format": "YYYY-MM-DD",
717
+ "template": "Templates/daily-note.md"
718
+ },
719
+ "weekly": {
720
+ "folder": "Journal/Weekly",
721
+ "format": "GGGG-[W]WW"
722
+ }
723
+ }
724
+ }
725
+ ```
726
+
727
+ 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.
728
+
729
+ ## Technical Highlights
730
+
731
+ ### Markdown Parsing
732
+ - Full support for Obsidian-flavored markdown
733
+ - Frontmatter extraction (YAML, parsed as data only)
734
+ - Internal link parsing (`[[link]]`, `[[link|alias]]`, `[[link#heading]]`, relative `[text](note.md)`)
735
+ - Embed detection (`![[embed]]`)
736
+ - Tag extraction (`#tag`, `#nested/tag`), ignoring code blocks, headings in links and URL fragments
737
+ - Inline field parsing (`key:: value` pattern)
738
+
739
+ ### Canvas Operations
740
+ - Complete Canvas file format support (JSON-based)
741
+ - All node types: file, text, link, group
742
+ - Edge/connection management with customization
743
+ - Color and styling support
744
+ - Programmatic canvas generation
745
+
746
+ ### Dataview Integration
747
+ - SQL-like query language for notes
748
+ - Multiple filter operators (eq, neq, gt, gte, lt, lte, contains, startsWith, endsWith, exists)
749
+ - Sorting and grouping capabilities
750
+ - Field selection and projection
751
+ - Support for frontmatter and inline fields
752
+ - Nested field access with dot notation
753
+
754
+ ### Template System
755
+ - Variable substitution with `{{variable}}` syntax
756
+ - Built-in date/time variables with formatting
757
+ - Default values: `{{variable|default}}`
758
+ - Date formatting: `{{date:YYYY-MM-DD}}`
759
+ - Frontmatter merging and manipulation
760
+ - Template discovery and listing
761
+
762
+ ### Periodic Notes
763
+ - Automatic date-based note generation
764
+ - Configurable folder structure and naming
765
+ - Template integration for custom layouts
766
+ - Date range calculations (daily, weekly, monthly, yearly)
767
+ - ISO week number support
768
+ - Flexible date format patterns
769
+
770
+ ### Link Resolution
771
+ - Smart link resolution (file name, path and title based)
772
+ - Automatic backlink generation
773
+ - Bidirectional link tracking
774
+
775
+ ### Performance
776
+ - Notes are indexed in memory; only files whose size or modification time changed are read again
777
+ - Folder checks are spaced out (`rescanIntervalMs`)
778
+
779
+ ## Security Considerations
780
+
781
+ - **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`).
782
+ - **File types**: note tools only touch `.md` files and canvas tools only `.canvas` files, whatever path they are given.
783
+ - **Read-only mode**: `"readOnly": true` on a vault disables every tool that changes it.
784
+ - **Frontmatter is data**: YAML is parsed with a data-only schema; nothing in a note is ever executed.
785
+ - **No silent overwrites**: creating a note, a canvas or a note from a template fails if the target exists.
786
+ - **`delete_note` is permanent**: the file is removed, not moved to a trash folder.
787
+ - **Obsidian app tools**: `execute_obsidian_command` can do anything the command palette can. It exists only when `obsidianApi` is configured.
788
+ - Remote vaults: Use HTTPS and secure API keys
789
+ - API keys: Never commit to version control
790
+
791
+ To report a vulnerability, see the [Security Policy](./SECURITY.md).
792
+
793
+ ## Requirements
794
+
795
+ - Node.js 22.13 or higher
796
+ - Access to Obsidian vault(s)
797
+
798
+ ## License
799
+
800
+ MIT. Obsidian is a trademark of its respective owner; this project is independent and not endorsed by it.
801
+
802
+ ## Contributing
803
+
804
+ Contributions are welcome! Please feel free to submit issues and pull requests.
805
+
806
+ ## Related Projects
807
+
808
+ - [Obsidian](https://obsidian.md/) - The knowledge base application
809
+ - [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) - REST API plugin
810
+ - [Model Context Protocol](https://modelcontextprotocol.io/) - MCP specification
811
+
812
+ ## Support
813
+
814
+ For issues and questions:
815
+ - GitHub Issues: [Create an issue](https://github.com/bazylhorsey/mcp-server-obsidian/issues)
816
+ - Documentation: See this README
817
+
818
+ ---
819
+
820
+ Built with ❤️ for the Obsidian and MCP communities