@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,469 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Daily/Periodic Notes Tools
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Tools for working with daily notes, weekly notes, and other periodic notes.
|
|
7
|
+
* Requires the Periodic Notes plugin or Daily Notes core plugin in Obsidian.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { ObsidianApiError } from "../types/obsidian.js";
|
|
12
|
+
import { formatDate, getSummary } from "../utils/markdown.js";
|
|
13
|
+
/**
|
|
14
|
+
* Register daily/periodic notes tools with the MCP server.
|
|
15
|
+
*
|
|
16
|
+
* @param server - The MCP server instance
|
|
17
|
+
* @param client - The Obsidian API client
|
|
18
|
+
*/
|
|
19
|
+
export function registerDailyNotesTools(server, client) {
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// TOOL: get_daily_note
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Get today's daily note.
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
server.tool("get_daily_note", "Get the content of today's daily note. " +
|
|
26
|
+
"Creates the note if it doesn't exist (using Obsidian's daily notes settings). " +
|
|
27
|
+
"Requires Daily Notes core plugin or Periodic Notes plugin.", {
|
|
28
|
+
includeContent: z
|
|
29
|
+
.boolean()
|
|
30
|
+
.optional()
|
|
31
|
+
.default(true)
|
|
32
|
+
.describe("Whether to include the full content."),
|
|
33
|
+
}, async ({ includeContent }) => {
|
|
34
|
+
try {
|
|
35
|
+
const note = await client.getCurrentPeriodicNote("daily");
|
|
36
|
+
if (!note) {
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: "text",
|
|
41
|
+
text: JSON.stringify({
|
|
42
|
+
success: true,
|
|
43
|
+
exists: false,
|
|
44
|
+
message: "No daily note for today. Daily Notes plugin may not be configured.",
|
|
45
|
+
}, null, 2),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const response = {
|
|
51
|
+
success: true,
|
|
52
|
+
exists: true,
|
|
53
|
+
path: note.path,
|
|
54
|
+
date: formatDate(new Date()),
|
|
55
|
+
};
|
|
56
|
+
if (note.frontmatter && Object.keys(note.frontmatter).length > 0) {
|
|
57
|
+
response.frontmatter = note.frontmatter;
|
|
58
|
+
}
|
|
59
|
+
if (includeContent) {
|
|
60
|
+
response.content = note.content;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
response.summary = getSummary(note.content, 200);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: JSON.stringify(response, null, 2),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: `Error getting daily note: ${message}`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
isError: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// TOOL: append_to_daily_note
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Append content to today's daily note.
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
server.tool("append_to_daily_note", "Append content to today's daily note. " +
|
|
93
|
+
"Creates the daily note if it doesn't exist.", {
|
|
94
|
+
content: z.string().describe("Content to append."),
|
|
95
|
+
heading: z
|
|
96
|
+
.string()
|
|
97
|
+
.optional()
|
|
98
|
+
.describe("Optional heading to append under."),
|
|
99
|
+
addTimestamp: z
|
|
100
|
+
.boolean()
|
|
101
|
+
.optional()
|
|
102
|
+
.default(false)
|
|
103
|
+
.describe("Whether to add a timestamp before the content."),
|
|
104
|
+
}, async ({ content, heading, addTimestamp }) => {
|
|
105
|
+
try {
|
|
106
|
+
let formattedContent = content;
|
|
107
|
+
if (addTimestamp) {
|
|
108
|
+
const time = new Date().toLocaleTimeString();
|
|
109
|
+
formattedContent = `[${time}] ${content}`;
|
|
110
|
+
}
|
|
111
|
+
if (heading) {
|
|
112
|
+
await client.patchPeriodicNote("daily", formattedContent, {
|
|
113
|
+
operation: "insert-under-heading",
|
|
114
|
+
heading,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
await client.appendToPeriodicNote("daily", `\n${formattedContent}`);
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: JSON.stringify({
|
|
125
|
+
success: true,
|
|
126
|
+
message: "Content appended to daily note",
|
|
127
|
+
date: formatDate(new Date()),
|
|
128
|
+
heading: heading || null,
|
|
129
|
+
addedTimestamp: addTimestamp,
|
|
130
|
+
}, null, 2),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
137
|
+
return {
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
type: "text",
|
|
141
|
+
text: `Error appending to daily note: ${message}`,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
isError: true,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
// TOOL: get_periodic_note
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// Get a periodic note for a specific period and date.
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
server.tool("get_periodic_note", "Get a periodic note for a specific period and date. " +
|
|
154
|
+
"Supports daily, weekly, monthly, quarterly, and yearly notes. " +
|
|
155
|
+
"Requires the Periodic Notes plugin for non-daily periods.", {
|
|
156
|
+
period: z
|
|
157
|
+
.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
|
|
158
|
+
.describe("The period type."),
|
|
159
|
+
year: z.number().int().optional().describe("Year (e.g., 2024). Defaults to current year."),
|
|
160
|
+
month: z
|
|
161
|
+
.number()
|
|
162
|
+
.int()
|
|
163
|
+
.min(1)
|
|
164
|
+
.max(12)
|
|
165
|
+
.optional()
|
|
166
|
+
.describe("Month (1-12). Defaults to current month."),
|
|
167
|
+
day: z
|
|
168
|
+
.number()
|
|
169
|
+
.int()
|
|
170
|
+
.min(1)
|
|
171
|
+
.max(31)
|
|
172
|
+
.optional()
|
|
173
|
+
.describe("Day of month. Defaults to current day."),
|
|
174
|
+
}, async ({ period, year, month, day }) => {
|
|
175
|
+
try {
|
|
176
|
+
const now = new Date();
|
|
177
|
+
const date = {
|
|
178
|
+
year: year || now.getFullYear(),
|
|
179
|
+
month: month || now.getMonth() + 1,
|
|
180
|
+
day: day || now.getDate(),
|
|
181
|
+
};
|
|
182
|
+
let note;
|
|
183
|
+
if (year || month || day) {
|
|
184
|
+
// Specific date
|
|
185
|
+
note = await client.getPeriodicNote(period, date);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// Current period
|
|
189
|
+
note = await client.getCurrentPeriodicNote(period);
|
|
190
|
+
}
|
|
191
|
+
if (!note) {
|
|
192
|
+
return {
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
text: JSON.stringify({
|
|
197
|
+
success: true,
|
|
198
|
+
exists: false,
|
|
199
|
+
period,
|
|
200
|
+
date,
|
|
201
|
+
message: `No ${period} note found for this date.`,
|
|
202
|
+
}, null, 2),
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: "text",
|
|
211
|
+
text: JSON.stringify({
|
|
212
|
+
success: true,
|
|
213
|
+
exists: true,
|
|
214
|
+
period,
|
|
215
|
+
date,
|
|
216
|
+
path: note.path,
|
|
217
|
+
frontmatter: note.frontmatter,
|
|
218
|
+
content: note.content,
|
|
219
|
+
}, null, 2),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
226
|
+
return {
|
|
227
|
+
content: [
|
|
228
|
+
{
|
|
229
|
+
type: "text",
|
|
230
|
+
text: `Error getting periodic note: ${message}`,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
isError: true,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// TOOL: append_to_periodic_note
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
// Append content to a periodic note.
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
server.tool("append_to_periodic_note", "Append content to a periodic note. " +
|
|
243
|
+
"Can append to current period's note or a specific date.", {
|
|
244
|
+
period: z
|
|
245
|
+
.enum(["daily", "weekly", "monthly", "quarterly", "yearly"])
|
|
246
|
+
.describe("The period type."),
|
|
247
|
+
content: z.string().describe("Content to append."),
|
|
248
|
+
year: z.number().int().optional().describe("Year (defaults to current)."),
|
|
249
|
+
month: z.number().int().min(1).max(12).optional().describe("Month (defaults to current)."),
|
|
250
|
+
day: z.number().int().min(1).max(31).optional().describe("Day (defaults to current)."),
|
|
251
|
+
}, async ({ period, content, year, month, day }) => {
|
|
252
|
+
try {
|
|
253
|
+
const now = new Date();
|
|
254
|
+
if (year || month || day) {
|
|
255
|
+
const date = {
|
|
256
|
+
year: year || now.getFullYear(),
|
|
257
|
+
month: month || now.getMonth() + 1,
|
|
258
|
+
day: day || now.getDate(),
|
|
259
|
+
};
|
|
260
|
+
await client.appendToPeriodicNoteByDate(period, date, `\n${content}`);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
await client.appendToPeriodicNote(period, `\n${content}`);
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: "text",
|
|
269
|
+
text: JSON.stringify({
|
|
270
|
+
success: true,
|
|
271
|
+
message: `Content appended to ${period} note`,
|
|
272
|
+
period,
|
|
273
|
+
}, null, 2),
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
280
|
+
return {
|
|
281
|
+
content: [
|
|
282
|
+
{
|
|
283
|
+
type: "text",
|
|
284
|
+
text: `Error appending to periodic note: ${message}`,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
isError: true,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
// ---------------------------------------------------------------------------
|
|
292
|
+
// TOOL: daily_journal_entry
|
|
293
|
+
// ---------------------------------------------------------------------------
|
|
294
|
+
// Add a structured journal entry to today's daily note.
|
|
295
|
+
// ---------------------------------------------------------------------------
|
|
296
|
+
server.tool("daily_journal_entry", "Add a structured journal entry to today's daily note. " +
|
|
297
|
+
"Creates a nicely formatted journal entry with optional sections.", {
|
|
298
|
+
entry: z.string().describe("Main journal entry content."),
|
|
299
|
+
mood: z
|
|
300
|
+
.enum(["great", "good", "okay", "bad", "terrible"])
|
|
301
|
+
.optional()
|
|
302
|
+
.describe("Optional mood indicator."),
|
|
303
|
+
highlights: z
|
|
304
|
+
.array(z.string())
|
|
305
|
+
.optional()
|
|
306
|
+
.describe("Optional list of highlights/wins for the day."),
|
|
307
|
+
gratitude: z
|
|
308
|
+
.array(z.string())
|
|
309
|
+
.optional()
|
|
310
|
+
.describe("Optional gratitude items."),
|
|
311
|
+
todos: z
|
|
312
|
+
.array(z.string())
|
|
313
|
+
.optional()
|
|
314
|
+
.describe("Optional todo items to add."),
|
|
315
|
+
}, async ({ entry, mood, highlights, gratitude, todos }) => {
|
|
316
|
+
try {
|
|
317
|
+
const time = new Date().toLocaleTimeString("en-US", {
|
|
318
|
+
hour: "2-digit",
|
|
319
|
+
minute: "2-digit",
|
|
320
|
+
});
|
|
321
|
+
// Build journal entry
|
|
322
|
+
const lines = [];
|
|
323
|
+
// Header with time
|
|
324
|
+
lines.push(`\n## 📝 Journal Entry - ${time}`);
|
|
325
|
+
lines.push("");
|
|
326
|
+
// Mood indicator
|
|
327
|
+
if (mood) {
|
|
328
|
+
const moodEmojis = {
|
|
329
|
+
great: "😄 Great",
|
|
330
|
+
good: "🙂 Good",
|
|
331
|
+
okay: "😐 Okay",
|
|
332
|
+
bad: "😔 Bad",
|
|
333
|
+
terrible: "😢 Terrible",
|
|
334
|
+
};
|
|
335
|
+
lines.push(`**Mood:** ${moodEmojis[mood]}`);
|
|
336
|
+
lines.push("");
|
|
337
|
+
}
|
|
338
|
+
// Main entry
|
|
339
|
+
lines.push(entry);
|
|
340
|
+
lines.push("");
|
|
341
|
+
// Highlights
|
|
342
|
+
if (highlights && highlights.length > 0) {
|
|
343
|
+
lines.push("### ✨ Highlights");
|
|
344
|
+
for (const highlight of highlights) {
|
|
345
|
+
lines.push(`- ${highlight}`);
|
|
346
|
+
}
|
|
347
|
+
lines.push("");
|
|
348
|
+
}
|
|
349
|
+
// Gratitude
|
|
350
|
+
if (gratitude && gratitude.length > 0) {
|
|
351
|
+
lines.push("### 🙏 Gratitude");
|
|
352
|
+
for (const item of gratitude) {
|
|
353
|
+
lines.push(`- ${item}`);
|
|
354
|
+
}
|
|
355
|
+
lines.push("");
|
|
356
|
+
}
|
|
357
|
+
// Todos
|
|
358
|
+
if (todos && todos.length > 0) {
|
|
359
|
+
lines.push("### ✅ Tasks");
|
|
360
|
+
for (const todo of todos) {
|
|
361
|
+
lines.push(`- [ ] ${todo}`);
|
|
362
|
+
}
|
|
363
|
+
lines.push("");
|
|
364
|
+
}
|
|
365
|
+
const journalContent = lines.join("\n");
|
|
366
|
+
await client.appendToPeriodicNote("daily", journalContent);
|
|
367
|
+
return {
|
|
368
|
+
content: [
|
|
369
|
+
{
|
|
370
|
+
type: "text",
|
|
371
|
+
text: JSON.stringify({
|
|
372
|
+
success: true,
|
|
373
|
+
message: "Journal entry added to daily note",
|
|
374
|
+
date: formatDate(new Date()),
|
|
375
|
+
time,
|
|
376
|
+
sections: {
|
|
377
|
+
hasMood: !!mood,
|
|
378
|
+
hasHighlights: !!(highlights && highlights.length > 0),
|
|
379
|
+
hasGratitude: !!(gratitude && gratitude.length > 0),
|
|
380
|
+
hasTodos: !!(todos && todos.length > 0),
|
|
381
|
+
},
|
|
382
|
+
}, null, 2),
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
389
|
+
return {
|
|
390
|
+
content: [
|
|
391
|
+
{
|
|
392
|
+
type: "text",
|
|
393
|
+
text: `Error adding journal entry: ${message}`,
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
isError: true,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// TOOL: daily_standup
|
|
402
|
+
// ---------------------------------------------------------------------------
|
|
403
|
+
// Add a standup/scrum note to the daily note.
|
|
404
|
+
// ---------------------------------------------------------------------------
|
|
405
|
+
server.tool("daily_standup", "Add a daily standup/scrum entry to today's daily note. " +
|
|
406
|
+
"Uses the classic standup format: yesterday, today, blockers.", {
|
|
407
|
+
yesterday: z.array(z.string()).describe("What you accomplished yesterday."),
|
|
408
|
+
today: z.array(z.string()).describe("What you plan to do today."),
|
|
409
|
+
blockers: z
|
|
410
|
+
.array(z.string())
|
|
411
|
+
.optional()
|
|
412
|
+
.describe("Any blockers or impediments."),
|
|
413
|
+
}, async ({ yesterday, today, blockers }) => {
|
|
414
|
+
try {
|
|
415
|
+
const lines = [];
|
|
416
|
+
lines.push("\n## 📋 Daily Standup");
|
|
417
|
+
lines.push("");
|
|
418
|
+
lines.push("### Yesterday");
|
|
419
|
+
for (const item of yesterday) {
|
|
420
|
+
lines.push(`- ${item}`);
|
|
421
|
+
}
|
|
422
|
+
lines.push("");
|
|
423
|
+
lines.push("### Today");
|
|
424
|
+
for (const item of today) {
|
|
425
|
+
lines.push(`- ${item}`);
|
|
426
|
+
}
|
|
427
|
+
lines.push("");
|
|
428
|
+
if (blockers && blockers.length > 0) {
|
|
429
|
+
lines.push("### Blockers 🚧");
|
|
430
|
+
for (const blocker of blockers) {
|
|
431
|
+
lines.push(`- ${blocker}`);
|
|
432
|
+
}
|
|
433
|
+
lines.push("");
|
|
434
|
+
}
|
|
435
|
+
const standupContent = lines.join("\n");
|
|
436
|
+
await client.appendToPeriodicNote("daily", standupContent);
|
|
437
|
+
return {
|
|
438
|
+
content: [
|
|
439
|
+
{
|
|
440
|
+
type: "text",
|
|
441
|
+
text: JSON.stringify({
|
|
442
|
+
success: true,
|
|
443
|
+
message: "Standup added to daily note",
|
|
444
|
+
date: formatDate(new Date()),
|
|
445
|
+
items: {
|
|
446
|
+
yesterday: yesterday.length,
|
|
447
|
+
today: today.length,
|
|
448
|
+
blockers: blockers?.length || 0,
|
|
449
|
+
},
|
|
450
|
+
}, null, 2),
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
457
|
+
return {
|
|
458
|
+
content: [
|
|
459
|
+
{
|
|
460
|
+
type: "text",
|
|
461
|
+
text: `Error adding standup: ${message}`,
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
isError: true,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
//# sourceMappingURL=daily-notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daily-notes.js","sourceRoot":"","sources":["../../src/tools/daily-notes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAAsB;IAEtB,8EAA8E;IAC9E,uBAAuB;IACvB,8EAA8E;IAC9E,0BAA0B;IAC1B,8EAA8E;IAE9E,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,yCAAyC;QACvC,gFAAgF;QAChF,4DAA4D,EAC9D;QACE,cAAc,EAAE,CAAC;aACd,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,OAAO,CAAC,IAAI,CAAC;aACb,QAAQ,CAAC,sCAAsC,CAAC;KACpD,EACD,KAAK,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE;QAC3B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YAE1D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;gCACE,OAAO,EAAE,IAAI;gCACb,MAAM,EAAE,KAAK;gCACb,OAAO,EACL,oEAAoE;6BACvE,EACD,IAAI,EACJ,CAAC,CACF;yBACF;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,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E,CAAC;oBAC/B,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;gBAC7B,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YAED,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAExC,MAAM,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YAE3D,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,OAAO,EAAE,IAAI;4BACb,OAAO,EAAE,6BAA6B;4BACtC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;4BAC5B,KAAK,EAAE;gCACL,SAAS,EAAE,SAAS,CAAC,MAAM;gCAC3B,KAAK,EAAE,KAAK,CAAC,MAAM;gCACnB,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;6BAChC;yBACF,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GACX,KAAK,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEpE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,yBAAyB,OAAO,EAAE;qBACzC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* GREETING & UTILITY TOOLS - More Examples
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* This file demonstrates:
|
|
7
|
+
* - String parameters
|
|
8
|
+
* - Enum parameters (dropdown/select style)
|
|
9
|
+
* - Optional parameters with defaults
|
|
10
|
+
* - Error handling with try/catch
|
|
11
|
+
*
|
|
12
|
+
* GOOD TO KNOW:
|
|
13
|
+
* - Tool names should be lowercase with underscores: "get_current_time"
|
|
14
|
+
* - Descriptions should be clear and action-oriented
|
|
15
|
+
* - Optional params use .optional() and .default()
|
|
16
|
+
* ============================================================================
|
|
17
|
+
*/
|
|
18
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
19
|
+
/**
|
|
20
|
+
* Registers greeting and utility tools.
|
|
21
|
+
*/
|
|
22
|
+
export declare function registerGreetingTools(server: McpServer): void;
|
|
23
|
+
//# sourceMappingURL=greeting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greeting.d.ts","sourceRoot":"","sources":["../../src/tools/greeting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAgH7D"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* GREETING & UTILITY TOOLS - More Examples
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* This file demonstrates:
|
|
7
|
+
* - String parameters
|
|
8
|
+
* - Enum parameters (dropdown/select style)
|
|
9
|
+
* - Optional parameters with defaults
|
|
10
|
+
* - Error handling with try/catch
|
|
11
|
+
*
|
|
12
|
+
* GOOD TO KNOW:
|
|
13
|
+
* - Tool names should be lowercase with underscores: "get_current_time"
|
|
14
|
+
* - Descriptions should be clear and action-oriented
|
|
15
|
+
* - Optional params use .optional() and .default()
|
|
16
|
+
* ============================================================================
|
|
17
|
+
*/
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
/**
|
|
20
|
+
* Registers greeting and utility tools.
|
|
21
|
+
*/
|
|
22
|
+
export function registerGreetingTools(server) {
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// TOOL: greet (demonstrates enum and optional parameters)
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Shows how to:
|
|
27
|
+
// - Use z.enum() for a fixed set of choices
|
|
28
|
+
// - Make parameters optional with .optional()
|
|
29
|
+
// - Provide default values with .default()
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
server.tool("greet", "Generate a personalized greeting message", {
|
|
32
|
+
// Required parameter - user must provide this
|
|
33
|
+
name: z.string().describe("Name of the person to greet"),
|
|
34
|
+
// Optional enum parameter with a default value
|
|
35
|
+
// z.enum() restricts input to specific values
|
|
36
|
+
language: z
|
|
37
|
+
.enum(["english", "spanish", "french", "german", "japanese"])
|
|
38
|
+
.optional() // Not required
|
|
39
|
+
.default("english") // Falls back to "english"
|
|
40
|
+
.describe("Language for the greeting"),
|
|
41
|
+
}, async ({ name, language }) => {
|
|
42
|
+
// Map language to greeting template
|
|
43
|
+
const greetings = {
|
|
44
|
+
english: `Hello, ${name}! Welcome!`,
|
|
45
|
+
spanish: `¡Hola, ${name}! ¡Bienvenido!`,
|
|
46
|
+
french: `Bonjour, ${name}! Bienvenue!`,
|
|
47
|
+
german: `Hallo, ${name}! Willkommen!`,
|
|
48
|
+
japanese: `こんにちは、${name}さん!ようこそ!`,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{ type: "text", text: greetings[language || "english"] },
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// TOOL: get_current_time (demonstrates try/catch error handling)
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Shows how to:
|
|
60
|
+
// - Handle external errors gracefully
|
|
61
|
+
// - Use try/catch in async handlers
|
|
62
|
+
// - Return helpful error messages
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
server.tool("get_current_time", "Get the current date and time", {
|
|
65
|
+
timezone: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("Timezone (e.g., 'America/New_York', 'Europe/London', 'Asia/Tokyo')"),
|
|
69
|
+
}, async ({ timezone }) => {
|
|
70
|
+
// Try to format the date with the specified timezone
|
|
71
|
+
try {
|
|
72
|
+
const options = {
|
|
73
|
+
dateStyle: "full",
|
|
74
|
+
timeStyle: "long",
|
|
75
|
+
timeZone: timezone || "UTC",
|
|
76
|
+
};
|
|
77
|
+
const now = new Date();
|
|
78
|
+
const formatted = new Intl.DateTimeFormat("en-US", options).format(now);
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{ type: "text", text: `Current time: ${formatted}` },
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
// Intl.DateTimeFormat throws if timezone is invalid
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{ type: "text", text: `Error: Invalid timezone "${timezone}". Use IANA format like 'America/New_York'.` },
|
|
90
|
+
],
|
|
91
|
+
isError: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// TOOL: echo (simplest possible tool - great for testing)
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Use this to verify your server is working correctly.
|
|
99
|
+
// It just returns whatever you send it.
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
server.tool("echo", "Echo back the provided message (useful for testing)", {
|
|
102
|
+
message: z.string().describe("Message to echo back"),
|
|
103
|
+
}, async ({ message }) => {
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{ type: "text", text: `Echo: ${message}` },
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
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MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;KACrD,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,EAAE;aAC3C;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Tools Index
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Central registration point for all Obsidian MCP tools.
|
|
7
|
+
* Each tool module is imported and registered with the server.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import { ObsidianClient } from "../utils/client.js";
|
|
12
|
+
import { registerVaultTools } from "./vault.js";
|
|
13
|
+
import { registerNoteTools } from "./notes.js";
|
|
14
|
+
import { registerSearchTools } from "./search.js";
|
|
15
|
+
import { registerMetadataTools } from "./metadata.js";
|
|
16
|
+
import { registerNavigationTools } from "./navigation.js";
|
|
17
|
+
import { registerDailyNotesTools } from "./daily-notes.js";
|
|
18
|
+
import { registerLinkTools } from "./links.js";
|
|
19
|
+
import { registerTemplateTools } from "./templates.js";
|
|
20
|
+
/**
|
|
21
|
+
* Register all Obsidian tools with the MCP server.
|
|
22
|
+
*
|
|
23
|
+
* @param server - The MCP server instance
|
|
24
|
+
* @param client - The Obsidian API client
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerAllTools(server: McpServer, client: ObsidianClient): void;
|
|
27
|
+
export { registerVaultTools, registerNoteTools, registerSearchTools, registerMetadataTools, registerNavigationTools, registerDailyNotesTools, registerLinkTools, registerTemplateTools, };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CA0BhF;AAGD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,GACtB,CAAC"}
|