obsidian-mcp-server 1.5.8 → 2.0.2

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 (221) hide show
  1. package/README.md +248 -104
  2. package/dist/config/index.d.ts +41 -0
  3. package/dist/config/index.js +191 -0
  4. package/dist/index.d.ts +1 -5
  5. package/dist/index.js +296 -18
  6. package/dist/mcp-server/server.d.ts +33 -0
  7. package/dist/mcp-server/server.js +211 -0
  8. package/dist/mcp-server/tools/obsidianDeleteFileTool/index.d.ts +12 -0
  9. package/dist/mcp-server/tools/obsidianDeleteFileTool/index.js +12 -0
  10. package/dist/mcp-server/tools/obsidianDeleteFileTool/logic.d.ts +51 -0
  11. package/dist/mcp-server/tools/obsidianDeleteFileTool/logic.js +168 -0
  12. package/dist/mcp-server/tools/obsidianDeleteFileTool/registration.d.ts +19 -0
  13. package/dist/mcp-server/tools/obsidianDeleteFileTool/registration.js +91 -0
  14. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.d.ts +12 -0
  15. package/dist/mcp-server/tools/obsidianGlobalSearchTool/index.js +12 -0
  16. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.d.ts +77 -0
  17. package/dist/mcp-server/tools/obsidianGlobalSearchTool/logic.js +341 -0
  18. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.d.ts +18 -0
  19. package/dist/mcp-server/tools/obsidianGlobalSearchTool/registration.js +69 -0
  20. package/dist/mcp-server/tools/obsidianListFilesTool/index.d.ts +12 -0
  21. package/dist/mcp-server/tools/obsidianListFilesTool/index.js +12 -0
  22. package/dist/mcp-server/tools/obsidianListFilesTool/logic.d.ts +64 -0
  23. package/dist/mcp-server/tools/obsidianListFilesTool/logic.js +179 -0
  24. package/dist/mcp-server/tools/obsidianListFilesTool/registration.d.ts +19 -0
  25. package/dist/mcp-server/tools/obsidianListFilesTool/registration.js +96 -0
  26. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.d.ts +3 -0
  27. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/index.js +2 -0
  28. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.d.ts +42 -0
  29. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/logic.js +152 -0
  30. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.d.ts +3 -0
  31. package/dist/mcp-server/tools/obsidianManageFrontmatterTool/registration.js +52 -0
  32. package/dist/mcp-server/tools/obsidianManageTagsTool/index.d.ts +3 -0
  33. package/dist/mcp-server/tools/obsidianManageTagsTool/index.js +2 -0
  34. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.d.ts +28 -0
  35. package/dist/mcp-server/tools/obsidianManageTagsTool/logic.js +161 -0
  36. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.d.ts +3 -0
  37. package/dist/mcp-server/tools/obsidianManageTagsTool/registration.js +52 -0
  38. package/dist/mcp-server/tools/obsidianReadFileTool/index.d.ts +12 -0
  39. package/dist/mcp-server/tools/obsidianReadFileTool/index.js +12 -0
  40. package/dist/mcp-server/tools/obsidianReadFileTool/logic.d.ts +87 -0
  41. package/dist/mcp-server/tools/obsidianReadFileTool/logic.js +216 -0
  42. package/dist/mcp-server/tools/obsidianReadFileTool/registration.d.ts +20 -0
  43. package/dist/mcp-server/tools/obsidianReadFileTool/registration.js +101 -0
  44. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.d.ts +12 -0
  45. package/dist/mcp-server/tools/obsidianSearchReplaceTool/index.js +12 -0
  46. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.d.ts +255 -0
  47. package/dist/mcp-server/tools/obsidianSearchReplaceTool/logic.js +583 -0
  48. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.d.ts +22 -0
  49. package/dist/mcp-server/tools/obsidianSearchReplaceTool/registration.js +111 -0
  50. package/dist/mcp-server/tools/obsidianUpdateFileTool/index.d.ts +12 -0
  51. package/dist/mcp-server/tools/obsidianUpdateFileTool/index.js +12 -0
  52. package/dist/mcp-server/tools/obsidianUpdateFileTool/logic.d.ts +183 -0
  53. package/dist/mcp-server/tools/obsidianUpdateFileTool/logic.js +490 -0
  54. package/dist/mcp-server/tools/obsidianUpdateFileTool/registration.d.ts +21 -0
  55. package/dist/mcp-server/tools/obsidianUpdateFileTool/registration.js +108 -0
  56. package/dist/mcp-server/transports/authentication/authContext.d.ts +33 -0
  57. package/dist/mcp-server/transports/authentication/authContext.js +24 -0
  58. package/dist/mcp-server/transports/authentication/authMiddleware.d.ts +30 -0
  59. package/dist/mcp-server/transports/authentication/authMiddleware.js +145 -0
  60. package/dist/mcp-server/transports/authentication/authUtils.d.ts +18 -0
  61. package/dist/mcp-server/transports/authentication/authUtils.js +45 -0
  62. package/dist/mcp-server/transports/authentication/oauthMiddleware.d.ts +24 -0
  63. package/dist/mcp-server/transports/authentication/oauthMiddleware.js +109 -0
  64. package/dist/mcp-server/transports/authentication/types.d.ts +17 -0
  65. package/dist/mcp-server/transports/authentication/types.js +5 -0
  66. package/dist/mcp-server/transports/httpTransport.d.ts +24 -0
  67. package/dist/mcp-server/transports/httpTransport.js +496 -0
  68. package/dist/mcp-server/transports/stdioTransport.d.ts +42 -0
  69. package/dist/mcp-server/transports/stdioTransport.js +63 -0
  70. package/dist/services/obsidianRestAPI/index.d.ts +15 -0
  71. package/dist/services/obsidianRestAPI/index.js +17 -0
  72. package/dist/services/obsidianRestAPI/methods/activeFileMethods.d.ts +38 -0
  73. package/dist/services/obsidianRestAPI/methods/activeFileMethods.js +62 -0
  74. package/dist/services/obsidianRestAPI/methods/commandMethods.d.ts +22 -0
  75. package/dist/services/obsidianRestAPI/methods/commandMethods.js +31 -0
  76. package/dist/services/obsidianRestAPI/methods/openMethods.d.ts +16 -0
  77. package/dist/services/obsidianRestAPI/methods/openMethods.js +21 -0
  78. package/dist/services/obsidianRestAPI/methods/patchMethods.d.ts +37 -0
  79. package/dist/services/obsidianRestAPI/methods/patchMethods.js +94 -0
  80. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.d.ts +42 -0
  81. package/dist/services/obsidianRestAPI/methods/periodicNoteMethods.js +66 -0
  82. package/dist/services/obsidianRestAPI/methods/searchMethods.d.ts +25 -0
  83. package/dist/services/obsidianRestAPI/methods/searchMethods.js +36 -0
  84. package/dist/services/obsidianRestAPI/methods/vaultMethods.d.ts +58 -0
  85. package/dist/services/obsidianRestAPI/methods/vaultMethods.js +144 -0
  86. package/dist/services/obsidianRestAPI/service.d.ts +195 -0
  87. package/dist/services/obsidianRestAPI/service.js +379 -0
  88. package/dist/services/obsidianRestAPI/types.d.ts +127 -0
  89. package/dist/services/obsidianRestAPI/types.js +7 -0
  90. package/dist/services/obsidianRestAPI/vaultCache/index.d.ts +4 -0
  91. package/dist/services/obsidianRestAPI/vaultCache/index.js +4 -0
  92. package/dist/services/obsidianRestAPI/vaultCache/service.d.ts +88 -0
  93. package/dist/services/obsidianRestAPI/vaultCache/service.js +299 -0
  94. package/dist/types-global/errors.d.ts +73 -0
  95. package/dist/types-global/errors.js +71 -0
  96. package/dist/utils/index.d.ts +5 -8
  97. package/dist/utils/index.js +13 -9
  98. package/dist/utils/internal/asyncUtils.d.ts +54 -0
  99. package/dist/utils/internal/asyncUtils.js +101 -0
  100. package/dist/utils/internal/errorHandler.d.ts +176 -0
  101. package/dist/utils/internal/errorHandler.js +351 -0
  102. package/dist/utils/internal/index.d.ts +4 -0
  103. package/dist/utils/internal/index.js +4 -0
  104. package/dist/utils/internal/logger.d.ts +141 -0
  105. package/dist/utils/internal/logger.js +406 -0
  106. package/dist/utils/internal/requestContext.d.ts +83 -0
  107. package/dist/utils/internal/requestContext.js +72 -0
  108. package/dist/utils/metrics/index.d.ts +1 -0
  109. package/dist/utils/metrics/index.js +1 -0
  110. package/dist/utils/metrics/tokenCounter.d.ts +27 -0
  111. package/dist/utils/metrics/tokenCounter.js +128 -0
  112. package/dist/utils/obsidian/index.d.ts +5 -0
  113. package/dist/utils/obsidian/index.js +5 -0
  114. package/dist/utils/obsidian/obsidianApiUtils.d.ts +14 -0
  115. package/dist/utils/obsidian/obsidianApiUtils.js +29 -0
  116. package/dist/utils/obsidian/obsidianStatUtils.d.ts +68 -0
  117. package/dist/utils/obsidian/obsidianStatUtils.js +143 -0
  118. package/dist/utils/parsing/dateParser.d.ts +56 -0
  119. package/dist/utils/parsing/dateParser.js +104 -0
  120. package/dist/utils/parsing/index.d.ts +2 -0
  121. package/dist/utils/parsing/index.js +3 -0
  122. package/dist/utils/parsing/jsonParser.d.ts +80 -0
  123. package/dist/utils/parsing/jsonParser.js +133 -0
  124. package/dist/utils/security/idGenerator.d.ts +140 -0
  125. package/dist/utils/security/idGenerator.js +194 -0
  126. package/dist/utils/security/index.d.ts +3 -0
  127. package/dist/utils/security/index.js +3 -0
  128. package/dist/utils/security/rateLimiter.d.ts +156 -0
  129. package/dist/utils/security/rateLimiter.js +235 -0
  130. package/dist/utils/security/sanitization.d.ts +244 -0
  131. package/dist/utils/security/sanitization.js +599 -0
  132. package/package.json +58 -37
  133. package/dist/index.js.map +0 -1
  134. package/dist/mcp/handlers.d.ts +0 -29
  135. package/dist/mcp/handlers.js +0 -305
  136. package/dist/mcp/handlers.js.map +0 -1
  137. package/dist/mcp/index.d.ts +0 -6
  138. package/dist/mcp/index.js +0 -7
  139. package/dist/mcp/index.js.map +0 -1
  140. package/dist/mcp/server.d.ts +0 -18
  141. package/dist/mcp/server.js +0 -240
  142. package/dist/mcp/server.js.map +0 -1
  143. package/dist/mcp/types.d.ts +0 -70
  144. package/dist/mcp/types.js +0 -49
  145. package/dist/mcp/types.js.map +0 -1
  146. package/dist/obsidian/client.d.ts +0 -109
  147. package/dist/obsidian/client.js +0 -403
  148. package/dist/obsidian/client.js.map +0 -1
  149. package/dist/obsidian/errors.d.ts +0 -28
  150. package/dist/obsidian/errors.js +0 -75
  151. package/dist/obsidian/errors.js.map +0 -1
  152. package/dist/obsidian/index.d.ts +0 -6
  153. package/dist/obsidian/index.js +0 -7
  154. package/dist/obsidian/index.js.map +0 -1
  155. package/dist/obsidian/types.d.ts +0 -107
  156. package/dist/obsidian/types.js +0 -12
  157. package/dist/obsidian/types.js.map +0 -1
  158. package/dist/resources/index.d.ts +0 -13
  159. package/dist/resources/index.js +0 -15
  160. package/dist/resources/index.js.map +0 -1
  161. package/dist/resources/tags.d.ts +0 -39
  162. package/dist/resources/tags.js +0 -257
  163. package/dist/resources/tags.js.map +0 -1
  164. package/dist/resources/types.d.ts +0 -27
  165. package/dist/resources/types.js +0 -5
  166. package/dist/resources/types.js.map +0 -1
  167. package/dist/tools/base.d.ts +0 -46
  168. package/dist/tools/base.js +0 -88
  169. package/dist/tools/base.js.map +0 -1
  170. package/dist/tools/files/content.d.ts +0 -58
  171. package/dist/tools/files/content.js +0 -171
  172. package/dist/tools/files/content.js.map +0 -1
  173. package/dist/tools/files/index.d.ts +0 -14
  174. package/dist/tools/files/index.js +0 -22
  175. package/dist/tools/files/index.js.map +0 -1
  176. package/dist/tools/files/list.d.ts +0 -35
  177. package/dist/tools/files/list.js +0 -133
  178. package/dist/tools/files/list.js.map +0 -1
  179. package/dist/tools/index.d.ts +0 -21
  180. package/dist/tools/index.js +0 -31
  181. package/dist/tools/index.js.map +0 -1
  182. package/dist/tools/properties/index.d.ts +0 -14
  183. package/dist/tools/properties/index.js +0 -19
  184. package/dist/tools/properties/index.js.map +0 -1
  185. package/dist/tools/properties/manager.d.ts +0 -62
  186. package/dist/tools/properties/manager.js +0 -302
  187. package/dist/tools/properties/manager.js.map +0 -1
  188. package/dist/tools/properties/tools.d.ts +0 -47
  189. package/dist/tools/properties/tools.js +0 -239
  190. package/dist/tools/properties/tools.js.map +0 -1
  191. package/dist/tools/properties/types.d.ts +0 -141
  192. package/dist/tools/properties/types.js +0 -70
  193. package/dist/tools/properties/types.js.map +0 -1
  194. package/dist/tools/search/complex.d.ts +0 -38
  195. package/dist/tools/search/complex.js +0 -270
  196. package/dist/tools/search/complex.js.map +0 -1
  197. package/dist/tools/search/index.d.ts +0 -14
  198. package/dist/tools/search/index.js +0 -20
  199. package/dist/tools/search/index.js.map +0 -1
  200. package/dist/tools/search/simple.d.ts +0 -25
  201. package/dist/tools/search/simple.js +0 -127
  202. package/dist/tools/search/simple.js.map +0 -1
  203. package/dist/utils/errors.d.ts +0 -24
  204. package/dist/utils/errors.js +0 -59
  205. package/dist/utils/errors.js.map +0 -1
  206. package/dist/utils/idGenerator.d.ts +0 -15
  207. package/dist/utils/idGenerator.js +0 -21
  208. package/dist/utils/idGenerator.js.map +0 -1
  209. package/dist/utils/index.js.map +0 -1
  210. package/dist/utils/logging.d.ts +0 -245
  211. package/dist/utils/logging.js +0 -417
  212. package/dist/utils/logging.js.map +0 -1
  213. package/dist/utils/rate-limiting.d.ts +0 -50
  214. package/dist/utils/rate-limiting.js +0 -94
  215. package/dist/utils/rate-limiting.js.map +0 -1
  216. package/dist/utils/tokenization.d.ts +0 -28
  217. package/dist/utils/tokenization.js +0 -75
  218. package/dist/utils/tokenization.js.map +0 -1
  219. package/dist/utils/validation.d.ts +0 -22
  220. package/dist/utils/validation.js +0 -92
  221. package/dist/utils/validation.js.map +0 -1
@@ -1,171 +0,0 @@
1
- import { createLogger } from "../../utils/logging.js";
2
- import { BaseToolHandler } from "../base.js";
3
- // Create a logger for file content operations
4
- const logger = createLogger('FileContentTools');
5
- /**
6
- * Tool names for file content operations
7
- */
8
- export const FILE_CONTENT_TOOL_NAMES = {
9
- GET_FILE_CONTENTS: "obsidian_get_file_contents",
10
- APPEND_CONTENT: "obsidian_append_content",
11
- UPDATE_CONTENT: "obsidian_update_content" // Renamed from PATCH_CONTENT
12
- };
13
- /**
14
- * Tool handler for getting file contents
15
- */
16
- export class GetFileContentsToolHandler extends BaseToolHandler {
17
- constructor(client) {
18
- super(FILE_CONTENT_TOOL_NAMES.GET_FILE_CONTENTS, client);
19
- }
20
- getToolDescription() {
21
- return {
22
- name: this.name,
23
- description: "Retrieves the full content of a specified file within your Obsidian vault. Supports various readable file formats.",
24
- examples: [
25
- {
26
- description: "Get content of a markdown note",
27
- args: {
28
- filepath: "Projects/research.md"
29
- }
30
- },
31
- {
32
- description: "Get content of a configuration file",
33
- args: {
34
- filepath: "configs/settings.yml"
35
- }
36
- }
37
- ],
38
- inputSchema: {
39
- type: "object",
40
- properties: {
41
- filepath: {
42
- type: "string",
43
- description: "Path to the relevant file (relative to your vault root).",
44
- format: "path"
45
- }
46
- },
47
- required: ["filepath"]
48
- }
49
- };
50
- }
51
- async runTool(args) {
52
- try {
53
- logger.debug(`Getting contents of file: ${args.filepath}`);
54
- const content = await this.client.getFileContents(args.filepath);
55
- return this.createResponse(content);
56
- }
57
- catch (error) {
58
- return this.handleError(error);
59
- }
60
- }
61
- }
62
- /**
63
- * Tool handler for appending content to a file
64
- */
65
- export class AppendContentToolHandler extends BaseToolHandler {
66
- constructor(client) {
67
- super(FILE_CONTENT_TOOL_NAMES.APPEND_CONTENT, client);
68
- }
69
- getToolDescription() {
70
- return {
71
- name: this.name,
72
- description: "Appends the provided content to the end of a specified file in the vault. If the file does not exist, it will be created.",
73
- examples: [
74
- {
75
- description: "Append a new task",
76
- args: {
77
- filepath: "tasks.md",
78
- content: "- [ ] New task to complete"
79
- }
80
- },
81
- {
82
- description: "Append meeting notes",
83
- args: {
84
- filepath: "meetings/2025-01-23.md",
85
- content: "## Meeting Notes\n\n- Discussed project timeline\n- Assigned tasks"
86
- }
87
- }
88
- ],
89
- inputSchema: {
90
- type: "object",
91
- properties: {
92
- filepath: {
93
- type: "string",
94
- description: "Path to the file (relative to vault root)",
95
- format: "path"
96
- },
97
- content: {
98
- type: "string",
99
- description: "Content to append to the file"
100
- }
101
- },
102
- required: ["filepath", "content"]
103
- }
104
- };
105
- }
106
- async runTool(args) {
107
- try {
108
- logger.debug(`Appending content to file: ${args.filepath}`);
109
- await this.client.appendContent(args.filepath, args.content);
110
- return this.createResponse({
111
- message: `Successfully appended content to ${args.filepath}`,
112
- success: true
113
- });
114
- }
115
- catch (error) {
116
- return this.handleError(error);
117
- }
118
- }
119
- }
120
- /**
121
- * Tool handler for updating file content
122
- */
123
- export class UpdateContentToolHandler extends BaseToolHandler {
124
- constructor(client) {
125
- super(FILE_CONTENT_TOOL_NAMES.UPDATE_CONTENT, client); // Renamed from PATCH_CONTENT
126
- }
127
- getToolDescription() {
128
- return {
129
- name: this.name, // Will be obsidian_update_content
130
- description: "Overwrites the entire content of a specified file in the vault with the provided content. If the file does not exist, it will be created.",
131
- examples: [
132
- {
133
- description: "Overwrite a note's content",
134
- args: {
135
- filepath: "project.md",
136
- content: "# Project Notes\n\nThis will replace the entire content of the note."
137
- }
138
- }
139
- ],
140
- inputSchema: {
141
- type: "object",
142
- properties: {
143
- filepath: {
144
- type: "string",
145
- description: "Path to the file (relative to vault root)",
146
- format: "path"
147
- },
148
- content: {
149
- type: "string",
150
- description: "The new, complete content for the file (overwrites existing content)."
151
- }
152
- },
153
- required: ["filepath", "content"]
154
- }
155
- };
156
- }
157
- async runTool(args) {
158
- try {
159
- logger.debug(`Updating content of file: ${args.filepath}`);
160
- await this.client.updateContent(args.filepath, args.content);
161
- return this.createResponse({
162
- message: `Successfully updated content in ${args.filepath}`,
163
- success: true
164
- });
165
- }
166
- catch (error) {
167
- return this.handleError(error);
168
- }
169
- }
170
- }
171
- //# sourceMappingURL=content.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/tools/files/content.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,iBAAiB,EAAE,4BAA4B;IAC/C,cAAc,EAAE,yBAAyB;IACzC,cAAc,EAAE,yBAAyB,CAAC,6BAA6B;CAC/D,CAAC;AAyBX;;GAEG;AAC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AAK,CAAC,uBAAuB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,6BAA6B;IACtF,CAAC;IAED,kBAAkB;QAChB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,kCAAkC;YACnD,WAAW,EAAE,2IAA2I;YACxJ,QAAQ,EAAE;gBACR;oBACE,WAAW,EAAE,4BAA4B;oBACzC,IAAI,EAAE;wBACJ,QAAQ,EAAE,YAAY;wBACtB,OAAO,EAAE,sEAAsE;qBAChF;iBACF;aACF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2CAA2C;wBACxD,MAAM,EAAE,MAAM;qBACf;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,uEAAuE;qBACrF;iBACF;gBACD,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;aAClC;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAuB;QACnC,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,6BAA6B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,mCAAmC,IAAI,CAAC,QAAQ,EAAE;gBAC3D,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
@@ -1,14 +0,0 @@
1
- /**
2
- * File operation tools exports
3
- */
4
- export * from './content.js';
5
- export * from './list.js';
6
- import { ObsidianClient } from '../../obsidian/client.js';
7
- import { AppendContentToolHandler, GetFileContentsToolHandler, UpdateContentToolHandler } from './content.js';
8
- import { ListFilesInDirToolHandler, ListFilesInVaultToolHandler } from './list.js';
9
- /**
10
- * Create all file-related tool handlers
11
- * @param client The ObsidianClient instance
12
- * @returns Array of file tool handlers
13
- */
14
- export declare function createFileToolHandlers(client: ObsidianClient): (GetFileContentsToolHandler | AppendContentToolHandler | UpdateContentToolHandler | ListFilesInVaultToolHandler | ListFilesInDirToolHandler)[];
@@ -1,22 +0,0 @@
1
- /**
2
- * File operation tools exports
3
- */
4
- export * from './content.js';
5
- export * from './list.js';
6
- import { AppendContentToolHandler, GetFileContentsToolHandler, UpdateContentToolHandler } from './content.js';
7
- import { ListFilesInDirToolHandler, ListFilesInVaultToolHandler } from './list.js';
8
- /**
9
- * Create all file-related tool handlers
10
- * @param client The ObsidianClient instance
11
- * @returns Array of file tool handlers
12
- */
13
- export function createFileToolHandlers(client) {
14
- return [
15
- new ListFilesInVaultToolHandler(client),
16
- new ListFilesInDirToolHandler(client),
17
- new GetFileContentsToolHandler(client),
18
- new AppendContentToolHandler(client),
19
- new UpdateContentToolHandler(client)
20
- ];
21
- }
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/files/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAG1B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,WAAW,CAAC;AAEnB;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,OAAO;QACL,IAAI,2BAA2B,CAAC,MAAM,CAAC;QACvC,IAAI,yBAAyB,CAAC,MAAM,CAAC;QACrC,IAAI,0BAA0B,CAAC,MAAM,CAAC;QACtC,IAAI,wBAAwB,CAAC,MAAM,CAAC;QACpC,IAAI,wBAAwB,CAAC,MAAM,CAAC;KACrC,CAAC;AACJ,CAAC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * File listing tools implementation
3
- */
4
- import { Tool } from "@modelcontextprotocol/sdk/types.js";
5
- import { ObsidianClient } from "../../obsidian/client.js";
6
- import { BaseToolHandler } from "../base.js";
7
- /**
8
- * Tool names for file listing operations
9
- */
10
- export declare const FILE_TOOL_NAMES: {
11
- readonly LIST_FILES_IN_VAULT: "obsidian_list_files_in_vault";
12
- readonly LIST_FILES_IN_DIR: "obsidian_list_files_in_dir";
13
- };
14
- /**
15
- * Arguments for directory listing
16
- */
17
- export interface ListFilesArgs {
18
- dirpath: string;
19
- }
20
- /**
21
- * Tool handler for listing all files in the vault
22
- */
23
- export declare class ListFilesInVaultToolHandler extends BaseToolHandler<Record<string, never>> {
24
- constructor(client: ObsidianClient);
25
- getToolDescription(): Tool;
26
- runTool(): Promise<Array<any>>;
27
- }
28
- /**
29
- * Tool handler for listing files in a specific directory
30
- */
31
- export declare class ListFilesInDirToolHandler extends BaseToolHandler<ListFilesArgs> {
32
- constructor(client: ObsidianClient);
33
- getToolDescription(): Tool;
34
- runTool(args: ListFilesArgs): Promise<Array<any>>;
35
- }
@@ -1,133 +0,0 @@
1
- import { createLogger } from "../../utils/logging.js";
2
- import { BaseToolHandler } from "../base.js";
3
- // Create a logger for file operations
4
- const logger = createLogger('FileTools');
5
- /**
6
- * Tool names for file listing operations
7
- */
8
- export const FILE_TOOL_NAMES = {
9
- LIST_FILES_IN_VAULT: "obsidian_list_files_in_vault",
10
- LIST_FILES_IN_DIR: "obsidian_list_files_in_dir"
11
- };
12
- /**
13
- * Tool handler for listing all files in the vault
14
- */
15
- export class ListFilesInVaultToolHandler extends BaseToolHandler {
16
- constructor(client) {
17
- super(FILE_TOOL_NAMES.LIST_FILES_IN_VAULT, client);
18
- }
19
- getToolDescription() {
20
- return {
21
- name: this.name,
22
- description: "Lists all files and directories within the root of your Obsidian vault. Returns a hierarchical structure detailing files, folders, and their types.",
23
- examples: [
24
- {
25
- description: "List all files in vault",
26
- args: {}
27
- },
28
- {
29
- description: "Example response",
30
- args: {},
31
- response: [
32
- {
33
- "path": "Daily Notes",
34
- "type": "folder",
35
- "children": [
36
- { "path": "Daily Notes/2025-01-24.md", "type": "file" }
37
- ]
38
- },
39
- {
40
- "path": "Projects",
41
- "type": "folder",
42
- "children": [
43
- { "path": "Projects/MCP.md", "type": "file" }
44
- ]
45
- }
46
- ]
47
- }
48
- ],
49
- inputSchema: {
50
- type: "object",
51
- properties: {},
52
- required: []
53
- }
54
- };
55
- }
56
- async runTool() {
57
- try {
58
- logger.debug('Listing all files in vault');
59
- const files = await this.client.listFilesInVault();
60
- return this.createResponse(files);
61
- }
62
- catch (error) {
63
- return this.handleError(error);
64
- }
65
- }
66
- }
67
- /**
68
- * Tool handler for listing files in a specific directory
69
- */
70
- export class ListFilesInDirToolHandler extends BaseToolHandler {
71
- constructor(client) {
72
- super(FILE_TOOL_NAMES.LIST_FILES_IN_DIR, client);
73
- }
74
- getToolDescription() {
75
- return {
76
- name: this.name,
77
- description: "Lists files and directories within a specific folder in your Obsidian vault. Returns a hierarchical structure. Note: Empty directories may not be included in the results. Useful for exploring vault organization.",
78
- examples: [
79
- {
80
- description: "List files in Documents folder",
81
- args: {
82
- dirpath: "Documents"
83
- }
84
- },
85
- {
86
- description: "Example response structure",
87
- args: {
88
- dirpath: "Projects"
89
- },
90
- response: [
91
- {
92
- "path": "Projects/Active",
93
- "type": "folder",
94
- "children": [
95
- { "path": "Projects/Active/ProjectA.md", "type": "file" },
96
- { "path": "Projects/Active/ProjectB.md", "type": "file" }
97
- ]
98
- },
99
- {
100
- "path": "Projects/Archive",
101
- "type": "folder",
102
- "children": [
103
- { "path": "Projects/Archive/OldProject.md", "type": "file" }
104
- ]
105
- }
106
- ]
107
- }
108
- ],
109
- inputSchema: {
110
- type: "object",
111
- properties: {
112
- dirpath: {
113
- type: "string",
114
- description: "Path to list files from (relative to your vault root). Note that empty directories will not be returned.",
115
- format: "path"
116
- }
117
- },
118
- required: ["dirpath"]
119
- }
120
- };
121
- }
122
- async runTool(args) {
123
- try {
124
- logger.debug(`Listing files in directory: ${args.dirpath}`);
125
- const files = await this.client.listFilesInDir(args.dirpath);
126
- return this.createResponse(files);
127
- }
128
- catch (error) {
129
- return this.handleError(error);
130
- }
131
- }
132
- }
133
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/tools/files/list.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,sCAAsC;AACtC,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mBAAmB,EAAE,8BAA8B;IACnD,iBAAiB,EAAE,4BAA4B;CACvC,CAAC;AASX;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,eAAsC;IACrF,YAAY,MAAsB;QAChC,KAAK,CAAC,eAAe,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,kBAAkB;QAChB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,qJAAqJ;YAClK,QAAQ,EAAE;gBACR;oBACE,WAAW,EAAE,yBAAyB;oBACtC,IAAI,EAAE,EAAE;iBACT;gBACD;oBACE,WAAW,EAAE,kBAAkB;oBAC/B,IAAI,EAAE,EAAE;oBACR,QAAQ,EAAE;wBACR;4BACE,MAAM,EAAE,aAAa;4BACrB,MAAM,EAAE,QAAQ;4BAChB,UAAU,EAAE;gCACV,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,EAAE;6BACxD;yBACF;wBACD;4B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E,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE;6BAC1D;yBACF;wBACD;4BACE,MAAM,EAAE,kBAAkB;4BAC1B,MAAM,EAAE,QAAQ;4BAChB,UAAU,EAAE;gCACV,EAAE,MAAM,EAAE,gCAAgC,EAAE,MAAM,EAAE,MAAM,EAAE;6BAC7D;yBACF;qBACF;iBACF;aACF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,0GAA0G;wBACvH,MAAM,EAAE,MAAM;qBACf;iBACF;gBACD,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAmB;QAC/B,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,+BAA+B,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Tools module exports
3
- */
4
- import { ObsidianClient } from '../obsidian/client.js';
5
- import { BaseToolHandler } from './base.js';
6
- export * from './base.js';
7
- export * from './files/index.js';
8
- export * from './properties/index.js';
9
- export * from './search/index.js';
10
- /**
11
- * Create all tool handlers
12
- * @param client The ObsidianClient instance
13
- * @returns Array of all tool handlers
14
- */
15
- export declare function createToolHandlers(client: ObsidianClient): (import("./files/content.js").GetFileContentsToolHandler | import("./files/content.js").AppendContentToolHandler | import("./files/content.js").UpdateContentToolHandler | import("./files/list.js").ListFilesInVaultToolHandler | import("./files/list.js").ListFilesInDirToolHandler | import("./properties/tools.js").GetPropertiesToolHandler | import("./properties/tools.js").UpdatePropertiesToolHandler | import("./search/complex.js").ComplexSearchToolHandler | import("./search/complex.js").GetTagsToolHandler | import("./search/simple.js").FindInFileToolHandler)[];
16
- /**
17
- * Get a tool handler map by name
18
- * @param handlers Array of tool handlers
19
- * @returns Map of tool names to handlers
20
- */
21
- export declare function createToolHandlerMap<T extends BaseToolHandler<any>>(handlers: T[]): Map<string, BaseToolHandler<Record<string, unknown>>>;
@@ -1,31 +0,0 @@
1
- import { createFileToolHandlers } from './files/index.js';
2
- import { createPropertyToolHandlers } from './properties/index.js';
3
- import { createSearchToolHandlers } from './search/index.js';
4
- // Export the base handler and all submodules
5
- export * from './base.js';
6
- export * from './files/index.js';
7
- export * from './properties/index.js';
8
- export * from './search/index.js';
9
- /**
10
- * Create all tool handlers
11
- * @param client The ObsidianClient instance
12
- * @returns Array of all tool handlers
13
- */
14
- export function createToolHandlers(client) {
15
- return [
16
- ...createFileToolHandlers(client),
17
- ...createSearchToolHandlers(client),
18
- ...createPropertyToolHandlers(client)
19
- ];
20
- }
21
- /**
22
- * Get a tool handler map by name
23
- * @param handlers Array of tool handlers
24
- * @returns Map of tool names to handlers
25
- */
26
- export function createToolHandlerMap(handlers) {
27
- const toolHandlerMap = new Map();
28
- handlers.forEach(handler => toolHandlerMap.set(handler.name, handler));
29
- return toolHandlerMap;
30
- }
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,6CAA6C;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,OAAO;QACL,GAAG,sBAAsB,CAAC,MAAM,CAAC;QACjC,GAAG,wBAAwB,CAAC,MAAM,CAAC;QACnC,GAAG,0BAA0B,CAAC,MAAM,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAiC,QAAa;IAChF,MAAM,cAAc,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC1D,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Properties module exports
3
- */
4
- export * from './manager.js';
5
- export * from './tools.js';
6
- export * from './types.js';
7
- import { ObsidianClient } from '../../obsidian/client.js';
8
- import { GetPropertiesToolHandler, UpdatePropertiesToolHandler } from './tools.js';
9
- /**
10
- * Create all property-related tool handlers
11
- * @param client The ObsidianClient instance
12
- * @returns Array of property tool handlers
13
- */
14
- export declare function createPropertyToolHandlers(client: ObsidianClient): (GetPropertiesToolHandler | UpdatePropertiesToolHandler)[];
@@ -1,19 +0,0 @@
1
- /**
2
- * Properties module exports
3
- */
4
- export * from './manager.js';
5
- export * from './tools.js';
6
- export * from './types.js';
7
- import { GetPropertiesToolHandler, UpdatePropertiesToolHandler } from './tools.js';
8
- /**
9
- * Create all property-related tool handlers
10
- * @param client The ObsidianClient instance
11
- * @returns Array of property tool handlers
12
- */
13
- export function createPropertyToolHandlers(client) {
14
- return [
15
- new GetPropertiesToolHandler(client),
16
- new UpdatePropertiesToolHandler(client)
17
- ];
18
- }
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/properties/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEnF;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAsB;IAC/D,OAAO;QACL,IAAI,wBAAwB,CAAC,MAAM,CAAC;QACpC,IAAI,2BAA2B,CAAC,MAAM,CAAC;KACxC,CAAC;AACJ,CAAC"}
@@ -1,62 +0,0 @@
1
- import { ObsidianClient } from '../../obsidian/client.js';
2
- import { ObsidianProperties, PropertyManagerResult, ValidationResult } from './types.js';
3
- /**
4
- * Result type for parseProperties, including match details
5
- */
6
- interface ParseResult {
7
- properties: ObsidianProperties;
8
- match?: {
9
- startIndex: number;
10
- endIndex: number;
11
- rawFrontmatter: string;
12
- };
13
- error?: Error;
14
- }
15
- /**
16
- * Manages YAML frontmatter properties in Obsidian notes
17
- */
18
- export declare class PropertyManager {
19
- private client;
20
- constructor(client: ObsidianClient);
21
- /**
22
- * Parse YAML frontmatter from note content. Finds the *first* valid block.
23
- * @param content The note content
24
- * @returns ParseResult containing properties and match details or error.
25
- */
26
- parseProperties(content: string): ParseResult;
27
- /**
28
- * Generate YAML frontmatter from properties
29
- * @param properties The properties to convert to YAML
30
- * @returns YAML frontmatter string
31
- */
32
- generateProperties(properties: Partial<ObsidianProperties>): string;
33
- /**
34
- * Validate property values against schema
35
- * @param properties The properties to validate
36
- * @returns Validation result
37
- */
38
- validateProperties(properties: Partial<ObsidianProperties>): ValidationResult;
39
- /**
40
- * Merge new properties with existing ones
41
- * @param existing The existing properties
42
- * @param updates The new properties to merge
43
- * @param replace Whether to replace arrays instead of merging them
44
- * @returns The merged properties
45
- */
46
- mergeProperties(existing: ObsidianProperties, updates: Partial<ObsidianProperties>, replace?: boolean): ObsidianProperties;
47
- /**
48
- * Get properties from a note
49
- * @param filepath Path to the note
50
- * @returns The result including properties or errors
51
- */
52
- getProperties(filepath: string): Promise<PropertyManagerResult>;
53
- /**
54
- * Update properties of a note
55
- * @param filepath Path to the note
56
- * @param newProperties The new properties to apply
57
- * @param replace Whether to replace arrays instead of merging them
58
- * @returns The result of the update operation
59
- */
60
- updateProperties(filepath: string, newProperties: Partial<ObsidianProperties>, replace?: boolean): Promise<PropertyManagerResult>;
61
- }
62
- export {};