@aniketbiswas/obsidian-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/build/index.d.ts +26 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +148 -0
- package/build/index.js.map +1 -0
- package/build/prompts/index.d.ts +33 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +152 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/obsidian.d.ts +17 -0
- package/build/prompts/obsidian.d.ts.map +1 -0
- package/build/prompts/obsidian.js +305 -0
- package/build/prompts/obsidian.js.map +1 -0
- package/build/resources/index.d.ts +31 -0
- package/build/resources/index.d.ts.map +1 -0
- package/build/resources/index.js +111 -0
- package/build/resources/index.js.map +1 -0
- package/build/resources/obsidian.d.ts +19 -0
- package/build/resources/obsidian.d.ts.map +1 -0
- package/build/resources/obsidian.js +246 -0
- package/build/resources/obsidian.js.map +1 -0
- package/build/tools/_template.d.ts +23 -0
- package/build/tools/_template.d.ts.map +1 -0
- package/build/tools/_template.js +124 -0
- package/build/tools/_template.js.map +1 -0
- package/build/tools/calculator.d.ts +32 -0
- package/build/tools/calculator.d.ts.map +1 -0
- package/build/tools/calculator.js +130 -0
- package/build/tools/calculator.js.map +1 -0
- package/build/tools/daily-notes.d.ts +19 -0
- package/build/tools/daily-notes.d.ts.map +1 -0
- package/build/tools/daily-notes.js +469 -0
- package/build/tools/daily-notes.js.map +1 -0
- package/build/tools/greeting.d.ts +23 -0
- package/build/tools/greeting.d.ts.map +1 -0
- package/build/tools/greeting.js +111 -0
- package/build/tools/greeting.js.map +1 -0
- package/build/tools/index.d.ts +28 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +46 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/links.d.ts +19 -0
- package/build/tools/links.d.ts.map +1 -0
- package/build/tools/links.js +467 -0
- package/build/tools/links.js.map +1 -0
- package/build/tools/metadata.d.ts +18 -0
- package/build/tools/metadata.d.ts.map +1 -0
- package/build/tools/metadata.js +447 -0
- package/build/tools/metadata.js.map +1 -0
- package/build/tools/navigation.d.ts +19 -0
- package/build/tools/navigation.d.ts.map +1 -0
- package/build/tools/navigation.js +378 -0
- package/build/tools/navigation.js.map +1 -0
- package/build/tools/notes.d.ts +19 -0
- package/build/tools/notes.d.ts.map +1 -0
- package/build/tools/notes.js +622 -0
- package/build/tools/notes.js.map +1 -0
- package/build/tools/search.d.ts +19 -0
- package/build/tools/search.d.ts.map +1 -0
- package/build/tools/search.js +418 -0
- package/build/tools/search.js.map +1 -0
- package/build/tools/templates.d.ts +18 -0
- package/build/tools/templates.d.ts.map +1 -0
- package/build/tools/templates.js +581 -0
- package/build/tools/templates.js.map +1 -0
- package/build/tools/vault.d.ts +19 -0
- package/build/tools/vault.d.ts.map +1 -0
- package/build/tools/vault.js +403 -0
- package/build/tools/vault.js.map +1 -0
- package/build/types/index.d.ts +11 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +11 -0
- package/build/types/index.js.map +1 -0
- package/build/types/obsidian.d.ts +329 -0
- package/build/types/obsidian.d.ts.map +1 -0
- package/build/types/obsidian.js +38 -0
- package/build/types/obsidian.js.map +1 -0
- package/build/utils/client.d.ts +201 -0
- package/build/utils/client.d.ts.map +1 -0
- package/build/utils/client.js +656 -0
- package/build/utils/client.js.map +1 -0
- package/build/utils/config.d.ts +43 -0
- package/build/utils/config.d.ts.map +1 -0
- package/build/utils/config.js +117 -0
- package/build/utils/config.js.map +1 -0
- package/build/utils/frontmatter.d.ts +90 -0
- package/build/utils/frontmatter.d.ts.map +1 -0
- package/build/utils/frontmatter.js +306 -0
- package/build/utils/frontmatter.js.map +1 -0
- package/build/utils/index.d.ts +13 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +13 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/markdown.d.ts +134 -0
- package/build/utils/markdown.d.ts.map +1 -0
- package/build/utils/markdown.js +330 -0
- package/build/utils/markdown.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Metadata Tools
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Tools for managing note metadata: frontmatter, tags, aliases, and properties.
|
|
7
|
+
* ============================================================================
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { ObsidianApiError } from "../types/obsidian.js";
|
|
11
|
+
import { parseFrontmatter, stringifyFrontmatter, updateFrontmatter, addTags, removeTags, getAllTags, addAliases, } from "../utils/frontmatter.js";
|
|
12
|
+
/**
|
|
13
|
+
* Register metadata tools with the MCP server.
|
|
14
|
+
*
|
|
15
|
+
* @param server - The MCP server instance
|
|
16
|
+
* @param client - The Obsidian API client
|
|
17
|
+
*/
|
|
18
|
+
export function registerMetadataTools(server, client) {
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// TOOL: get_frontmatter
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Read frontmatter from a note.
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
server.tool("get_frontmatter", "Get the frontmatter (YAML metadata) from a note. " +
|
|
25
|
+
"Returns all frontmatter fields including tags, aliases, and custom properties.", {
|
|
26
|
+
path: z.string().describe("Path to the note."),
|
|
27
|
+
}, async ({ path }) => {
|
|
28
|
+
try {
|
|
29
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
30
|
+
const note = await client.getNote(filePath);
|
|
31
|
+
if (!note.frontmatter || Object.keys(note.frontmatter).length === 0) {
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: "text",
|
|
36
|
+
text: JSON.stringify({
|
|
37
|
+
success: true,
|
|
38
|
+
path: filePath,
|
|
39
|
+
hasFrontmatter: false,
|
|
40
|
+
frontmatter: {},
|
|
41
|
+
}, null, 2),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: JSON.stringify({
|
|
51
|
+
success: true,
|
|
52
|
+
path: filePath,
|
|
53
|
+
hasFrontmatter: true,
|
|
54
|
+
frontmatter: note.frontmatter,
|
|
55
|
+
}, null, 2),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: `Error getting frontmatter: ${message}`,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// TOOL: update_frontmatter
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Update frontmatter fields in a note.
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
server.tool("update_frontmatter", "Update frontmatter fields in a note. " +
|
|
79
|
+
"Can add new fields or update existing ones. " +
|
|
80
|
+
"Existing fields not specified are preserved.", {
|
|
81
|
+
path: z.string().describe("Path to the note."),
|
|
82
|
+
properties: z
|
|
83
|
+
.object({
|
|
84
|
+
title: z.string().optional(),
|
|
85
|
+
tags: z.array(z.string()).optional(),
|
|
86
|
+
aliases: z.array(z.string()).optional(),
|
|
87
|
+
created: z.string().optional(),
|
|
88
|
+
modified: z.string().optional(),
|
|
89
|
+
publish: z.boolean().optional(),
|
|
90
|
+
})
|
|
91
|
+
.passthrough()
|
|
92
|
+
.describe("Frontmatter properties to set or update."),
|
|
93
|
+
}, async ({ path, properties }) => {
|
|
94
|
+
try {
|
|
95
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
96
|
+
// Get current content
|
|
97
|
+
const content = await client.getFile(filePath);
|
|
98
|
+
// Update frontmatter
|
|
99
|
+
const updatedContent = updateFrontmatter(content, properties);
|
|
100
|
+
// Write back
|
|
101
|
+
await client.putFile(filePath, updatedContent);
|
|
102
|
+
return {
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
type: "text",
|
|
106
|
+
text: JSON.stringify({
|
|
107
|
+
success: true,
|
|
108
|
+
message: `Frontmatter updated for: ${filePath}`,
|
|
109
|
+
path: filePath,
|
|
110
|
+
updatedProperties: Object.keys(properties),
|
|
111
|
+
}, null, 2),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
text: `Error updating frontmatter: ${message}`,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
isError: true,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// TOOL: set_frontmatter_property
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Set a single frontmatter property.
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
server.tool("set_frontmatter_property", "Set a single frontmatter property in a note. " +
|
|
135
|
+
"Creates the property if it doesn't exist.", {
|
|
136
|
+
path: z.string().describe("Path to the note."),
|
|
137
|
+
key: z.string().describe("Property name to set."),
|
|
138
|
+
value: z
|
|
139
|
+
.union([
|
|
140
|
+
z.string(),
|
|
141
|
+
z.number(),
|
|
142
|
+
z.boolean(),
|
|
143
|
+
z.array(z.string()),
|
|
144
|
+
z.null(),
|
|
145
|
+
])
|
|
146
|
+
.describe("Value to set (string, number, boolean, string array, or null to remove)."),
|
|
147
|
+
}, async ({ path, key, value }) => {
|
|
148
|
+
try {
|
|
149
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
150
|
+
// Get current content
|
|
151
|
+
const content = await client.getFile(filePath);
|
|
152
|
+
const { frontmatter, body } = parseFrontmatter(content);
|
|
153
|
+
// Update property
|
|
154
|
+
if (value === null) {
|
|
155
|
+
delete frontmatter[key];
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
frontmatter[key] = value;
|
|
159
|
+
}
|
|
160
|
+
// Rebuild content
|
|
161
|
+
const newContent = stringifyFrontmatter(frontmatter) + body;
|
|
162
|
+
await client.putFile(filePath, newContent);
|
|
163
|
+
return {
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: JSON.stringify({
|
|
168
|
+
success: true,
|
|
169
|
+
message: value === null
|
|
170
|
+
? `Property "${key}" removed from: ${filePath}`
|
|
171
|
+
: `Property "${key}" set in: ${filePath}`,
|
|
172
|
+
path: filePath,
|
|
173
|
+
property: key,
|
|
174
|
+
value: value,
|
|
175
|
+
}, null, 2),
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
182
|
+
return {
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: "text",
|
|
186
|
+
text: `Error setting property: ${message}`,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
isError: true,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
// TOOL: get_tags
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// Get all tags from a note (frontmatter + inline).
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
server.tool("get_tags", "Get all tags from a note. " +
|
|
199
|
+
"Includes tags from frontmatter and inline tags (#tag) in the content.", {
|
|
200
|
+
path: z.string().describe("Path to the note."),
|
|
201
|
+
}, async ({ path }) => {
|
|
202
|
+
try {
|
|
203
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
204
|
+
const content = await client.getFile(filePath);
|
|
205
|
+
const tags = getAllTags(content);
|
|
206
|
+
return {
|
|
207
|
+
content: [
|
|
208
|
+
{
|
|
209
|
+
type: "text",
|
|
210
|
+
text: JSON.stringify({
|
|
211
|
+
success: true,
|
|
212
|
+
path: filePath,
|
|
213
|
+
tagCount: tags.length,
|
|
214
|
+
tags,
|
|
215
|
+
}, null, 2),
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
222
|
+
return {
|
|
223
|
+
content: [
|
|
224
|
+
{
|
|
225
|
+
type: "text",
|
|
226
|
+
text: `Error getting tags: ${message}`,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
isError: true,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
// TOOL: add_tags
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
// Add tags to a note's frontmatter.
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
server.tool("add_tags", "Add tags to a note's frontmatter. " +
|
|
239
|
+
"Tags are added without duplicates. Creates frontmatter if needed.", {
|
|
240
|
+
path: z.string().describe("Path to the note."),
|
|
241
|
+
tags: z
|
|
242
|
+
.array(z.string())
|
|
243
|
+
.min(1)
|
|
244
|
+
.describe("Tags to add (with or without # prefix)."),
|
|
245
|
+
}, async ({ path, tags }) => {
|
|
246
|
+
try {
|
|
247
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
248
|
+
// Get current content
|
|
249
|
+
const content = await client.getFile(filePath);
|
|
250
|
+
// Add tags
|
|
251
|
+
const updatedContent = addTags(content, tags);
|
|
252
|
+
// Write back
|
|
253
|
+
await client.putFile(filePath, updatedContent);
|
|
254
|
+
// Get final tags
|
|
255
|
+
const finalTags = getAllTags(updatedContent);
|
|
256
|
+
return {
|
|
257
|
+
content: [
|
|
258
|
+
{
|
|
259
|
+
type: "text",
|
|
260
|
+
text: JSON.stringify({
|
|
261
|
+
success: true,
|
|
262
|
+
message: `Tags added to: ${filePath}`,
|
|
263
|
+
path: filePath,
|
|
264
|
+
addedTags: tags,
|
|
265
|
+
allTags: finalTags,
|
|
266
|
+
}, null, 2),
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
273
|
+
return {
|
|
274
|
+
content: [
|
|
275
|
+
{
|
|
276
|
+
type: "text",
|
|
277
|
+
text: `Error adding tags: ${message}`,
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
isError: true,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
// TOOL: remove_tags
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
// Remove tags from a note's frontmatter.
|
|
288
|
+
// ---------------------------------------------------------------------------
|
|
289
|
+
server.tool("remove_tags", "Remove tags from a note's frontmatter. " +
|
|
290
|
+
"Only removes tags from frontmatter, not inline tags.", {
|
|
291
|
+
path: z.string().describe("Path to the note."),
|
|
292
|
+
tags: z
|
|
293
|
+
.array(z.string())
|
|
294
|
+
.min(1)
|
|
295
|
+
.describe("Tags to remove (with or without # prefix)."),
|
|
296
|
+
}, async ({ path, tags }) => {
|
|
297
|
+
try {
|
|
298
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
299
|
+
// Get current content
|
|
300
|
+
const content = await client.getFile(filePath);
|
|
301
|
+
// Remove tags
|
|
302
|
+
const updatedContent = removeTags(content, tags);
|
|
303
|
+
// Write back
|
|
304
|
+
await client.putFile(filePath, updatedContent);
|
|
305
|
+
// Get final tags
|
|
306
|
+
const finalTags = getAllTags(updatedContent);
|
|
307
|
+
return {
|
|
308
|
+
content: [
|
|
309
|
+
{
|
|
310
|
+
type: "text",
|
|
311
|
+
text: JSON.stringify({
|
|
312
|
+
success: true,
|
|
313
|
+
message: `Tags removed from: ${filePath}`,
|
|
314
|
+
path: filePath,
|
|
315
|
+
removedTags: tags,
|
|
316
|
+
remainingTags: finalTags,
|
|
317
|
+
}, null, 2),
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
324
|
+
return {
|
|
325
|
+
content: [
|
|
326
|
+
{
|
|
327
|
+
type: "text",
|
|
328
|
+
text: `Error removing tags: ${message}`,
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
isError: true,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
// ---------------------------------------------------------------------------
|
|
336
|
+
// TOOL: add_aliases
|
|
337
|
+
// ---------------------------------------------------------------------------
|
|
338
|
+
// Add aliases to a note's frontmatter.
|
|
339
|
+
// ---------------------------------------------------------------------------
|
|
340
|
+
server.tool("add_aliases", "Add aliases (alternative names) to a note's frontmatter. " +
|
|
341
|
+
"Aliases help find notes by different names.", {
|
|
342
|
+
path: z.string().describe("Path to the note."),
|
|
343
|
+
aliases: z.array(z.string()).min(1).describe("Aliases to add."),
|
|
344
|
+
}, async ({ path, aliases }) => {
|
|
345
|
+
try {
|
|
346
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
347
|
+
// Get current content
|
|
348
|
+
const content = await client.getFile(filePath);
|
|
349
|
+
// Add aliases
|
|
350
|
+
const updatedContent = addAliases(content, aliases);
|
|
351
|
+
// Write back
|
|
352
|
+
await client.putFile(filePath, updatedContent);
|
|
353
|
+
// Get updated frontmatter
|
|
354
|
+
const { frontmatter } = parseFrontmatter(updatedContent);
|
|
355
|
+
return {
|
|
356
|
+
content: [
|
|
357
|
+
{
|
|
358
|
+
type: "text",
|
|
359
|
+
text: JSON.stringify({
|
|
360
|
+
success: true,
|
|
361
|
+
message: `Aliases added to: ${filePath}`,
|
|
362
|
+
path: filePath,
|
|
363
|
+
addedAliases: aliases,
|
|
364
|
+
allAliases: frontmatter.aliases || [],
|
|
365
|
+
}, null, 2),
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
372
|
+
return {
|
|
373
|
+
content: [
|
|
374
|
+
{
|
|
375
|
+
type: "text",
|
|
376
|
+
text: `Error adding aliases: ${message}`,
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
isError: true,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
// ---------------------------------------------------------------------------
|
|
384
|
+
// TOOL: get_all_tags_in_vault
|
|
385
|
+
// ---------------------------------------------------------------------------
|
|
386
|
+
// Get all unique tags used across the vault.
|
|
387
|
+
// ---------------------------------------------------------------------------
|
|
388
|
+
server.tool("get_all_tags_in_vault", "Get a list of all unique tags used across the entire vault. " +
|
|
389
|
+
"Useful for understanding tag taxonomy and finding related notes.", {
|
|
390
|
+
folder: z
|
|
391
|
+
.string()
|
|
392
|
+
.optional()
|
|
393
|
+
.describe("Optional folder to limit the search."),
|
|
394
|
+
}, async ({ folder }) => {
|
|
395
|
+
try {
|
|
396
|
+
// Get all markdown files
|
|
397
|
+
const allFiles = await client.listAllFiles(folder || "", 10);
|
|
398
|
+
const mdFiles = allFiles.filter((f) => f.type === "file" && f.extension === "md");
|
|
399
|
+
// Collect all tags
|
|
400
|
+
const tagCounts = {};
|
|
401
|
+
for (const file of mdFiles.slice(0, 500)) {
|
|
402
|
+
// Limit to avoid timeout
|
|
403
|
+
try {
|
|
404
|
+
const content = await client.getFile(file.path);
|
|
405
|
+
const tags = getAllTags(content);
|
|
406
|
+
for (const tag of tags) {
|
|
407
|
+
tagCounts[tag] = (tagCounts[tag] || 0) + 1;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
catch {
|
|
411
|
+
// Skip files that can't be read
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Sort by count
|
|
415
|
+
const sortedTags = Object.entries(tagCounts)
|
|
416
|
+
.sort((a, b) => b[1] - a[1])
|
|
417
|
+
.map(([tag, count]) => ({ tag, count }));
|
|
418
|
+
return {
|
|
419
|
+
content: [
|
|
420
|
+
{
|
|
421
|
+
type: "text",
|
|
422
|
+
text: JSON.stringify({
|
|
423
|
+
success: true,
|
|
424
|
+
folder: folder || "/",
|
|
425
|
+
filesScanned: Math.min(mdFiles.length, 500),
|
|
426
|
+
uniqueTags: sortedTags.length,
|
|
427
|
+
tags: sortedTags,
|
|
428
|
+
}, null, 2),
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
435
|
+
return {
|
|
436
|
+
content: [
|
|
437
|
+
{
|
|
438
|
+
type: "text",
|
|
439
|
+
text: `Error getting vault tags: ${message}`,
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
isError: true,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/tools/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EA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BACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,6BAA6B,OAAO,EAAE;qBAC7C;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Navigation Tools
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Tools for navigating the Obsidian UI: opening notes, getting active file,
|
|
7
|
+
* and executing Obsidian commands.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import { ObsidianClient } from "../utils/client.js";
|
|
12
|
+
/**
|
|
13
|
+
* Register navigation tools with the MCP server.
|
|
14
|
+
*
|
|
15
|
+
* @param server - The MCP server instance
|
|
16
|
+
* @param client - The Obsidian API client
|
|
17
|
+
*/
|
|
18
|
+
export declare function registerNavigationTools(server: McpServer, client: ObsidianClient): void;
|
|
19
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/tools/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,GACrB,IAAI,CA+bN"}
|