mcp-server-obsidian 0.0.0-stage → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/LICENSE +21 -0
  3. package/README.md +819 -2
  4. package/SECURITY.md +56 -0
  5. package/dist/api/ObsidianAPI.d.ts +69 -0
  6. package/dist/api/ObsidianAPI.d.ts.map +1 -0
  7. package/dist/api/ObsidianAPI.js +205 -0
  8. package/dist/api/ObsidianAPI.js.map +1 -0
  9. package/dist/connectors/BaseConnector.d.ts +109 -0
  10. package/dist/connectors/BaseConnector.d.ts.map +1 -0
  11. package/dist/connectors/BaseConnector.js +153 -0
  12. package/dist/connectors/BaseConnector.js.map +1 -0
  13. package/dist/connectors/LocalConnector.d.ts +53 -0
  14. package/dist/connectors/LocalConnector.d.ts.map +1 -0
  15. package/dist/connectors/LocalConnector.js +363 -0
  16. package/dist/connectors/LocalConnector.js.map +1 -0
  17. package/dist/connectors/RemoteConnector.d.ts +33 -0
  18. package/dist/connectors/RemoteConnector.d.ts.map +1 -0
  19. package/dist/connectors/RemoteConnector.js +331 -0
  20. package/dist/connectors/RemoteConnector.js.map +1 -0
  21. package/dist/index.d.ts +10 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +125 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/server.d.ts +61 -0
  26. package/dist/server.d.ts.map +1 -0
  27. package/dist/server.js +831 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/services/CanvasService.d.ts +112 -0
  30. package/dist/services/CanvasService.d.ts.map +1 -0
  31. package/dist/services/CanvasService.js +343 -0
  32. package/dist/services/CanvasService.js.map +1 -0
  33. package/dist/services/DataviewService.d.ts +50 -0
  34. package/dist/services/DataviewService.d.ts.map +1 -0
  35. package/dist/services/DataviewService.js +524 -0
  36. package/dist/services/DataviewService.js.map +1 -0
  37. package/dist/services/KnowledgeGraph.d.ts +86 -0
  38. package/dist/services/KnowledgeGraph.d.ts.map +1 -0
  39. package/dist/services/KnowledgeGraph.js +364 -0
  40. package/dist/services/KnowledgeGraph.js.map +1 -0
  41. package/dist/services/PeriodicNotesService.d.ts +65 -0
  42. package/dist/services/PeriodicNotesService.d.ts.map +1 -0
  43. package/dist/services/PeriodicNotesService.js +309 -0
  44. package/dist/services/PeriodicNotesService.js.map +1 -0
  45. package/dist/services/TemplateService.d.ts +51 -0
  46. package/dist/services/TemplateService.d.ts.map +1 -0
  47. package/dist/services/TemplateService.js +308 -0
  48. package/dist/services/TemplateService.js.map +1 -0
  49. package/dist/types/canvas.d.ts +57 -0
  50. package/dist/types/canvas.d.ts.map +1 -0
  51. package/dist/types/canvas.js +13 -0
  52. package/dist/types/canvas.js.map +1 -0
  53. package/dist/types/dataview.d.ts +60 -0
  54. package/dist/types/dataview.d.ts.map +1 -0
  55. package/dist/types/dataview.js +5 -0
  56. package/dist/types/dataview.js.map +1 -0
  57. package/dist/types/index.d.ts +122 -0
  58. package/dist/types/index.d.ts.map +1 -0
  59. package/dist/types/index.js +12 -0
  60. package/dist/types/index.js.map +1 -0
  61. package/dist/types/periodic.d.ts +45 -0
  62. package/dist/types/periodic.d.ts.map +1 -0
  63. package/dist/types/periodic.js +31 -0
  64. package/dist/types/periodic.js.map +1 -0
  65. package/dist/types/template.d.ts +63 -0
  66. package/dist/types/template.d.ts.map +1 -0
  67. package/dist/types/template.js +5 -0
  68. package/dist/types/template.js.map +1 -0
  69. package/dist/utils/config.d.ts +65 -0
  70. package/dist/utils/config.d.ts.map +1 -0
  71. package/dist/utils/config.js +290 -0
  72. package/dist/utils/config.js.map +1 -0
  73. package/dist/utils/date.d.ts +64 -0
  74. package/dist/utils/date.d.ts.map +1 -0
  75. package/dist/utils/date.js +483 -0
  76. package/dist/utils/date.js.map +1 -0
  77. package/dist/utils/errors.d.ts +16 -0
  78. package/dist/utils/errors.d.ts.map +1 -0
  79. package/dist/utils/errors.js +27 -0
  80. package/dist/utils/errors.js.map +1 -0
  81. package/dist/utils/frontmatter.d.ts +58 -0
  82. package/dist/utils/frontmatter.d.ts.map +1 -0
  83. package/dist/utils/frontmatter.js +124 -0
  84. package/dist/utils/frontmatter.js.map +1 -0
  85. package/dist/utils/fs.d.ts +50 -0
  86. package/dist/utils/fs.d.ts.map +1 -0
  87. package/dist/utils/fs.js +177 -0
  88. package/dist/utils/fs.js.map +1 -0
  89. package/dist/utils/http.d.ts +41 -0
  90. package/dist/utils/http.d.ts.map +1 -0
  91. package/dist/utils/http.js +122 -0
  92. package/dist/utils/http.js.map +1 -0
  93. package/dist/utils/links.d.ts +28 -0
  94. package/dist/utils/links.d.ts.map +1 -0
  95. package/dist/utils/links.js +140 -0
  96. package/dist/utils/links.js.map +1 -0
  97. package/dist/utils/markdown.d.ts +58 -0
  98. package/dist/utils/markdown.d.ts.map +1 -0
  99. package/dist/utils/markdown.js +262 -0
  100. package/dist/utils/markdown.js.map +1 -0
  101. package/dist/utils/paths.d.ts +120 -0
  102. package/dist/utils/paths.d.ts.map +1 -0
  103. package/dist/utils/paths.js +225 -0
  104. package/dist/utils/paths.js.map +1 -0
  105. package/docs/CLAUDE_DESKTOP_SETUP.md +315 -0
  106. package/docs/QUICKSTART.md +195 -0
  107. package/docs/TESTING.md +232 -0
  108. package/docs/VAULT_TYPES.md +264 -0
  109. package/obsidian-mcp.example.json +37 -0
  110. package/package.json +82 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,177 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.1] - 2026-12-05
9
+
10
+ ### Fixed
11
+
12
+ - **The package page on npm showed no README.** The README lived in `docs/`, and npm only
13
+ reads one from the root of the package. It now sits at the root of the repository and of the
14
+ package, with its links to the other documents adjusted.
15
+
16
+ ## [2.0.0] - 2026-12-05
17
+
18
+ A security and correctness release. Everyone on 1.0.0 should upgrade. The project also has
19
+ a new name, `mcp-server-obsidian`, and is on npm for the first time.
20
+
21
+ ### Security
22
+
23
+ - **Path traversal in every file tool** ([#3], [#5]). Note, canvas and template tools joined
24
+ caller-supplied paths onto the vault folder without checking the result, so an MCP client
25
+ could read, write and delete files anywhere the server process could reach, with paths
26
+ such as `../../.ssh/id_rsa`. All paths now go through `resolveVaultPath` (introduced in [#4]
27
+ for canvas and templates, and extended here to `get_note`, `create_note`, `update_note`,
28
+ `delete_note`, periodic notes and note resources): absolute paths and `..` segments are
29
+ rejected and the resolved path must lie inside the vault.
30
+ - **Symbolic links out of the vault are refused.** A link inside the vault that points
31
+ outside it was followed. It is now rejected, as is a broken link (writing through one
32
+ creates its target). Set `"allowSymlinksOutsideVault": true` on a vault that shares
33
+ folders through symlinks on purpose.
34
+ - **Code execution through frontmatter.** Notes were parsed with gray-matter, which
35
+ evaluates front matter fenced as `---js` as JavaScript. Opening or indexing a note with
36
+ such a block ran its code with the server's privileges. Frontmatter is now parsed as YAML
37
+ data only.
38
+ - **Tools are limited to their file types.** Note tools only touch `.md` files and canvas
39
+ tools only `.canvas` files, so they cannot be used on `.obsidian/` configuration, plugin
40
+ code or anything else in the vault folder.
41
+ - **Prototype pollution in `dataview_query`.** Field paths such as `__proto__.x` in
42
+ `select` could write to `Object.prototype`. Field paths now only follow own properties.
43
+ - **Vulnerable dependencies removed.** `npm audit` reported 17 advisories in production
44
+ dependencies (2 critical, 12 high); it now reports none. See *Dependencies* below.
45
+ - Error messages no longer include the absolute path of the vault on disk.
46
+ - Added `"readOnly": true` for vaults, [SECURITY.md](SECURITY.md) and tool annotations
47
+ (`readOnlyHint`, `destructiveHint`) so clients can tell which tools change things.
48
+
49
+ ### Fixed
50
+
51
+ - **`create_note` silently replaced existing notes.** It now fails if the note exists, unless
52
+ `overwrite: true` is passed. `create_canvas` and `create_from_template` no longer overwrite
53
+ either.
54
+ - **`update_note` erased frontmatter** whenever it was called without a `frontmatter`
55
+ argument. The existing frontmatter is now kept, byte for byte. It also no longer creates
56
+ a note that does not exist.
57
+ - **Changes made in Obsidian were never seen.** The file watcher used a glob pattern that
58
+ chokidar 4 does not support, so it never fired, and newly created files were not handled
59
+ at all. The index is now checked against the vault folder (size and modification time)
60
+ before it is used, and re-reads only what changed.
61
+ - **Dates were off by one day west of UTC.** `create_daily_note` with `2025-10-16` created
62
+ the note for 15 October in American time zones, `{{date:FORMAT}}` in templates had the
63
+ same error, and date-range filters were off at their ends. Dates are now calendar days in
64
+ the server's time zone. An invalid date is an error rather than a note called `NaN-NaN-NaN.md`.
65
+ - **Weekly notes around New Year got the wrong name.** The week of 29 December 2025 was named
66
+ `2025-W01`, the same as the first week of January 2025. The default format is now
67
+ `GGGG-[W]WW` (ISO week-numbering year).
68
+ - **Week and month ranges were wrong** for weeks that cross a month boundary and for months
69
+ when computed from the 29th to the 31st (`startDate` / `endDate` template variables).
70
+ - **Template formats were cut at the first colon**: `{{time:HH:mm:ss}}` rendered only the
71
+ hour. Extra frontmatter passed to templates is now written as valid YAML (values with
72
+ colons, lists of objects and nested values were corrupted before).
73
+ - **Backlinks, related notes and orphan detection missed most links.** `[[Plan]]` was only
74
+ matched against `Plan.md` in the vault root. Links are now resolved the way Obsidian
75
+ resolves them: by file name anywhere in the vault, by partial path, or relative to the
76
+ linking note. `get_related_notes` could also miss notes within the requested depth.
77
+ - **Bogus tags and links.** `[[Note#Heading]]` produced a tag `Heading` and a link to a note
78
+ called `Note#Heading`; URL fragments and `#` inside code became tags; `![[embed]]` was
79
+ counted as an embed and as a link. Tags now also support non-ASCII characters.
80
+ - **`get_vault_stats` always returned `"tags": {}`** (a `Map` does not serialise to JSON).
81
+ - **A numeric frontmatter `title` broke `search_notes`** for the whole vault, and a note with
82
+ invalid YAML frontmatter disappeared from the vault. Such notes now stay visible and
83
+ carry a `frontmatterError`.
84
+ - **Canvas edits overwrote each other** when a client issued several tool calls at once;
85
+ edits to one canvas are now applied one after the other. Canvases that Obsidian created
86
+ as an empty file or `{}` no longer crash `add_canvas_node`, and `add_canvas_edge` rejects
87
+ edges to nodes that are not on the canvas.
88
+ - **`dataview_query`:** numbers and dates are compared as numbers and dates (`rating > "4"`,
89
+ `due < "2024-06-01"` and `modified >= "2024-01-01"` now work). A date in a filter is a
90
+ calendar day in the server's time zone and, compared with a time of day, stands for the
91
+ whole day, so `modified = "2024-06-01"` finds the notes changed that day. `groupBy`
92
+ together with `select` no longer puts everything in one `(none)` group; notes missing the
93
+ sort field always sort last; frontmatter can no longer override `path` or `tags`; `from`
94
+ and the `folder` filter of `search_notes` match whole folder names (`Proj` no longer
95
+ matches `Projects/`); inline fields inside code blocks are ignored.
96
+ - **The config file was not found under Claude Desktop.** It was looked up relative to the
97
+ working directory, which the client chooses. It is now also looked for next to the server,
98
+ and can be named with `--config` or `OBSIDIAN_MCP_CONFIG`. `~` in vault paths is expanded.
99
+ An invalid config file is reported instead of being silently ignored.
100
+ - **Resource URIs were invalid** for vault names or paths containing spaces; they are now
101
+ percent-encoded.
102
+ - The server now exits when the client disconnects instead of lingering.
103
+ - Failed operations are reported as MCP tool errors (`isError`); many previously came back
104
+ as successful results containing `"success": false`.
105
+ - `npm run lint` works again (ESLint 9 dropped the old config format; CI was hiding the
106
+ failure), and the coverage thresholds that failed CI are now met (96% of statements).
107
+
108
+ ### Added
109
+
110
+ - Tools that were documented but missing: `delete_canvas_node`, `delete_canvas_edge` and
111
+ `find_path`.
112
+ - `list_vaults`, and `vault` may be omitted on every tool when only one vault is configured.
113
+ - Obsidian app tools, offered only when `obsidianApi` is configured: `open_in_obsidian`,
114
+ `get_active_note`, `list_obsidian_commands`, `execute_obsidian_command`. The previous
115
+ client used routes that the Local REST API plugin does not have and no tool called it.
116
+ - The documented `periodicNotes` config section now works, globally and per vault, along
117
+ with a `templates` section. With no configuration, daily notes and templates follow the
118
+ vault's own Obsidian settings (`.obsidian/daily-notes.json`, `.obsidian/templates.json`).
119
+ - Moment-style date formats everywhere (`dddd`, `MMMM`, `Do`, `[literal]`, ...).
120
+ - Markdown-style links to notes (`[text](Folder/Note.md)`) count as links.
121
+ - `analyze_graph` reports clusters; the graph marks unresolved links and attachments
122
+ instead of leaving edges that point nowhere.
123
+ - Input validation for every tool, with titles and descriptions.
124
+ - `--config`, `--version`, `--help`; a `LICENSE` file.
125
+ - The package is published to npm, so an MCP client can start the server with
126
+ `npx -y mcp-server-obsidian`; no clone or build is needed. `scripts/release.sh` runs the
127
+ checks, pushes, publishes to npm, tags and creates the GitHub release.
128
+ - `server.json` and the `mcpName` field, for listing the server in the MCP Registry.
129
+ - 570 new tests (625 in total), including end-to-end tests through an MCP client. Date
130
+ handling is tested in several time zones.
131
+
132
+ ### Changed
133
+
134
+ - **New name: `mcp-server-obsidian`** (was `obsidian-mcp-server`), for the package and the
135
+ GitHub repository; links to the old repository redirect. The installed command is
136
+ `mcp-server-obsidian` (was `obsidian-mcp`). Configuration files (`obsidian-mcp.json`) and
137
+ environment variables keep their names.
138
+ - **Node.js 22.13 or newer is required** (was 18; Node.js 18 and 20 are end-of-life).
139
+ - `dataview_query` rows are flat: each field appears once instead of once at the top level
140
+ and again under `metadata`. `metadata.<field>` is still accepted in queries.
141
+ - Frontmatter dates are kept as written (`2024-01-15`) rather than converted to
142
+ timestamps (`2024-01-15T00:00:00.000Z`).
143
+ - Periodic note results give `date` as `YYYY-MM-DD` (the first day of the period).
144
+ - `{{week}}` in templates is zero-padded (`03`), as documented.
145
+ - Weekly notes are named by ISO week-numbering year (see *Fixed*).
146
+ - The server is built on the SDK's `McpServer` API; the low-level `Server` class it used is
147
+ deprecated. The entry point is split into `src/index.ts` (command line) and `src/server.ts`.
148
+ - Remote vaults: `get_note` always asks the server instead of answering from a cache that
149
+ was never refreshed; path segments are encoded separately (`a/b.md`, not `a%2Fb.md`);
150
+ empty notes are no longer dropped. The REST contract a remote server has to implement is
151
+ now documented in `docs/VAULT_TYPES.md`. The quick start wrongly said remote vaults work
152
+ with the Local REST API plugin; they do not.
153
+ - `server.version` in the config file is ignored; the version reported to clients is the
154
+ package version.
155
+
156
+ ### Dependencies
157
+
158
+ - Removed `gray-matter` (unmaintained; see *Security*), `chokidar`, `glob`, `axios` and the
159
+ unused `ws`, in favour of the `yaml` package and Node.js built-ins. Production
160
+ dependencies are now `@modelcontextprotocol/sdk`, `yaml` and `zod`.
161
+ - `@modelcontextprotocol/sdk` 1.20.1 → 1.32.2, `zod` 4.1.12 → 4.6.7.
162
+ - TypeScript 5.9 → 6.0, ESLint 9 → 10 (flat config), Jest 30.2 → 30.5, typescript-eslint
163
+ 8.46 → 8.74. TypeScript 7 is not used yet because ts-jest and typescript-eslint do not
164
+ support it.
165
+ - GitHub Actions updated to their current major versions; CI runs on Node.js 22 (including
166
+ 22.13, the oldest supported version), 24 and 26, and on macOS.
167
+
168
+ ## [1.0.0] - 2025-10-16
169
+
170
+ Initial version.
171
+
172
+ [2.0.1]: https://github.com/bazylhorsey/mcp-server-obsidian/releases/tag/v2.0.1
173
+ [2.0.0]: https://github.com/bazylhorsey/mcp-server-obsidian/releases/tag/v2.0.0
174
+ [1.0.0]: https://github.com/bazylhorsey/mcp-server-obsidian/tree/ba06b16757467b5a0acf5eebc71398213c254ede
175
+ [#3]: https://github.com/bazylhorsey/mcp-server-obsidian/issues/3
176
+ [#4]: https://github.com/bazylhorsey/mcp-server-obsidian/pull/4
177
+ [#5]: https://github.com/bazylhorsey/mcp-server-obsidian/issues/5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Bazyl Horsey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.