obsidian-mcp-server 2.0.7 → 3.0.0
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.
- package/CLAUDE.md +364 -0
- package/Dockerfile +99 -0
- package/LICENSE +4 -6
- package/README.md +246 -206
- package/changelog/3.0.x/3.0.0.md +102 -0
- package/changelog/template.md +51 -0
- package/dist/config/server-config.d.ts +19 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +55 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -295
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts +8 -0
- package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/index.js +8 -0
- package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +36 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +9 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts +23 -0
- package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-status.resource.js +47 -0
- package/dist/mcp-server/resources/definitions/obsidian-status.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +13 -0
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +30 -0
- package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts +21 -0
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +38 -0
- package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared/schemas.js +66 -0
- package/dist/mcp-server/tools/definitions/_shared/schemas.js.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +51 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +120 -0
- package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +531 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +38 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +58 -0
- package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts +46 -0
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +66 -0
- package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts +19 -0
- package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js +43 -0
- package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts +92 -0
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +245 -0
- package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts +13 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js +38 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +59 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +273 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts +13 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +38 -0
- package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +68 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +178 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts +77 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +172 -0
- package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +22 -0
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +88 -0
- package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +81 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +83 -0
- package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts +59 -0
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +167 -0
- package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +76 -0
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +244 -0
- package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +41 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +76 -0
- package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -0
- package/dist/services/obsidian/frontmatter-ops.d.ts +34 -0
- package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -0
- package/dist/services/obsidian/frontmatter-ops.js +230 -0
- package/dist/services/obsidian/frontmatter-ops.js.map +1 -0
- package/dist/services/obsidian/obsidian-service.d.ts +73 -0
- package/dist/services/obsidian/obsidian-service.d.ts.map +1 -0
- package/dist/services/obsidian/obsidian-service.js +399 -0
- package/dist/services/obsidian/obsidian-service.js.map +1 -0
- package/dist/services/obsidian/section-extractor.d.ts +13 -0
- package/dist/services/obsidian/section-extractor.d.ts.map +1 -0
- package/dist/services/obsidian/section-extractor.js +124 -0
- package/dist/services/obsidian/section-extractor.js.map +1 -0
- package/dist/services/obsidian/types.d.ts +91 -0
- package/dist/services/obsidian/types.d.ts.map +1 -0
- package/dist/services/obsidian/types.js +7 -0
- package/dist/services/obsidian/types.js.map +1 -0
- package/package.json +63 -69
- package/server.json +167 -0
- package/CHANGELOG.md +0 -124
- package/dist/config/index.d.ts +0 -41
- package/dist/config/index.js +0 -191
- package/dist/mcp-server/server.d.ts +0 -33
- package/dist/mcp-server/server.js +0 -211
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.d.ts +0 -51
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.js +0 -168
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.d.ts +0 -19
- package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.js +0 -91
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +0 -77
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +0 -341
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +0 -18
- package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +0 -69
- package/dist/mcp-server/tools/obsidianListNotesTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianListNotesTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianListNotesTool/logic.d.ts +0 -68
- package/dist/mcp-server/tools/obsidianListNotesTool/logic.js +0 -215
- package/dist/mcp-server/tools/obsidianListNotesTool/registration.d.ts +0 -23
- package/dist/mcp-server/tools/obsidianListNotesTool/registration.js +0 -98
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +0 -3
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +0 -2
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +0 -42
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +0 -152
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +0 -3
- package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +0 -52
- package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +0 -3
- package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +0 -2
- package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +0 -28
- package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +0 -161
- package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +0 -3
- package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +0 -52
- package/dist/mcp-server/tools/obsidianReadNoteTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianReadNoteTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianReadNoteTool/logic.d.ts +0 -87
- package/dist/mcp-server/tools/obsidianReadNoteTool/logic.js +0 -216
- package/dist/mcp-server/tools/obsidianReadNoteTool/registration.d.ts +0 -20
- package/dist/mcp-server/tools/obsidianReadNoteTool/registration.js +0 -101
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +0 -255
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +0 -583
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +0 -22
- package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +0 -111
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.d.ts +0 -12
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.js +0 -12
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.d.ts +0 -183
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.js +0 -490
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.d.ts +0 -21
- package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.js +0 -108
- package/dist/mcp-server/transports/auth/core/authContext.d.ts +0 -33
- package/dist/mcp-server/transports/auth/core/authContext.js +0 -24
- package/dist/mcp-server/transports/auth/core/authTypes.d.ts +0 -17
- package/dist/mcp-server/transports/auth/core/authTypes.js +0 -5
- package/dist/mcp-server/transports/auth/core/authUtils.d.ts +0 -18
- package/dist/mcp-server/transports/auth/core/authUtils.js +0 -45
- package/dist/mcp-server/transports/auth/index.d.ts +0 -10
- package/dist/mcp-server/transports/auth/index.js +0 -9
- package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.d.ts +0 -27
- package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.js +0 -149
- package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.d.ts +0 -20
- package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.js +0 -124
- package/dist/mcp-server/transports/httpErrorHandler.d.ts +0 -26
- package/dist/mcp-server/transports/httpErrorHandler.js +0 -73
- package/dist/mcp-server/transports/httpTransport.d.ts +0 -21
- package/dist/mcp-server/transports/httpTransport.js +0 -208
- package/dist/mcp-server/transports/stdioTransport.d.ts +0 -42
- package/dist/mcp-server/transports/stdioTransport.js +0 -63
- package/dist/services/obsidianRestAPI/index.d.ts +0 -15
- package/dist/services/obsidianRestAPI/index.js +0 -17
- package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +0 -38
- package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +0 -62
- package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +0 -22
- package/dist/services/obsidianRestAPI/methods/commandMethods.js +0 -31
- package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +0 -16
- package/dist/services/obsidianRestAPI/methods/openMethods.js +0 -21
- package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +0 -37
- package/dist/services/obsidianRestAPI/methods/patchMethods.js +0 -94
- package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +0 -42
- package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +0 -66
- package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +0 -25
- package/dist/services/obsidianRestAPI/methods/searchMethods.js +0 -36
- package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +0 -58
- package/dist/services/obsidianRestAPI/methods/vaultMethods.js +0 -144
- package/dist/services/obsidianRestAPI/service.d.ts +0 -195
- package/dist/services/obsidianRestAPI/service.js +0 -379
- package/dist/services/obsidianRestAPI/types.d.ts +0 -127
- package/dist/services/obsidianRestAPI/types.js +0 -7
- package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +0 -4
- package/dist/services/obsidianRestAPI/vaultCache/index.js +0 -4
- package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +0 -88
- package/dist/services/obsidianRestAPI/vaultCache/service.js +0 -299
- package/dist/types-global/errors.d.ts +0 -73
- package/dist/types-global/errors.js +0 -71
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -13
- package/dist/utils/internal/asyncUtils.d.ts +0 -54
- package/dist/utils/internal/asyncUtils.js +0 -101
- package/dist/utils/internal/errorHandler.d.ts +0 -176
- package/dist/utils/internal/errorHandler.js +0 -351
- package/dist/utils/internal/index.d.ts +0 -4
- package/dist/utils/internal/index.js +0 -4
- package/dist/utils/internal/logger.d.ts +0 -141
- package/dist/utils/internal/logger.js +0 -406
- package/dist/utils/internal/requestContext.d.ts +0 -83
- package/dist/utils/internal/requestContext.js +0 -72
- package/dist/utils/metrics/index.d.ts +0 -1
- package/dist/utils/metrics/index.js +0 -1
- package/dist/utils/metrics/tokenCounter.d.ts +0 -27
- package/dist/utils/metrics/tokenCounter.js +0 -128
- package/dist/utils/obsidian/index.d.ts +0 -5
- package/dist/utils/obsidian/index.js +0 -5
- package/dist/utils/obsidian/obsidianApiUtils.d.ts +0 -14
- package/dist/utils/obsidian/obsidianApiUtils.js +0 -29
- package/dist/utils/obsidian/obsidianStatUtils.d.ts +0 -68
- package/dist/utils/obsidian/obsidianStatUtils.js +0 -143
- package/dist/utils/parsing/dateParser.d.ts +0 -56
- package/dist/utils/parsing/dateParser.js +0 -104
- package/dist/utils/parsing/index.d.ts +0 -2
- package/dist/utils/parsing/index.js +0 -3
- package/dist/utils/parsing/jsonParser.d.ts +0 -80
- package/dist/utils/parsing/jsonParser.js +0 -133
- package/dist/utils/security/idGenerator.d.ts +0 -140
- package/dist/utils/security/idGenerator.js +0 -194
- package/dist/utils/security/index.d.ts +0 -3
- package/dist/utils/security/index.js +0 -3
- package/dist/utils/security/rateLimiter.d.ts +0 -156
- package/dist/utils/security/rateLimiter.js +0 -235
- package/dist/utils/security/sanitization.d.ts +0 -244
- package/dist/utils/security/sanitization.js +0 -599
package/README.md
CHANGED
|
@@ -1,295 +1,335 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>obsidian-mcp-server</h1>
|
|
3
|
+
<p><b>MCP server for Obsidian vaults — read, write, search, and surgically edit notes, tags, and frontmatter via the Local REST API plugin. STDIO or Streamable HTTP.</b>
|
|
4
|
+
<div>14 Tools • 3 Resources</div>
|
|
5
|
+
</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div align="center">
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/obsidian-mcp-server) [](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
2
11
|
|
|
3
|
-
[](https://modelcontextprotocol.io/)
|
|
5
|
-
[](./CHANGELOG.md)
|
|
6
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
-
[](https://github.com/cyanheads/obsidian-mcp-server/issues)
|
|
8
|
-
[](https://github.com/cyanheads/obsidian-mcp-server)
|
|
12
|
+
[](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
Fourteen tools grouped by shape — readers fetch notes and metadata, writers create or surgically edit content, managers reconcile tags and frontmatter, and a guarded escape hatch dispatches Obsidian command-palette commands.
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
| Tool Name | Description |
|
|
23
|
+
|:----------|:------------|
|
|
24
|
+
| `obsidian_get_note` | Read a note as raw content, full structured form (content + frontmatter + tags + stat), structural document map, or a single section. |
|
|
25
|
+
| `obsidian_list_notes` | List notes and subdirectories at a vault path with a recursive walk (default depth 2 — structural overview; max 20) bounded by a 1000-entry cap. Optional `extension` and `nameRegex` filters apply across the tree; regex-filtered directories are skipped without recursing into them. Returns flat `entries[]` plus a box-drawing tree in the rendered output; per-directory `truncated: true` flags where the depth limit cut off recursion. |
|
|
26
|
+
| `obsidian_list_tags` | List every tag found across the vault with usage counts, including hierarchical parents. |
|
|
27
|
+
| `obsidian_list_commands` | List Obsidian command-palette commands available for execution. |
|
|
28
|
+
| `obsidian_search_notes` | Search the vault by text, Dataview DQL, or JSONLogic — capped at 100 hits with overflow indicator. |
|
|
29
|
+
| `obsidian_write_note` | Create or overwrite a note, or replace a single heading/block/frontmatter section in place. |
|
|
30
|
+
| `obsidian_append_to_note` | Append content to a note, or to a specific heading/block/frontmatter section. |
|
|
31
|
+
| `obsidian_patch_note` | Surgical `append` / `prepend` / `replace` against a heading, block reference, or frontmatter field. |
|
|
32
|
+
| `obsidian_replace_in_note` | Body-wide search-replace inside a single note. Literal or regex matching, with `wholeWord`, `flexibleWhitespace`, `caseSensitive`, `replaceAll`, and `$1`/`$&` capture groups. |
|
|
33
|
+
| `obsidian_manage_frontmatter` | Atomic `get` / `set` / `delete` on a single frontmatter key. |
|
|
34
|
+
| `obsidian_manage_tags` | Add, remove, or list tags — reconciles frontmatter `tags:` and inline `#tag` syntax. |
|
|
35
|
+
| `obsidian_delete_note` | Permanently delete a note. Elicits human confirmation when the client supports it. |
|
|
36
|
+
| `obsidian_open_in_ui` | Open a file in the Obsidian app UI, with `failIfMissing` and `newLeaf` toggles. |
|
|
37
|
+
| `obsidian_execute_command` | Execute an Obsidian command-palette command by ID. **Opt-in via `OBSIDIAN_ENABLE_COMMANDS=true`.** |
|
|
15
38
|
|
|
16
|
-
|
|
39
|
+
### `obsidian_get_note`
|
|
17
40
|
|
|
18
|
-
|
|
41
|
+
Read a note in one of four projections, addressed by vault path, the active file, or a periodic note (`daily`, `weekly`, `monthly`, `quarterly`, `yearly`).
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| [`obsidian_list_notes`](./src/mcp-server/tools/obsidianListNotesTool/) | Lists notes and subdirectories within a specified vault folder. | - Filter by file extension or name regex.<br/>- Provides a formatted tree view of the directory. |
|
|
27
|
-
| [`obsidian_manage_frontmatter`](./src/mcp-server/tools/obsidianManageFrontmatterTool/) | Atomically manages a note's YAML frontmatter. | - `get`, `set`, or `delete` frontmatter keys.<br/>- Avoids rewriting the entire file for metadata changes. |
|
|
28
|
-
| [`obsidian_manage_tags`](./src/mcp-server/tools/obsidianManageTagsTool/) | Adds, removes, or lists tags for a note. | - Manages tags in both YAML frontmatter and inline content. |
|
|
29
|
-
| [`obsidian_delete_note`](./src/mcp-server/tools/obsidianDeleteNoteTool/) | Permanently deletes a specified note from the vault. | - Case-insensitive path fallback for safety. |
|
|
43
|
+
- `format: "content"` — raw markdown body
|
|
44
|
+
- `format: "full"` — content, frontmatter, tags, and file metadata
|
|
45
|
+
- `format: "document-map"` — catalog of headings, block references, and frontmatter fields
|
|
46
|
+
- `format: "section"` — single heading/block/frontmatter section value (requires `section`); heading sections include the full subtree under that heading
|
|
47
|
+
|
|
48
|
+
Pair the document-map projection with `obsidian_patch_note` to discover edit targets before patching.
|
|
30
49
|
|
|
31
50
|
---
|
|
32
51
|
|
|
33
|
-
|
|
52
|
+
### `obsidian_search_notes`
|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
| [Project Structure](#project-structure) | [Vault Cache Service](#vault-cache-service) |
|
|
37
|
-
| [Tools](#tools) | [Resources](#resources) | [Development](#development) | [License](#license) |
|
|
54
|
+
Three search modes selected by `mode`:
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
- `text` — substring match with surrounding context windows; optional `pathPrefix` filter (text mode only — passing `pathPrefix` in `dataview` or `jsonlogic` mode is rejected with `path_prefix_invalid_mode`)
|
|
57
|
+
- `dataview` — Dataview DQL (`TABLE …`) for path/date/metadata queries; `file.mtime`, `file.path`, etc. are queryable
|
|
58
|
+
- `jsonlogic` — JSONLogic tree evaluated against `path`, `content`, `frontmatter.<key>`, `tags`, and `stat.{ctime,mtime,size}`; custom `glob` and `regexp` operators
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
Results are capped at 100 hits. When the upstream returns more, an `excluded` indicator surfaces the overflow count and a hint to narrow the query. Text-mode hits are additionally clipped per file at `maxMatchesPerHit` (default 10) so a single match-heavy note can't blow the response budget — clipped hits carry `truncated: true` and `totalMatches`.
|
|
42
61
|
|
|
43
|
-
|
|
62
|
+
---
|
|
44
63
|
|
|
45
|
-
|
|
46
|
-
- **Integrate Obsidian into AI workflows**: Enable LLMs to access and modify your knowledge base as part of their research, writing, or coding tasks.
|
|
47
|
-
- **Build custom Obsidian tools**: Create external applications that interact with your vault data in novel ways.
|
|
64
|
+
### `obsidian_write_note`
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
Idempotent create/overwrite with optional in-place section replacement.
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
- Without `section` — full-file `PUT`, creates the file if missing
|
|
69
|
+
- With `section` — `PATCH`-with-replace against the named heading/block/frontmatter field, leaving the rest of the file untouched
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
Repeated calls with the same input converge on the same result.
|
|
54
72
|
|
|
55
|
-
|
|
73
|
+
---
|
|
56
74
|
|
|
57
|
-
|
|
75
|
+
### `obsidian_patch_note`
|
|
58
76
|
|
|
59
|
-
|
|
60
|
-
- **Error Handling**: Centralized error processing, standardized error types (`McpError`), and automatic logging.
|
|
61
|
-
- **Configuration**: Environment variable loading (`dotenv`) with comprehensive validation.
|
|
62
|
-
- **Input Validation/Sanitization**: Uses `zod` for schema validation and custom sanitization logic.
|
|
63
|
-
- **Request Context**: Tracking and correlation of operations via unique request IDs.
|
|
64
|
-
- **Type Safety**: Strong typing enforced by TypeScript and Zod schemas.
|
|
65
|
-
- **HTTP Transport Option**: Built-in Hono server with SSE, session management, CORS support, and pluggable authentication strategies (JWT and OAuth 2.1).
|
|
77
|
+
Surgical edits at a single document target.
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
- `operation: "append"` adds after the section
|
|
80
|
+
- `operation: "prepend"` adds before the section
|
|
81
|
+
- `operation: "replace"` swaps it out
|
|
82
|
+
- Targets: heading path, block reference ID, or frontmatter field
|
|
68
83
|
|
|
69
|
-
|
|
70
|
-
- **Comprehensive Command Coverage**: Exposes key vault operations as MCP tools (see [Tools](#tools) section).
|
|
71
|
-
- **Vault Interaction**: Supports reading, updating (append, prepend, overwrite), searching (global text/regex, search/replace), listing, deleting, and managing frontmatter and tags.
|
|
72
|
-
- **Targeting Flexibility**: Tools can target files by path, the currently active file in Obsidian, or periodic notes (daily, weekly, etc.).
|
|
73
|
-
- **Vault Cache Service**: An intelligent in-memory cache that improves performance and resilience. It caches vault content, provides a fallback for the global search tool if the live API fails, and periodically refreshes to stay in sync.
|
|
74
|
-
- **Safety Features**: Case-insensitive path fallbacks for file operations, clear distinction between modification types (append, overwrite, etc.).
|
|
84
|
+
Use `obsidian_get_note` with `format: "document-map"` to discover what targets exist before patching.
|
|
75
85
|
|
|
76
|
-
|
|
86
|
+
---
|
|
77
87
|
|
|
78
|
-
###
|
|
88
|
+
### `obsidian_replace_in_note`
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
2. **Obsidian Local REST API Plugin**: Install and enable the [Obsidian Local REST API plugin](https://github.com/coddingtonbear/obsidian-local-rest-api) within your Obsidian vault.
|
|
82
|
-
3. **API Key**: Configure an API key within the Local REST API plugin settings in Obsidian. You will need this key to configure the server.
|
|
83
|
-
4. **Node.js & npm**: Ensure you have Node.js (v18 or later recommended) and npm installed.
|
|
90
|
+
Body-wide search-replace for edits that don't fit `obsidian_patch_note`'s structural targets. The note is fetched, replacements are applied sequentially (each sees the previous output), and the result is written back in a single `PUT`.
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
Per-replacement options:
|
|
93
|
+
|
|
94
|
+
- `useRegex` — treat `search` as an ECMAScript regex. With `useRegex: true`, the replacement honors `$1` / `$&` capture-group references.
|
|
95
|
+
- `caseSensitive` — when `false`, match case-insensitively
|
|
96
|
+
- `wholeWord` — wrap the pattern in `\b…\b`; works in both literal and regex modes
|
|
97
|
+
- `flexibleWhitespace` — substitute any run of whitespace in `search` with `\s+`. Literal mode only — has no effect when `useRegex: true` (express it directly).
|
|
98
|
+
- `replaceAll` — when `false`, only the first match is replaced
|
|
99
|
+
|
|
100
|
+
Literal mode preserves `$1` / `$&` in the replacement verbatim — only `useRegex: true` expands capture-group references.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### `obsidian_manage_tags`
|
|
105
|
+
|
|
106
|
+
Add, remove, or list tags on a note. Reconciles both representations:
|
|
107
|
+
|
|
108
|
+
- Frontmatter `tags:` array
|
|
109
|
+
- Inline `#tag` syntax in the body
|
|
110
|
+
|
|
111
|
+
`add` ensures the tag is present in the requested location(s); `remove` strips it. Inline `#tag` occurrences inside fenced code blocks are intentionally left alone.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### `obsidian_delete_note`
|
|
116
|
+
|
|
117
|
+
Permanently delete a note. When the client supports `elicit`, the server requests human confirmation before issuing the `DELETE`. Without elicitation, the `destructiveHint` annotation surfaces the operation in the host's approval flow.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### `obsidian_execute_command`
|
|
122
|
+
|
|
123
|
+
Dispatch an Obsidian command-palette command by ID (discoverable via `obsidian_list_commands`). Behavior is command-dependent — some commands open UI, others delete files or close the vault.
|
|
124
|
+
|
|
125
|
+
**Off by default.** Register only when the operator sets `OBSIDIAN_ENABLE_COMMANDS=true`; the tool is omitted from the surface otherwise.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Resources
|
|
86
130
|
|
|
87
|
-
|
|
131
|
+
| Type | URI | Description |
|
|
132
|
+
|:---|:---|:---|
|
|
133
|
+
| Resource | `obsidian://vault/{+path}` | A note in the vault — content, frontmatter, tags, and file metadata. |
|
|
134
|
+
| Resource | `obsidian://tags` | All tags found across the vault, with usage counts. |
|
|
135
|
+
| Resource | `obsidian://status` | Server reachability, plugin version, and auth status of the Obsidian Local REST API. |
|
|
88
136
|
|
|
89
|
-
|
|
137
|
+
All resource data is also reachable via tools — `obsidian_get_note` for `obsidian://vault/{+path}`, `obsidian_list_tags` for `obsidian://tags`. Resources exist for clients that prefer attaching a specific note or vault snapshot to a conversation.
|
|
138
|
+
|
|
139
|
+
## Features
|
|
140
|
+
|
|
141
|
+
Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
|
|
142
|
+
|
|
143
|
+
- Declarative tool and resource definitions — single file per primitive, framework handles registration and validation
|
|
144
|
+
- Unified error handling — handlers throw, framework catches, classifies, and formats. Tools advertise their failure surface via typed `errors[]` contracts.
|
|
145
|
+
- Pluggable auth on the HTTP transport: `none`, `jwt`, `oauth`
|
|
146
|
+
- Structured logging with optional OpenTelemetry tracing
|
|
147
|
+
- STDIO and Streamable HTTP transports
|
|
148
|
+
|
|
149
|
+
The server itself is stateless — every tool call hits the Local REST API directly. The framework's storage backends, request-state KV, and progress streams aren't used here; Obsidian is single-vault and there's nothing to persist between calls.
|
|
150
|
+
|
|
151
|
+
Obsidian-specific:
|
|
152
|
+
|
|
153
|
+
- Wraps the [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) plugin — typed client, deterministic error mapping
|
|
154
|
+
- Section-aware editing across headings, block references, and frontmatter fields via `PATCH`-with-target operations
|
|
155
|
+
- Tag reconciliation across both representations: frontmatter `tags:` array and inline `#tag` syntax (skipping fenced code blocks)
|
|
156
|
+
- Search across three modes: text, Dataview DQL, JSONLogic — with overflow indicator when results exceed the 100-hit cap
|
|
157
|
+
- Optional human-in-the-loop confirmation for destructive deletes via `ctx.elicit`
|
|
158
|
+
- Opt-in `obsidian_execute_command` for the command palette — registered only when explicitly enabled
|
|
159
|
+
- Forgiving path resolution on `obsidian_get_note` and `obsidian_open_in_ui` — silently retries case-mismatched paths against the canonical filename, throws `Conflict` on ambiguous case matches, and enriches `NotFound` with `Did you mean: …?` suggestions when only near-matches exist. `obsidian_delete_note` is deliberately excluded — a destructive op shouldn't silently rewrite the target path.
|
|
160
|
+
|
|
161
|
+
## Getting started
|
|
162
|
+
|
|
163
|
+
Add the following to your MCP client configuration file. The Obsidian Local REST API plugin must be installed and enabled in your vault — see [Prerequisites](#prerequisites).
|
|
90
164
|
|
|
91
165
|
```json
|
|
92
166
|
{
|
|
93
167
|
"mcpServers": {
|
|
94
|
-
"obsidian
|
|
95
|
-
"
|
|
96
|
-
"
|
|
168
|
+
"obsidian": {
|
|
169
|
+
"type": "stdio",
|
|
170
|
+
"command": "bunx",
|
|
171
|
+
"args": ["obsidian-mcp-server@latest"],
|
|
97
172
|
"env": {
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
"disabled": false,
|
|
104
|
-
"autoApprove": []
|
|
173
|
+
"MCP_TRANSPORT_TYPE": "stdio",
|
|
174
|
+
"MCP_LOG_LEVEL": "info",
|
|
175
|
+
"OBSIDIAN_API_KEY": "your-local-rest-api-key"
|
|
176
|
+
}
|
|
105
177
|
}
|
|
106
178
|
}
|
|
107
179
|
}
|
|
108
180
|
```
|
|
109
181
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
If you installed from source, change `command` and `args` to point to your local build:
|
|
182
|
+
Or with npx (no Bun required):
|
|
113
183
|
|
|
114
184
|
```json
|
|
115
185
|
{
|
|
116
186
|
"mcpServers": {
|
|
117
|
-
"obsidian
|
|
118
|
-
"
|
|
119
|
-
"
|
|
187
|
+
"obsidian": {
|
|
188
|
+
"type": "stdio",
|
|
189
|
+
"command": "npx",
|
|
190
|
+
"args": ["-y", "obsidian-mcp-server@latest"],
|
|
120
191
|
"env": {
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"OBSIDIAN_ENABLE_CACHE": "true"
|
|
192
|
+
"MCP_TRANSPORT_TYPE": "stdio",
|
|
193
|
+
"MCP_LOG_LEVEL": "info",
|
|
194
|
+
"OBSIDIAN_API_KEY": "your-local-rest-api-key"
|
|
125
195
|
}
|
|
126
196
|
}
|
|
127
197
|
}
|
|
128
198
|
}
|
|
129
199
|
```
|
|
130
200
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
Configure the server using environment variables. These environmental variables are set within your MCP client config/settings (e.g. `cline_mcp_settings.json` for Cline, `claude_desktop_config.json` for Claude Desktop).
|
|
134
|
-
|
|
135
|
-
| Variable | Description | Required | Default |
|
|
136
|
-
| :------------------------------------ | :----------------------------------------------------------------------- | :------------------- | :----------------------- |
|
|
137
|
-
| **`OBSIDIAN_API_KEY`** | API Key from the Obsidian Local REST API plugin. | **Yes** | `undefined` |
|
|
138
|
-
| **`OBSIDIAN_BASE_URL`** | Base URL of your Obsidian Local REST API. | **Yes** | `http://127.0.0.1:27123` |
|
|
139
|
-
| `MCP_TRANSPORT_TYPE` | Server transport: `stdio` or `http`. | No | `stdio` |
|
|
140
|
-
| `MCP_HTTP_PORT` | Port for the HTTP server. | No | `3010` |
|
|
141
|
-
| `MCP_HTTP_HOST` | Host for the HTTP server. | No | `127.0.0.1` |
|
|
142
|
-
| `MCP_ALLOWED_ORIGINS` | Comma-separated origins for CORS. **Set for production.** | No | (none) |
|
|
143
|
-
| `MCP_AUTH_MODE` | Authentication strategy: `jwt` or `oauth`. | No | (none) |
|
|
144
|
-
| **`MCP_AUTH_SECRET_KEY`** | 32+ char secret for JWT. **Required for `jwt` mode.** | **Yes (if `jwt`)** | `undefined` |
|
|
145
|
-
| `OAUTH_ISSUER_URL` | URL of the OAuth 2.1 issuer. | **Yes (if `oauth`)** | `undefined` |
|
|
146
|
-
| `OAUTH_AUDIENCE` | Audience claim for OAuth tokens. | **Yes (if `oauth`)** | `undefined` |
|
|
147
|
-
| `OAUTH_JWKS_URI` | URI for the JSON Web Key Set (optional, derived from issuer if omitted). | No | (derived) |
|
|
148
|
-
| `MCP_LOG_LEVEL` | Logging level (`debug`, `info`, `error`, etc.). | No | `info` |
|
|
149
|
-
| `OBSIDIAN_VERIFY_SSL` | Set to `false` to disable SSL verification. | No | `true` |
|
|
150
|
-
| `OBSIDIAN_ENABLE_CACHE` | Set to `true` to enable the in-memory vault cache. | No | `true` |
|
|
151
|
-
| `OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN` | Refresh interval for the vault cache in minutes. | No | `10` |
|
|
152
|
-
|
|
153
|
-
### Connecting to the Obsidian API
|
|
154
|
-
|
|
155
|
-
To connect the MCP server to your Obsidian vault, you need to configure the base URL (`OBSIDIAN_BASE_URL`) and API key (`OBSIDIAN_API_KEY`). The Obsidian Local REST API plugin offers two ways to connect:
|
|
156
|
-
|
|
157
|
-
1. **Encrypted (HTTPS) - Default**:
|
|
158
|
-
|
|
159
|
-
- The plugin provides a secure `https://` endpoint (e.g., `https://127.0.0.1:27124`).
|
|
160
|
-
- This uses a self-signed certificate, which will cause connection errors by default.
|
|
161
|
-
- **To fix this**, you must set the `OBSIDIAN_VERIFY_SSL` environment variable to `"false"`. This tells the server to trust the self-signed certificate.
|
|
201
|
+
For Streamable HTTP, set the transport and start the server. Inline env vars work for one-off runs; for repeated use, copy values into `.env` (see [`.env.example`](./.env.example)) and run `bun run start:http`.
|
|
162
202
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
203
|
+
```sh
|
|
204
|
+
MCP_TRANSPORT_TYPE=http OBSIDIAN_API_KEY=... bun run start:http
|
|
205
|
+
# Server listens at http://127.0.0.1:3010/mcp by default
|
|
206
|
+
```
|
|
167
207
|
|
|
168
|
-
|
|
208
|
+
### Prerequisites
|
|
169
209
|
|
|
170
|
-
|
|
210
|
+
- [Bun v1.3.11](https://bun.sh/) or higher (or Node.js v22+).
|
|
211
|
+
- The [Obsidian Local REST API](https://github.com/coddingtonbear/obsidian-local-rest-api) plugin installed and enabled in your vault. Generate an API key in **Settings → Community Plugins → Local REST API** and copy it into `OBSIDIAN_API_KEY`.
|
|
212
|
+
- This server defaults to `http://127.0.0.1:27123` for simplicity. Enable **"Non-encrypted (HTTP) Server"** in the plugin settings to use it. To use the always-on HTTPS port instead, set `OBSIDIAN_BASE_URL=https://127.0.0.1:27124`; the plugin's self-signed cert is handled by `OBSIDIAN_VERIFY_SSL=false` (the default).
|
|
171
213
|
|
|
172
|
-
|
|
173
|
-
"env": {
|
|
174
|
-
"OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
|
|
175
|
-
"OBSIDIAN_BASE_URL": "http://127.0.0.1:27123"
|
|
176
|
-
}
|
|
177
|
-
```
|
|
214
|
+
### Installation
|
|
178
215
|
|
|
179
|
-
|
|
216
|
+
1. **Clone the repository:**
|
|
180
217
|
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"OBSIDIAN_BASE_URL": "https://127.0.0.1:27124",
|
|
185
|
-
"OBSIDIAN_VERIFY_SSL": "false"
|
|
186
|
-
}
|
|
187
|
-
```
|
|
218
|
+
```sh
|
|
219
|
+
git clone https://github.com/cyanheads/obsidian-mcp-server.git
|
|
220
|
+
```
|
|
188
221
|
|
|
189
|
-
|
|
222
|
+
2. **Navigate into the directory:**
|
|
190
223
|
|
|
191
|
-
|
|
224
|
+
```sh
|
|
225
|
+
cd obsidian-mcp-server
|
|
226
|
+
```
|
|
192
227
|
|
|
193
|
-
|
|
194
|
-
src/
|
|
195
|
-
├── index.ts # Entry point: Initializes and starts the server
|
|
196
|
-
├── config/ # Configuration loading (env vars, package info)
|
|
197
|
-
│ └── index.ts
|
|
198
|
-
├── mcp-server/ # Core MCP server logic and capability registration
|
|
199
|
-
│ ├── server.ts # Server setup, transport handling, tool/resource registration
|
|
200
|
-
│ ├── resources/ # MCP Resource implementations (currently none)
|
|
201
|
-
│ ├── tools/ # MCP Tool implementations (subdirs per tool)
|
|
202
|
-
│ └── transports/ # Stdio and HTTP transport logic
|
|
203
|
-
│ └── auth/ # Authentication strategies (JWT, OAuth)
|
|
204
|
-
├── services/ # Abstractions for external APIs or internal caching
|
|
205
|
-
│ └── obsidianRestAPI/ # Typed client for Obsidian Local REST API
|
|
206
|
-
├── types-global/ # Shared TypeScript type definitions (errors, etc.)
|
|
207
|
-
└── utils/ # Common utility functions (logger, error handler, security, etc.)
|
|
208
|
-
```
|
|
228
|
+
3. **Install dependencies:**
|
|
209
229
|
|
|
210
|
-
|
|
230
|
+
```sh
|
|
231
|
+
bun install
|
|
232
|
+
```
|
|
211
233
|
|
|
212
|
-
|
|
234
|
+
4. **Configure environment:**
|
|
213
235
|
|
|
214
|
-
|
|
236
|
+
```sh
|
|
237
|
+
cp .env.example .env
|
|
238
|
+
# edit .env and set OBSIDIAN_API_KEY
|
|
239
|
+
```
|
|
215
240
|
|
|
216
|
-
|
|
241
|
+
## Configuration
|
|
217
242
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
243
|
+
| Variable | Description | Default |
|
|
244
|
+
|:---------|:------------|:--------|
|
|
245
|
+
| `OBSIDIAN_API_KEY` | **Required.** Bearer token for the Obsidian Local REST API plugin. | — |
|
|
246
|
+
| `OBSIDIAN_BASE_URL` | Base URL of the Local REST API plugin. Use `https://127.0.0.1:27124` for the always-on HTTPS port (self-signed cert). | `http://127.0.0.1:27123` |
|
|
247
|
+
| `OBSIDIAN_VERIFY_SSL` | Verify the TLS certificate. Default `false` because the plugin uses a self-signed cert. On Node, the dispatcher's `rejectUnauthorized` option handles this without any process-wide change. On Bun, the runtime ignores that option, so the service additionally sets `NODE_TLS_REJECT_UNAUTHORIZED=0` — that fallback is scoped to Bun only. | `false` |
|
|
248
|
+
| `OBSIDIAN_REQUEST_TIMEOUT_MS` | Per-request timeout in milliseconds. | `30000` |
|
|
249
|
+
| `OBSIDIAN_ENABLE_COMMANDS` | Opt-in flag for `obsidian_execute_command`. Off by default — Obsidian commands are opaque and can be destructive. | `false` |
|
|
250
|
+
| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
|
|
251
|
+
| `MCP_HTTP_HOST` | Host for the HTTP server. | `127.0.0.1` |
|
|
252
|
+
| `MCP_HTTP_PORT` | Port for the HTTP server. | `3010` |
|
|
253
|
+
| `MCP_HTTP_ENDPOINT_PATH` | Endpoint path for the JSON-RPC handler. | `/mcp` |
|
|
254
|
+
| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
|
|
255
|
+
| `MCP_AUTH_SECRET_KEY` | **Required when `MCP_AUTH_MODE=jwt`.** ≥32-char shared secret used to verify incoming JWTs. | — |
|
|
256
|
+
| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
|
|
257
|
+
| `OTEL_ENABLED` | Enable OpenTelemetry. | `false` |
|
|
221
258
|
|
|
222
|
-
|
|
259
|
+
See [`.env.example`](./.env.example) for the full list of optional overrides.
|
|
223
260
|
|
|
224
|
-
|
|
225
|
-
2. **Periodic Refresh**: The cache automatically refreshes at a configurable interval (defaulting to 10 minutes). During a refresh, it only fetches content for files that are new or have been modified since the last check.
|
|
226
|
-
3. **Proactive Updates**: After a file is modified through a tool like `obsidian_update_file`, the service proactively updates the cache for that specific file, ensuring immediate consistency.
|
|
227
|
-
4. **Search Fallback**: The `obsidian_global_search` tool first attempts a live API search. If this fails, it automatically falls back to searching the in-memory cache.
|
|
261
|
+
## Running the server
|
|
228
262
|
|
|
229
|
-
###
|
|
263
|
+
### Local development
|
|
230
264
|
|
|
231
|
-
|
|
265
|
+
- **Hot-reload dev mode:**
|
|
232
266
|
|
|
233
|
-
|
|
234
|
-
|
|
267
|
+
```sh
|
|
268
|
+
bun run dev:stdio
|
|
269
|
+
bun run dev:http
|
|
270
|
+
```
|
|
235
271
|
|
|
236
|
-
|
|
272
|
+
- **Build and run the production version:**
|
|
237
273
|
|
|
238
|
-
|
|
274
|
+
```sh
|
|
275
|
+
# One-time build
|
|
276
|
+
bun run rebuild
|
|
239
277
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
| `obsidian_global_search` | Searches the entire vault for content. | `query`, `searchInPath?`, `useRegex?`, `page?`, `pageSize?` |
|
|
246
|
-
| `obsidian_list_notes` | Lists notes and subdirectories in a folder. | `dirPath`, `fileExtensionFilter?`, `nameRegexFilter?` |
|
|
247
|
-
| `obsidian_manage_frontmatter` | Gets, sets, or deletes keys in a note's frontmatter. | `filePath`, `operation`, `key`, `value?` |
|
|
248
|
-
| `obsidian_manage_tags` | Adds, removes, or lists tags in a note. | `filePath`, `operation`, `tags` |
|
|
249
|
-
| `obsidian_delete_note` | Permanently deletes a note from the vault. | `filePath` |
|
|
278
|
+
# Run the built server
|
|
279
|
+
bun run start:stdio
|
|
280
|
+
# or
|
|
281
|
+
bun run start:http
|
|
282
|
+
```
|
|
250
283
|
|
|
251
|
-
|
|
284
|
+
- **Run checks and tests:**
|
|
252
285
|
|
|
253
|
-
|
|
286
|
+
```sh
|
|
287
|
+
bun run devcheck # Lint, format, typecheck, security, changelog sync
|
|
288
|
+
bun run test # Vitest test suite
|
|
289
|
+
bun run lint:mcp # Validate MCP definitions against spec
|
|
290
|
+
```
|
|
254
291
|
|
|
255
|
-
|
|
292
|
+
### Docker
|
|
256
293
|
|
|
257
|
-
|
|
294
|
+
```sh
|
|
295
|
+
docker build -t obsidian-mcp-server .
|
|
296
|
+
docker run --rm -e OBSIDIAN_API_KEY=your-key -p 3010:3010 obsidian-mcp-server
|
|
297
|
+
```
|
|
258
298
|
|
|
259
|
-
|
|
299
|
+
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/obsidian-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.
|
|
260
300
|
|
|
261
|
-
|
|
301
|
+
## Project structure
|
|
262
302
|
|
|
263
|
-
|
|
303
|
+
| Directory | Purpose |
|
|
304
|
+
|:----------|:--------|
|
|
305
|
+
| `src/index.ts` | `createApp()` entry point — registers tools/resources and inits the Obsidian service. |
|
|
306
|
+
| `src/config` | Server-specific environment variable parsing (`OBSIDIAN_*`) with Zod. |
|
|
307
|
+
| `src/services/obsidian` | Local REST API client, frontmatter operations, section extractor, domain types. |
|
|
308
|
+
| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`) and shared input schemas. |
|
|
309
|
+
| `src/mcp-server/resources` | Resource definitions (`*.resource.ts`). |
|
|
310
|
+
| `src/mcp-server/prompts` | Prompt definitions (currently empty — CRUD/search shape doesn't benefit from a structured template). |
|
|
311
|
+
| `tests/` | Vitest tests mirroring `src/`. |
|
|
312
|
+
| `docs/` | Upstream OpenAPI spec for the Local REST API plugin and the generated `tree.md`. |
|
|
313
|
+
| `changelog/` | Per-version release notes; `CHANGELOG.md` is the regenerated rollup. |
|
|
264
314
|
|
|
265
|
-
|
|
266
|
-
# Install dependencies
|
|
267
|
-
npm install
|
|
315
|
+
## Development guide
|
|
268
316
|
|
|
269
|
-
|
|
270
|
-
npm run rebuild
|
|
317
|
+
See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
|
|
271
318
|
|
|
272
|
-
|
|
273
|
-
|
|
319
|
+
- Handlers throw, framework catches — no `try/catch` in tool logic
|
|
320
|
+
- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
|
|
321
|
+
- Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`
|
|
322
|
+
- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
|
|
274
323
|
|
|
275
|
-
|
|
276
|
-
npm run start:http
|
|
324
|
+
## Contributing
|
|
277
325
|
|
|
278
|
-
|
|
279
|
-
npm run format
|
|
326
|
+
Issues and pull requests are welcome. Run checks and tests before submitting:
|
|
280
327
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
npm run inspect:http
|
|
328
|
+
```sh
|
|
329
|
+
bun run devcheck
|
|
330
|
+
bun run test
|
|
285
331
|
```
|
|
286
332
|
|
|
287
333
|
## License
|
|
288
334
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
<div align="center">
|
|
294
|
-
Built with the <a href="https://modelcontextprotocol.io/">Model Context Protocol</a>
|
|
295
|
-
</div>
|
|
335
|
+
Apache-2.0 — see [LICENSE](LICENSE) for details.
|