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.
Files changed (253) hide show
  1. package/CLAUDE.md +364 -0
  2. package/Dockerfile +99 -0
  3. package/LICENSE +4 -6
  4. package/README.md +246 -206
  5. package/changelog/3.0.x/3.0.0.md +102 -0
  6. package/changelog/template.md +51 -0
  7. package/dist/config/server-config.d.ts +19 -0
  8. package/dist/config/server-config.d.ts.map +1 -0
  9. package/dist/config/server-config.js +55 -0
  10. package/dist/config/server-config.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -295
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp-server/prompts/definitions/index.d.ts +8 -0
  16. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  17. package/dist/mcp-server/prompts/definitions/index.js +8 -0
  18. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  19. package/dist/mcp-server/resources/definitions/index.d.ts +36 -0
  20. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  21. package/dist/mcp-server/resources/definitions/index.js +9 -0
  22. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  23. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts +23 -0
  24. package/dist/mcp-server/resources/definitions/obsidian-status.resource.d.ts.map +1 -0
  25. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js +47 -0
  26. package/dist/mcp-server/resources/definitions/obsidian-status.resource.js.map +1 -0
  27. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts +13 -0
  28. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.d.ts.map +1 -0
  29. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js +30 -0
  30. package/dist/mcp-server/resources/definitions/obsidian-tags.resource.js.map +1 -0
  31. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts +21 -0
  32. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts.map +1 -0
  33. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +38 -0
  34. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -0
  35. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts +45 -0
  36. package/dist/mcp-server/tools/definitions/_shared/schemas.d.ts.map +1 -0
  37. package/dist/mcp-server/tools/definitions/_shared/schemas.js +66 -0
  38. package/dist/mcp-server/tools/definitions/_shared/schemas.js.map +1 -0
  39. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts +51 -0
  40. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.d.ts.map +1 -0
  41. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js +120 -0
  42. package/dist/mcp-server/tools/definitions/_shared/suggest-paths.js.map +1 -0
  43. package/dist/mcp-server/tools/definitions/index.d.ts +531 -0
  44. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  45. package/dist/mcp-server/tools/definitions/index.js +38 -0
  46. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  47. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +42 -0
  48. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -0
  49. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +58 -0
  50. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -0
  51. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts +46 -0
  52. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -0
  53. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +66 -0
  54. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -0
  55. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts +19 -0
  56. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts.map +1 -0
  57. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js +43 -0
  58. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js.map +1 -0
  59. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts +92 -0
  60. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -0
  61. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +245 -0
  62. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -0
  63. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts +13 -0
  64. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.d.ts.map +1 -0
  65. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js +38 -0
  66. package/dist/mcp-server/tools/definitions/obsidian-list-commands.tool.js.map +1 -0
  67. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +59 -0
  68. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -0
  69. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +273 -0
  70. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -0
  71. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts +13 -0
  72. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.d.ts.map +1 -0
  73. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js +38 -0
  74. package/dist/mcp-server/tools/definitions/obsidian-list-tags.tool.js.map +1 -0
  75. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +68 -0
  76. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -0
  77. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +178 -0
  78. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -0
  79. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts +77 -0
  80. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -0
  81. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +172 -0
  82. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -0
  83. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +22 -0
  84. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -0
  85. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +88 -0
  86. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -0
  87. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +81 -0
  88. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -0
  89. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +83 -0
  90. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -0
  91. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts +59 -0
  92. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -0
  93. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +167 -0
  94. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -0
  95. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +76 -0
  96. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -0
  97. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +244 -0
  98. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -0
  99. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +41 -0
  100. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -0
  101. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +76 -0
  102. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -0
  103. package/dist/services/obsidian/frontmatter-ops.d.ts +34 -0
  104. package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -0
  105. package/dist/services/obsidian/frontmatter-ops.js +230 -0
  106. package/dist/services/obsidian/frontmatter-ops.js.map +1 -0
  107. package/dist/services/obsidian/obsidian-service.d.ts +73 -0
  108. package/dist/services/obsidian/obsidian-service.d.ts.map +1 -0
  109. package/dist/services/obsidian/obsidian-service.js +399 -0
  110. package/dist/services/obsidian/obsidian-service.js.map +1 -0
  111. package/dist/services/obsidian/section-extractor.d.ts +13 -0
  112. package/dist/services/obsidian/section-extractor.d.ts.map +1 -0
  113. package/dist/services/obsidian/section-extractor.js +124 -0
  114. package/dist/services/obsidian/section-extractor.js.map +1 -0
  115. package/dist/services/obsidian/types.d.ts +91 -0
  116. package/dist/services/obsidian/types.d.ts.map +1 -0
  117. package/dist/services/obsidian/types.js +7 -0
  118. package/dist/services/obsidian/types.js.map +1 -0
  119. package/package.json +63 -69
  120. package/server.json +167 -0
  121. package/CHANGELOG.md +0 -124
  122. package/dist/config/index.d.ts +0 -41
  123. package/dist/config/index.js +0 -191
  124. package/dist/mcp-server/server.d.ts +0 -33
  125. package/dist/mcp-server/server.js +0 -211
  126. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.d.ts +0 -12
  127. package/dist/mcp-server/tools/obsidianDeleteNoteTool/index.js +0 -12
  128. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.d.ts +0 -51
  129. package/dist/mcp-server/tools/obsidianDeleteNoteTool/logic.js +0 -168
  130. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.d.ts +0 -19
  131. package/dist/mcp-server/tools/obsidianDeleteNoteTool/registration.js +0 -91
  132. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +0 -12
  133. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +0 -12
  134. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +0 -77
  135. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +0 -341
  136. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +0 -18
  137. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +0 -69
  138. package/dist/mcp-server/tools/obsidianListNotesTool/index.d.ts +0 -12
  139. package/dist/mcp-server/tools/obsidianListNotesTool/index.js +0 -12
  140. package/dist/mcp-server/tools/obsidianListNotesTool/logic.d.ts +0 -68
  141. package/dist/mcp-server/tools/obsidianListNotesTool/logic.js +0 -215
  142. package/dist/mcp-server/tools/obsidianListNotesTool/registration.d.ts +0 -23
  143. package/dist/mcp-server/tools/obsidianListNotesTool/registration.js +0 -98
  144. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +0 -3
  145. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +0 -2
  146. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +0 -42
  147. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +0 -152
  148. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +0 -3
  149. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +0 -52
  150. package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +0 -3
  151. package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +0 -2
  152. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +0 -28
  153. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +0 -161
  154. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +0 -3
  155. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +0 -52
  156. package/dist/mcp-server/tools/obsidianReadNoteTool/index.d.ts +0 -12
  157. package/dist/mcp-server/tools/obsidianReadNoteTool/index.js +0 -12
  158. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.d.ts +0 -87
  159. package/dist/mcp-server/tools/obsidianReadNoteTool/logic.js +0 -216
  160. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.d.ts +0 -20
  161. package/dist/mcp-server/tools/obsidianReadNoteTool/registration.js +0 -101
  162. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +0 -12
  163. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +0 -12
  164. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +0 -255
  165. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +0 -583
  166. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +0 -22
  167. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +0 -111
  168. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.d.ts +0 -12
  169. package/dist/mcp-server/tools/obsidianUpdateNoteTool/index.js +0 -12
  170. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.d.ts +0 -183
  171. package/dist/mcp-server/tools/obsidianUpdateNoteTool/logic.js +0 -490
  172. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.d.ts +0 -21
  173. package/dist/mcp-server/tools/obsidianUpdateNoteTool/registration.js +0 -108
  174. package/dist/mcp-server/transports/auth/core/authContext.d.ts +0 -33
  175. package/dist/mcp-server/transports/auth/core/authContext.js +0 -24
  176. package/dist/mcp-server/transports/auth/core/authTypes.d.ts +0 -17
  177. package/dist/mcp-server/transports/auth/core/authTypes.js +0 -5
  178. package/dist/mcp-server/transports/auth/core/authUtils.d.ts +0 -18
  179. package/dist/mcp-server/transports/auth/core/authUtils.js +0 -45
  180. package/dist/mcp-server/transports/auth/index.d.ts +0 -10
  181. package/dist/mcp-server/transports/auth/index.js +0 -9
  182. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.d.ts +0 -27
  183. package/dist/mcp-server/transports/auth/strategies/jwt/jwtMiddleware.js +0 -149
  184. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.d.ts +0 -20
  185. package/dist/mcp-server/transports/auth/strategies/oauth/oauthMiddleware.js +0 -124
  186. package/dist/mcp-server/transports/httpErrorHandler.d.ts +0 -26
  187. package/dist/mcp-server/transports/httpErrorHandler.js +0 -73
  188. package/dist/mcp-server/transports/httpTransport.d.ts +0 -21
  189. package/dist/mcp-server/transports/httpTransport.js +0 -208
  190. package/dist/mcp-server/transports/stdioTransport.d.ts +0 -42
  191. package/dist/mcp-server/transports/stdioTransport.js +0 -63
  192. package/dist/services/obsidianRestAPI/index.d.ts +0 -15
  193. package/dist/services/obsidianRestAPI/index.js +0 -17
  194. package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +0 -38
  195. package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +0 -62
  196. package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +0 -22
  197. package/dist/services/obsidianRestAPI/methods/commandMethods.js +0 -31
  198. package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +0 -16
  199. package/dist/services/obsidianRestAPI/methods/openMethods.js +0 -21
  200. package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +0 -37
  201. package/dist/services/obsidianRestAPI/methods/patchMethods.js +0 -94
  202. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +0 -42
  203. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +0 -66
  204. package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +0 -25
  205. package/dist/services/obsidianRestAPI/methods/searchMethods.js +0 -36
  206. package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +0 -58
  207. package/dist/services/obsidianRestAPI/methods/vaultMethods.js +0 -144
  208. package/dist/services/obsidianRestAPI/service.d.ts +0 -195
  209. package/dist/services/obsidianRestAPI/service.js +0 -379
  210. package/dist/services/obsidianRestAPI/types.d.ts +0 -127
  211. package/dist/services/obsidianRestAPI/types.js +0 -7
  212. package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +0 -4
  213. package/dist/services/obsidianRestAPI/vaultCache/index.js +0 -4
  214. package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +0 -88
  215. package/dist/services/obsidianRestAPI/vaultCache/service.js +0 -299
  216. package/dist/types-global/errors.d.ts +0 -73
  217. package/dist/types-global/errors.js +0 -71
  218. package/dist/utils/index.d.ts +0 -5
  219. package/dist/utils/index.js +0 -13
  220. package/dist/utils/internal/asyncUtils.d.ts +0 -54
  221. package/dist/utils/internal/asyncUtils.js +0 -101
  222. package/dist/utils/internal/errorHandler.d.ts +0 -176
  223. package/dist/utils/internal/errorHandler.js +0 -351
  224. package/dist/utils/internal/index.d.ts +0 -4
  225. package/dist/utils/internal/index.js +0 -4
  226. package/dist/utils/internal/logger.d.ts +0 -141
  227. package/dist/utils/internal/logger.js +0 -406
  228. package/dist/utils/internal/requestContext.d.ts +0 -83
  229. package/dist/utils/internal/requestContext.js +0 -72
  230. package/dist/utils/metrics/index.d.ts +0 -1
  231. package/dist/utils/metrics/index.js +0 -1
  232. package/dist/utils/metrics/tokenCounter.d.ts +0 -27
  233. package/dist/utils/metrics/tokenCounter.js +0 -128
  234. package/dist/utils/obsidian/index.d.ts +0 -5
  235. package/dist/utils/obsidian/index.js +0 -5
  236. package/dist/utils/obsidian/obsidianApiUtils.d.ts +0 -14
  237. package/dist/utils/obsidian/obsidianApiUtils.js +0 -29
  238. package/dist/utils/obsidian/obsidianStatUtils.d.ts +0 -68
  239. package/dist/utils/obsidian/obsidianStatUtils.js +0 -143
  240. package/dist/utils/parsing/dateParser.d.ts +0 -56
  241. package/dist/utils/parsing/dateParser.js +0 -104
  242. package/dist/utils/parsing/index.d.ts +0 -2
  243. package/dist/utils/parsing/index.js +0 -3
  244. package/dist/utils/parsing/jsonParser.d.ts +0 -80
  245. package/dist/utils/parsing/jsonParser.js +0 -133
  246. package/dist/utils/security/idGenerator.d.ts +0 -140
  247. package/dist/utils/security/idGenerator.js +0 -194
  248. package/dist/utils/security/index.d.ts +0 -3
  249. package/dist/utils/security/index.js +0 -3
  250. package/dist/utils/security/rateLimiter.d.ts +0 -156
  251. package/dist/utils/security/rateLimiter.js +0 -235
  252. package/dist/utils/security/sanitization.d.ts +0 -244
  253. package/dist/utils/security/sanitization.js +0 -599
package/README.md CHANGED
@@ -1,295 +1,335 @@
1
- # Obsidian MCP Server
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
+ [![npm](https://img.shields.io/npm/v/obsidian-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/obsidian-mcp-server) [![Version](https://img.shields.io/badge/Version-3.0.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-259?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/)
2
11
 
3
- [![TypeScript](https://img.shields.io/badge/TypeScript-^5.8.3-blue.svg)](https://www.typescriptlang.org/)
4
- [![Model Context Protocol](https://img.shields.io/badge/MCP%20SDK-^1.13.0-green.svg)](https://modelcontextprotocol.io/)
5
- [![Version](https://img.shields.io/badge/Version-2.0.7-blue.svg)](./CHANGELOG.md)
6
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
- [![Status](https://img.shields.io/badge/Status-Production-brightgreen.svg)](https://github.com/cyanheads/obsidian-mcp-server/issues)
8
- [![GitHub](https://img.shields.io/github/stars/cyanheads/obsidian-mcp-server?style=social)](https://github.com/cyanheads/obsidian-mcp-server)
12
+ [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)
9
13
 
10
- **Empower your AI agents and development tools with seamless Obsidian integration!**
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## Tools
11
19
 
12
- An MCP (Model Context Protocol) server providing comprehensive access to your Obsidian vault. Enables LLMs and AI agents to read, write, search, and manage your notes and files through the [Obsidian Local REST API plugin](https://github.com/coddingtonbear/obsidian-local-rest-api).
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
- Built on the [`cyanheads/mcp-ts-template`](https://github.com/cyanheads/mcp-ts-template), this server follows a modular architecture with robust error handling, logging, and security features.
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
- ## 🚀 Core Capabilities: Obsidian Tools 🛠️
39
+ ### `obsidian_get_note`
17
40
 
18
- This server equips your AI with specialized tools to interact with your Obsidian vault:
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
- | Tool Name | Description | Key Features |
21
- | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
22
- | [`obsidian_read_note`](./src/mcp-server/tools/obsidianReadNoteTool/) | Retrieves the content and metadata of a specified note. | - Read in `markdown` or `json` format.<br/>- Case-insensitive path fallback.<br/>- Includes file stats (creation/modification time). |
23
- | [`obsidian_update_note`](./src/mcp-server/tools/obsidianUpdateNoteTool/) | Modifies notes using whole-file operations. | - `append`, `prepend`, or `overwrite` content.<br/>- Can create files if they don't exist.<br/>- Targets files by path, active note, or periodic note. |
24
- | [`obsidian_search_replace`](./src/mcp-server/tools/obsidianSearchReplaceTool/) | Performs search-and-replace operations within a target note. | - Supports string or regex search.<br/>- Options for case sensitivity, whole word, and replacing all occurrences. |
25
- | [`obsidian_global_search`](./src/mcp-server/tools/obsidianGlobalSearchTool/) | Performs a search across the entire vault. | - Text or regex search.<br/>- Filter by path and modification date.<br/>- Paginated results. |
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
- ## Table of Contents
52
+ ### `obsidian_search_notes`
34
53
 
35
- | [Overview](#overview) | [Features](#features) | [Configuration](#configuration) |
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
- ## Overview
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
- The Obsidian MCP Server acts as a bridge, allowing applications (MCP Clients) that understand the Model Context Protocol (MCP) like advanced AI assistants (LLMs), IDE extensions, or custom scripts to interact directly and safely with your Obsidian vault.
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
- Instead of complex scripting or manual interaction, your tools can leverage this server to:
62
+ ---
44
63
 
45
- - **Automate vault management**: Read notes, update content, manage frontmatter and tags, search across files, list directories, and delete files programmatically.
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
- Built on the robust `mcp-ts-template`, this server provides a standardized, secure, and efficient way to expose Obsidian functionality via the MCP standard. It achieves this by communicating with the powerful [Obsidian Local REST API plugin](https://github.com/coddingtonbear/obsidian-local-rest-api) running inside your vault.
66
+ Idempotent create/overwrite with optional in-place section replacement.
50
67
 
51
- > **Developer Note**: This repository includes a [.clinerules](.clinerules) file that serves as a developer cheat sheet for your LLM coding agent with quick reference for the codebase patterns, file locations, and code snippets.
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
- ## Features
71
+ Repeated calls with the same input converge on the same result.
54
72
 
55
- ### Core Utilities
73
+ ---
56
74
 
57
- Leverages the robust utilities provided by `cyanheads/mcp-ts-template`:
75
+ ### `obsidian_patch_note`
58
76
 
59
- - **Logging**: Structured, configurable logging (file rotation, console, MCP notifications) with sensitive data redaction.
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
- ### Obsidian Integration
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
- - **Obsidian Local REST API Integration**: Communicates directly with the Obsidian Local REST API plugin via HTTP requests managed by the `ObsidianRestApiService`.
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
- ## Installation
86
+ ---
77
87
 
78
- ### Prerequisites
88
+ ### `obsidian_replace_in_note`
79
89
 
80
- 1. **Obsidian**: You need Obsidian installed.
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
- ## Configuration
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
- ### MCP Client Settings
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
- Add the following to your MCP client's configuration file (e.g., `cline_mcp_settings.json`). This configuration uses `npx` to run the server, which will automatically download & install the package if not already present:
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-mcp-server": {
95
- "command": "npx",
96
- "args": ["obsidian-mcp-server"],
168
+ "obsidian": {
169
+ "type": "stdio",
170
+ "command": "bunx",
171
+ "args": ["obsidian-mcp-server@latest"],
97
172
  "env": {
98
- "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
99
- "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
100
- "OBSIDIAN_VERIFY_SSL": "false",
101
- "OBSIDIAN_ENABLE_CACHE": "true"
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
- **Note**: Verify SSL is set to false here because the Obsidian Local REST API plugin uses a self-signed certificate by default. If you are deploying this in a production environment, consider using the encrypted HTTPS endpoint and set `OBSIDIAN_VERIFY_SSL` to `true` after configuring your server to trust the self-signed certificate.
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-mcp-server": {
118
- "command": "node",
119
- "args": ["/path/to/your/obsidian-mcp-server/dist/index.js"],
187
+ "obsidian": {
188
+ "type": "stdio",
189
+ "command": "npx",
190
+ "args": ["-y", "obsidian-mcp-server@latest"],
120
191
  "env": {
121
- "OBSIDIAN_API_KEY": "YOUR_OBSIDIAN_API_KEY",
122
- "OBSIDIAN_BASE_URL": "http://127.0.0.1:27123",
123
- "OBSIDIAN_VERIFY_SSL": "false",
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
- ### Environment Variables
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
- 2. **Non-encrypted (HTTP) - Recommended for Simplicity**:
164
- - In the plugin's settings within Obsidian, you can enable the "Non-encrypted (HTTP) Server".
165
- - This provides a simpler `http://` endpoint (e.g., `http://127.0.0.1:27123`).
166
- - When using this URL, you do not need to worry about SSL verification.
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
- **Example `env` configuration for your MCP client:**
208
+ ### Prerequisites
169
209
 
170
- _Using the non-encrypted HTTP URL (recommended):_
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
- ```json
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
- _Using the encrypted HTTPS URL:_
216
+ 1. **Clone the repository:**
180
217
 
181
- ```json
182
- "env": {
183
- "OBSIDIAN_API_KEY": "YOUR_API_KEY_FROM_OBSIDIAN_PLUGIN",
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
- ## Project Structure
222
+ 2. **Navigate into the directory:**
190
223
 
191
- The codebase follows a modular structure within the `src/` directory:
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
- For a detailed file tree, run `npm run tree` or see [docs/tree.md](docs/tree.md).
230
+ ```sh
231
+ bun install
232
+ ```
211
233
 
212
- ## Vault Cache Service
234
+ 4. **Configure environment:**
213
235
 
214
- This server includes an intelligent **in-memory cache** designed to enhance performance and resilience when interacting with your vault.
236
+ ```sh
237
+ cp .env.example .env
238
+ # edit .env and set OBSIDIAN_API_KEY
239
+ ```
215
240
 
216
- ### Purpose and Benefits
241
+ ## Configuration
217
242
 
218
- - **Performance**: By caching file content and metadata, the server can perform search operations much faster, especially in large vaults. This reduces the number of direct requests to the Obsidian Local REST API, resulting in a snappier experience.
219
- - **Resilience**: The cache acts as a fallback for the `obsidian_global_search` tool. If the live API search fails or times out, the server seamlessly uses the cache to provide results, ensuring that search functionality remains available even if the Obsidian API is temporarily unresponsive.
220
- - **Efficiency**: The cache is designed to be efficient. It performs an initial build on startup and then periodically refreshes in the background by checking for file modifications, ensuring it stays reasonably up-to-date without constant, heavy API polling.
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
- ### How It Works
259
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
223
260
 
224
- 1. **Initialization**: When enabled, the `VaultCacheService` builds an in-memory map of all `.md` files in your vault, storing their content and modification times.
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
- ### Configuration
263
+ ### Local development
230
264
 
231
- The cache is enabled by default but can be configured via environment variables:
265
+ - **Hot-reload dev mode:**
232
266
 
233
- - **`OBSIDIAN_ENABLE_CACHE`**: Set to `true` (default) or `false` to enable or disable the cache service.
234
- - **`OBSIDIAN_CACHE_REFRESH_INTERVAL_MIN`**: Defines the interval in minutes for the periodic background refresh. Defaults to `10`.
267
+ ```sh
268
+ bun run dev:stdio
269
+ bun run dev:http
270
+ ```
235
271
 
236
- ## Tools
272
+ - **Build and run the production version:**
237
273
 
238
- The Obsidian MCP Server provides a suite of tools for interacting with your vault, callable via the Model Context Protocol.
274
+ ```sh
275
+ # One-time build
276
+ bun run rebuild
239
277
 
240
- | Tool Name | Description | Key Arguments |
241
- | :---------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------ |
242
- | `obsidian_read_note` | Retrieves the content and metadata of a note. | `filePath`, `format?`, `includeStat?` |
243
- | `obsidian_update_note` | Modifies a file by appending, prepending, or overwriting. | `targetType`, `content`, `targetIdentifier?`, `wholeFileMode` |
244
- | `obsidian_search_replace` | Performs search-and-replace operations in a note. | `targetType`, `replacements`, `useRegex?`, `replaceAll?` |
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
- _Note: All tools support comprehensive error handling and return structured JSON responses._
284
+ - **Run checks and tests:**
252
285
 
253
- ## Resources
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
- **MCP Resources are not implemented in this version.**
292
+ ### Docker
256
293
 
257
- This server currently focuses on providing interactive tools for vault manipulation. Future development may introduce resource capabilities (e.g., exposing notes or search results as readable resources).
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
- ## Development
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
- ### Build and Test
301
+ ## Project structure
262
302
 
263
- To get started with development, clone the repository, install dependencies, and use the following scripts:
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
- ```bash
266
- # Install dependencies
267
- npm install
315
+ ## Development guide
268
316
 
269
- # Build the project (compile TS to JS in dist/ and make executable)
270
- npm run rebuild
317
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
271
318
 
272
- # Start the server locally using stdio transport
273
- npm start:stdio
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
- # Start the server using http transport
276
- npm run start:http
324
+ ## Contributing
277
325
 
278
- # Format code using Prettier
279
- npm run format
326
+ Issues and pull requests are welcome. Run checks and tests before submitting:
280
327
 
281
- # Inspect the server's capabilities using the MCP Inspector tool
282
- npm run inspect:stdio
283
- # or for the http transport:
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
- This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
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.