@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,378 @@
|
|
|
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 { z } from "zod";
|
|
11
|
+
import { ObsidianApiError } from "../types/obsidian.js";
|
|
12
|
+
import { getSummary, countWords } from "../utils/markdown.js";
|
|
13
|
+
import { getAllTags } from "../utils/frontmatter.js";
|
|
14
|
+
/**
|
|
15
|
+
* Register navigation tools with the MCP server.
|
|
16
|
+
*
|
|
17
|
+
* @param server - The MCP server instance
|
|
18
|
+
* @param client - The Obsidian API client
|
|
19
|
+
*/
|
|
20
|
+
export function registerNavigationTools(server, client) {
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// TOOL: open_note
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Open a note in the Obsidian UI.
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
server.tool("open_note", "Open a note in the Obsidian user interface. " +
|
|
27
|
+
"Makes the note visible and active in Obsidian.", {
|
|
28
|
+
path: z.string().describe("Path to the note to open."),
|
|
29
|
+
newPane: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.default(false)
|
|
33
|
+
.describe("Whether to open in a new pane (split view)."),
|
|
34
|
+
}, async ({ path, newPane }) => {
|
|
35
|
+
try {
|
|
36
|
+
const filePath = path.endsWith(".md") ? path : `${path}.md`;
|
|
37
|
+
await client.openFile(filePath, newPane);
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: JSON.stringify({
|
|
43
|
+
success: true,
|
|
44
|
+
message: `Opened: ${filePath}`,
|
|
45
|
+
path: filePath,
|
|
46
|
+
newPane,
|
|
47
|
+
}, null, 2),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: "text",
|
|
58
|
+
text: `Error opening note: ${message}`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
isError: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// TOOL: get_active_note
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// Get the currently active note in Obsidian.
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
server.tool("get_active_note", "Get the content of the currently active (focused) note in Obsidian. " +
|
|
71
|
+
"Returns the note's content, path, and metadata.", {
|
|
72
|
+
includeContent: z
|
|
73
|
+
.boolean()
|
|
74
|
+
.optional()
|
|
75
|
+
.default(true)
|
|
76
|
+
.describe("Whether to include the full content."),
|
|
77
|
+
includeStats: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.default(false)
|
|
81
|
+
.describe("Whether to include word count and summary."),
|
|
82
|
+
}, async ({ includeContent, includeStats }) => {
|
|
83
|
+
try {
|
|
84
|
+
const note = await client.getActiveFile();
|
|
85
|
+
if (!note) {
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: JSON.stringify({
|
|
91
|
+
success: true,
|
|
92
|
+
hasActiveNote: false,
|
|
93
|
+
message: "No note is currently open in Obsidian.",
|
|
94
|
+
}, null, 2),
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const response = {
|
|
100
|
+
success: true,
|
|
101
|
+
hasActiveNote: true,
|
|
102
|
+
path: note.path,
|
|
103
|
+
};
|
|
104
|
+
if (note.frontmatter && Object.keys(note.frontmatter).length > 0) {
|
|
105
|
+
response.frontmatter = note.frontmatter;
|
|
106
|
+
}
|
|
107
|
+
if (includeContent) {
|
|
108
|
+
response.content = note.content;
|
|
109
|
+
}
|
|
110
|
+
if (includeStats) {
|
|
111
|
+
response.stats = {
|
|
112
|
+
wordCount: countWords(note.content),
|
|
113
|
+
summary: getSummary(note.content, 150),
|
|
114
|
+
tags: getAllTags(note.content),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
content: [
|
|
119
|
+
{
|
|
120
|
+
type: "text",
|
|
121
|
+
text: JSON.stringify(response, null, 2),
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: "text",
|
|
132
|
+
text: `Error getting active note: ${message}`,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// TOOL: append_to_active_note
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// Append content to the currently active note.
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
server.tool("append_to_active_note", "Append content to the currently active note in Obsidian. " +
|
|
145
|
+
"Useful for quickly adding content to whatever note you're working on.", {
|
|
146
|
+
content: z.string().describe("Content to append."),
|
|
147
|
+
ensureNewline: z
|
|
148
|
+
.boolean()
|
|
149
|
+
.optional()
|
|
150
|
+
.default(true)
|
|
151
|
+
.describe("Whether to ensure content starts on a new line."),
|
|
152
|
+
}, async ({ content, ensureNewline }) => {
|
|
153
|
+
try {
|
|
154
|
+
// First check if there's an active note
|
|
155
|
+
const activeNote = await client.getActiveFile();
|
|
156
|
+
if (!activeNote) {
|
|
157
|
+
return {
|
|
158
|
+
content: [
|
|
159
|
+
{
|
|
160
|
+
type: "text",
|
|
161
|
+
text: "No note is currently open in Obsidian.",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
isError: true,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
const contentToAppend = ensureNewline ? `\n${content}` : content;
|
|
168
|
+
await client.appendToActiveFile(contentToAppend);
|
|
169
|
+
return {
|
|
170
|
+
content: [
|
|
171
|
+
{
|
|
172
|
+
type: "text",
|
|
173
|
+
text: JSON.stringify({
|
|
174
|
+
success: true,
|
|
175
|
+
message: `Content appended to: ${activeNote.path}`,
|
|
176
|
+
path: activeNote.path,
|
|
177
|
+
}, null, 2),
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
184
|
+
return {
|
|
185
|
+
content: [
|
|
186
|
+
{
|
|
187
|
+
type: "text",
|
|
188
|
+
text: `Error appending to active note: ${message}`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
isError: true,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// TOOL: get_commands
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
// Get list of available Obsidian commands.
|
|
199
|
+
// ---------------------------------------------------------------------------
|
|
200
|
+
server.tool("get_commands", "Get a list of all available commands in Obsidian. " +
|
|
201
|
+
"Commands are actions that can be executed, like 'Toggle fold' or 'Export to PDF'.", {
|
|
202
|
+
filter: z
|
|
203
|
+
.string()
|
|
204
|
+
.optional()
|
|
205
|
+
.describe("Filter commands by name (case-insensitive)."),
|
|
206
|
+
}, async ({ filter }) => {
|
|
207
|
+
try {
|
|
208
|
+
const commands = await client.getCommands();
|
|
209
|
+
let filteredCommands = commands;
|
|
210
|
+
if (filter) {
|
|
211
|
+
const lowerFilter = filter.toLowerCase();
|
|
212
|
+
filteredCommands = commands.filter((cmd) => cmd.name.toLowerCase().includes(lowerFilter) ||
|
|
213
|
+
cmd.id.toLowerCase().includes(lowerFilter));
|
|
214
|
+
}
|
|
215
|
+
// Sort by name
|
|
216
|
+
filteredCommands.sort((a, b) => a.name.localeCompare(b.name));
|
|
217
|
+
return {
|
|
218
|
+
content: [
|
|
219
|
+
{
|
|
220
|
+
type: "text",
|
|
221
|
+
text: JSON.stringify({
|
|
222
|
+
success: true,
|
|
223
|
+
filter: filter || null,
|
|
224
|
+
totalCommands: commands.length,
|
|
225
|
+
showing: filteredCommands.length,
|
|
226
|
+
commands: filteredCommands.map((cmd) => ({
|
|
227
|
+
id: cmd.id,
|
|
228
|
+
name: cmd.name,
|
|
229
|
+
})),
|
|
230
|
+
}, null, 2),
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
237
|
+
return {
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: "text",
|
|
241
|
+
text: `Error getting commands: ${message}`,
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
isError: true,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
// TOOL: execute_command
|
|
250
|
+
// ---------------------------------------------------------------------------
|
|
251
|
+
// Execute an Obsidian command.
|
|
252
|
+
// ---------------------------------------------------------------------------
|
|
253
|
+
server.tool("execute_command", "Execute an Obsidian command by its ID. " +
|
|
254
|
+
"Use get_commands to find available commands and their IDs. " +
|
|
255
|
+
"Examples: 'app:toggle-left-sidebar', 'editor:toggle-fold'", {
|
|
256
|
+
commandId: z.string().describe("The command ID to execute."),
|
|
257
|
+
}, async ({ commandId }) => {
|
|
258
|
+
try {
|
|
259
|
+
await client.executeCommand(commandId);
|
|
260
|
+
return {
|
|
261
|
+
content: [
|
|
262
|
+
{
|
|
263
|
+
type: "text",
|
|
264
|
+
text: JSON.stringify({
|
|
265
|
+
success: true,
|
|
266
|
+
message: `Command executed: ${commandId}`,
|
|
267
|
+
commandId,
|
|
268
|
+
}, null, 2),
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
275
|
+
return {
|
|
276
|
+
content: [
|
|
277
|
+
{
|
|
278
|
+
type: "text",
|
|
279
|
+
text: `Error executing command: ${message}`,
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
isError: true,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
// TOOL: quick_capture
|
|
288
|
+
// ---------------------------------------------------------------------------
|
|
289
|
+
// Quickly capture a thought or note to a designated capture file.
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
server.tool("quick_capture", "Quickly capture a thought, idea, or note. " +
|
|
292
|
+
"Appends to a designated capture file with timestamp. " +
|
|
293
|
+
"Great for inbox-style note capture.", {
|
|
294
|
+
content: z.string().describe("Content to capture."),
|
|
295
|
+
captureFile: z
|
|
296
|
+
.string()
|
|
297
|
+
.optional()
|
|
298
|
+
.default("Inbox.md")
|
|
299
|
+
.describe("File to capture to (default: Inbox.md)."),
|
|
300
|
+
addTimestamp: z
|
|
301
|
+
.boolean()
|
|
302
|
+
.optional()
|
|
303
|
+
.default(true)
|
|
304
|
+
.describe("Whether to add a timestamp."),
|
|
305
|
+
format: z
|
|
306
|
+
.enum(["bullet", "checkbox", "paragraph"])
|
|
307
|
+
.optional()
|
|
308
|
+
.default("bullet")
|
|
309
|
+
.describe("Format for the capture (bullet, checkbox, or paragraph)."),
|
|
310
|
+
}, async ({ content, captureFile, addTimestamp, format }) => {
|
|
311
|
+
try {
|
|
312
|
+
const filePath = captureFile.endsWith(".md")
|
|
313
|
+
? captureFile
|
|
314
|
+
: `${captureFile}.md`;
|
|
315
|
+
// Format the content
|
|
316
|
+
let formattedContent;
|
|
317
|
+
const timestamp = addTimestamp
|
|
318
|
+
? new Date().toLocaleString()
|
|
319
|
+
: "";
|
|
320
|
+
switch (format) {
|
|
321
|
+
case "checkbox":
|
|
322
|
+
formattedContent = timestamp
|
|
323
|
+
? `- [ ] [${timestamp}] ${content}`
|
|
324
|
+
: `- [ ] ${content}`;
|
|
325
|
+
break;
|
|
326
|
+
case "paragraph":
|
|
327
|
+
formattedContent = timestamp ? `**${timestamp}**\n${content}` : content;
|
|
328
|
+
break;
|
|
329
|
+
case "bullet":
|
|
330
|
+
default:
|
|
331
|
+
formattedContent = timestamp
|
|
332
|
+
? `- [${timestamp}] ${content}`
|
|
333
|
+
: `- ${content}`;
|
|
334
|
+
}
|
|
335
|
+
// Append to capture file
|
|
336
|
+
try {
|
|
337
|
+
await client.appendToFile(filePath, `\n${formattedContent}`);
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
// File might not exist, create it
|
|
341
|
+
if (error instanceof ObsidianApiError && error.status === 404) {
|
|
342
|
+
const initialContent = `# Inbox\n\n${formattedContent}`;
|
|
343
|
+
await client.putFile(filePath, initialContent);
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return {
|
|
350
|
+
content: [
|
|
351
|
+
{
|
|
352
|
+
type: "text",
|
|
353
|
+
text: JSON.stringify({
|
|
354
|
+
success: true,
|
|
355
|
+
message: `Captured to: ${filePath}`,
|
|
356
|
+
captureFile: filePath,
|
|
357
|
+
timestamp: addTimestamp ? timestamp : null,
|
|
358
|
+
format,
|
|
359
|
+
}, null, 2),
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
const message = error instanceof ObsidianApiError ? error.message : String(error);
|
|
366
|
+
return {
|
|
367
|
+
content: [
|
|
368
|
+
{
|
|
369
|
+
type: "text",
|
|
370
|
+
text: `Error capturing: ${message}`,
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
isError: true,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/tools/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAAsB;IAEtB,8EAA8E;IAC9E,kBAAkB;IAClB,8EAA8E;IAC9E,kCAAkC;IAClC,8EAA8E;IAE9E,MAAM,CAAC,IAAI,CACT,WAAW,EACX,8CAA8C;QAC5C,gDAAgD,EAClD;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QACtD,OAAO,EAAE,CAAC;aACP,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,OAAO,CAAC,KAAK,CAAC;aACd,QAAQ,CAAC,6CAA6C,CAAC;KAC3D,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,QAA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AAO,KAAK,EAAE,CAAC;gBACf,kCAAkC;gBAClC,IAAI,KAAK,YAAY,gBAAgB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC9D,MAAM,cAAc,GAAG,cAAc,gBAAgB,EAAE,CAAC;oBACxD,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBACjD,CAAC;qBAAM,CAAC;oBACN,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,OAAO,EAAE,IAAI;4BACb,OAAO,EAAE,gBAAgB,QAAQ,EAAE;4BACnC,WAAW,EAAE,QAAQ;4BACrB,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;4BAC1C,MAAM;yBACP,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,oBAAoB,OAAO,EAAE;qBACpC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Note Tools
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Core tools for creating, reading, updating, and deleting notes.
|
|
7
|
+
* These are the fundamental operations for note management.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import { ObsidianClient } from "../utils/client.js";
|
|
12
|
+
/**
|
|
13
|
+
* Register note CRUD 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 registerNoteTools(server: McpServer, client: ObsidianClient): void;
|
|
19
|
+
//# sourceMappingURL=notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/tools/notes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASpD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAguBjF"}
|