@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,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Prompts
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Pre-built prompt templates for common Obsidian workflows.
|
|
7
|
+
* These help users quickly perform complex operations with their vault.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/**
|
|
12
|
+
* Register Obsidian prompts with the MCP server.
|
|
13
|
+
*
|
|
14
|
+
* @param server - The MCP server instance
|
|
15
|
+
*/
|
|
16
|
+
export function registerObsidianPrompts(server) {
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// PROMPT: summarize-note
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Summarize the content of a note.
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
server.prompt("summarize-note", "Generate a summary of an Obsidian note", {
|
|
23
|
+
notePath: z.string().describe("Path to the note to summarize"),
|
|
24
|
+
format: z
|
|
25
|
+
.enum(["brief", "detailed", "bullet-points"])
|
|
26
|
+
.optional()
|
|
27
|
+
.default("brief")
|
|
28
|
+
.describe("Summary format"),
|
|
29
|
+
}, async ({ notePath, format }) => ({
|
|
30
|
+
messages: [
|
|
31
|
+
{
|
|
32
|
+
role: "user",
|
|
33
|
+
content: {
|
|
34
|
+
type: "text",
|
|
35
|
+
text: `Please read the note at "${notePath}" using the read_note tool, then provide a ${format} summary.
|
|
36
|
+
|
|
37
|
+
${format === "brief" ? "Keep the summary to 2-3 sentences capturing the main points." : ""}
|
|
38
|
+
${format === "detailed" ? "Provide a comprehensive summary covering all major topics and key details." : ""}
|
|
39
|
+
${format === "bullet-points" ? "Format the summary as bullet points, one for each key concept or section." : ""}
|
|
40
|
+
|
|
41
|
+
After summarizing, suggest 2-3 related topics or notes that might be worth linking to.`,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
}));
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// PROMPT: organize-vault
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Analyze and suggest vault organization improvements.
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
server.prompt("organize-vault", "Analyze vault structure and suggest organization improvements", {
|
|
52
|
+
folder: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("Specific folder to analyze, or leave empty for entire vault"),
|
|
56
|
+
}, async ({ folder }) => ({
|
|
57
|
+
messages: [
|
|
58
|
+
{
|
|
59
|
+
role: "user",
|
|
60
|
+
content: {
|
|
61
|
+
type: "text",
|
|
62
|
+
text: `Please analyze my Obsidian vault ${folder ? `(specifically the "${folder}" folder)` : ""} and suggest organization improvements.
|
|
63
|
+
|
|
64
|
+
1. First, use list_all_files to see the structure
|
|
65
|
+
2. Use get_all_tags_in_vault to understand the tag taxonomy
|
|
66
|
+
3. Use find_orphan_notes to find unlinked notes
|
|
67
|
+
|
|
68
|
+
Then provide:
|
|
69
|
+
- An overview of the current organization
|
|
70
|
+
- Suggestions for folder restructuring if needed
|
|
71
|
+
- Tag consolidation recommendations
|
|
72
|
+
- Notes that could benefit from better linking
|
|
73
|
+
- Any other organization improvements`,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}));
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// PROMPT: daily-review
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Review and summarize today's activities.
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
server.prompt("daily-review", "Generate a daily review based on today's notes and activities", {}, async () => ({
|
|
84
|
+
messages: [
|
|
85
|
+
{
|
|
86
|
+
role: "user",
|
|
87
|
+
content: {
|
|
88
|
+
type: "text",
|
|
89
|
+
text: `Please help me with my daily review:
|
|
90
|
+
|
|
91
|
+
1. Use get_daily_note to fetch today's daily note
|
|
92
|
+
2. Review any content I've added today
|
|
93
|
+
3. Identify:
|
|
94
|
+
- Tasks completed (checked items)
|
|
95
|
+
- Tasks still pending
|
|
96
|
+
- Key notes or ideas captured
|
|
97
|
+
- Links to other notes made
|
|
98
|
+
|
|
99
|
+
Then provide:
|
|
100
|
+
- A brief summary of my day's activities
|
|
101
|
+
- Suggestions for tomorrow's priorities
|
|
102
|
+
- Any thoughts or patterns you notice`,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
}));
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// PROMPT: weekly-review
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Weekly review prompt.
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
server.prompt("weekly-review", "Generate a weekly review and planning session", {}, async () => ({
|
|
113
|
+
messages: [
|
|
114
|
+
{
|
|
115
|
+
role: "user",
|
|
116
|
+
content: {
|
|
117
|
+
type: "text",
|
|
118
|
+
text: `Please help me with my weekly review:
|
|
119
|
+
|
|
120
|
+
1. Use get_periodic_note with period "weekly" to get this week's note if it exists
|
|
121
|
+
2. Search for notes created or modified this week using search_notes
|
|
122
|
+
|
|
123
|
+
Review and summarize:
|
|
124
|
+
- Key accomplishments this week
|
|
125
|
+
- Projects worked on
|
|
126
|
+
- Ideas captured
|
|
127
|
+
- Meetings and interactions
|
|
128
|
+
|
|
129
|
+
Then help me plan:
|
|
130
|
+
- Priorities for next week
|
|
131
|
+
- Follow-ups needed
|
|
132
|
+
- Notes that need attention or further development`,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
}));
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// PROMPT: research-topic
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Research a topic across the vault.
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
server.prompt("research-topic", "Research a topic by searching across your vault", {
|
|
143
|
+
topic: z.string().describe("The topic to research"),
|
|
144
|
+
}, async ({ topic }) => ({
|
|
145
|
+
messages: [
|
|
146
|
+
{
|
|
147
|
+
role: "user",
|
|
148
|
+
content: {
|
|
149
|
+
type: "text",
|
|
150
|
+
text: `Please research "${topic}" across my Obsidian vault:
|
|
151
|
+
|
|
152
|
+
1. Use search_with_context to find all relevant notes
|
|
153
|
+
2. For the most relevant results, use read_note to get full content
|
|
154
|
+
3. Use get_backlinks and get_outgoing_links to understand connections
|
|
155
|
+
|
|
156
|
+
Provide:
|
|
157
|
+
- A synthesis of what I've written about this topic
|
|
158
|
+
- Key insights from across my notes
|
|
159
|
+
- Connections between different notes on this topic
|
|
160
|
+
- Gaps in my knowledge or notes that could be expanded
|
|
161
|
+
- Suggestions for new notes or links to create`,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
}));
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// PROMPT: create-moc
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
// Create a Map of Content note.
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
server.prompt("create-moc", "Create a Map of Content (MOC) for a topic", {
|
|
172
|
+
topic: z.string().describe("The topic for the MOC"),
|
|
173
|
+
folder: z
|
|
174
|
+
.string()
|
|
175
|
+
.optional()
|
|
176
|
+
.describe("Folder to search in"),
|
|
177
|
+
}, async ({ topic, folder }) => ({
|
|
178
|
+
messages: [
|
|
179
|
+
{
|
|
180
|
+
role: "user",
|
|
181
|
+
content: {
|
|
182
|
+
type: "text",
|
|
183
|
+
text: `Please help me create a Map of Content (MOC) for "${topic}":
|
|
184
|
+
|
|
185
|
+
1. Search for related notes using search_with_context
|
|
186
|
+
${folder ? `2. Focus on the "${folder}" folder` : "2. Search the entire vault"}
|
|
187
|
+
3. Analyze the structure and relationships between notes
|
|
188
|
+
|
|
189
|
+
Create an MOC note that:
|
|
190
|
+
- Has a clear introduction explaining the topic
|
|
191
|
+
- Organizes related notes into logical categories/sections
|
|
192
|
+
- Uses [[wikilinks]] to link to all relevant notes
|
|
193
|
+
- Includes brief descriptions of each linked note
|
|
194
|
+
- Suggests gaps or areas that need more notes
|
|
195
|
+
|
|
196
|
+
Use create_note to save the MOC when ready.`,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
}));
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// PROMPT: process-inbox
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
// Process inbox/capture notes.
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
server.prompt("process-inbox", "Process captured notes from inbox and file them appropriately", {
|
|
207
|
+
inboxPath: z
|
|
208
|
+
.string()
|
|
209
|
+
.optional()
|
|
210
|
+
.default("Inbox.md")
|
|
211
|
+
.describe("Path to your inbox note"),
|
|
212
|
+
}, async ({ inboxPath }) => ({
|
|
213
|
+
messages: [
|
|
214
|
+
{
|
|
215
|
+
role: "user",
|
|
216
|
+
content: {
|
|
217
|
+
type: "text",
|
|
218
|
+
text: `Please help me process my inbox at "${inboxPath}":
|
|
219
|
+
|
|
220
|
+
1. Read the inbox using read_note
|
|
221
|
+
2. For each item in the inbox:
|
|
222
|
+
- Determine if it should become its own note
|
|
223
|
+
- Identify which folder it belongs in
|
|
224
|
+
- Suggest tags and links
|
|
225
|
+
- Identify if it relates to existing notes
|
|
226
|
+
|
|
227
|
+
Provide a processing plan:
|
|
228
|
+
- Items to expand into full notes (with suggested titles and locations)
|
|
229
|
+
- Items to append to existing notes (with target notes)
|
|
230
|
+
- Items to add to projects or tasks
|
|
231
|
+
- Items that can be archived or deleted
|
|
232
|
+
|
|
233
|
+
Then help me execute the plan using the appropriate tools.`,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
}));
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
239
|
+
// PROMPT: link-suggestions
|
|
240
|
+
// ---------------------------------------------------------------------------
|
|
241
|
+
// Suggest links for a note.
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
server.prompt("link-suggestions", "Suggest links to add to a note based on its content", {
|
|
244
|
+
notePath: z.string().describe("Path to the note to analyze"),
|
|
245
|
+
}, async ({ notePath }) => ({
|
|
246
|
+
messages: [
|
|
247
|
+
{
|
|
248
|
+
role: "user",
|
|
249
|
+
content: {
|
|
250
|
+
type: "text",
|
|
251
|
+
text: `Please analyze "${notePath}" and suggest links to add:
|
|
252
|
+
|
|
253
|
+
1. Read the note using read_note
|
|
254
|
+
2. Identify key concepts, people, projects, or terms mentioned
|
|
255
|
+
3. Search for existing notes that could be linked
|
|
256
|
+
4. Check current outgoing links to avoid duplicates
|
|
257
|
+
|
|
258
|
+
Provide:
|
|
259
|
+
- Specific text in the note that should be linked
|
|
260
|
+
- The notes to link to
|
|
261
|
+
- New notes that should be created and linked
|
|
262
|
+
|
|
263
|
+
After approval, help add the links using add_link_to_note or by updating the note content.`,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
}));
|
|
268
|
+
// ---------------------------------------------------------------------------
|
|
269
|
+
// PROMPT: meeting-prep
|
|
270
|
+
// ---------------------------------------------------------------------------
|
|
271
|
+
// Prepare for a meeting.
|
|
272
|
+
// ---------------------------------------------------------------------------
|
|
273
|
+
server.prompt("meeting-prep", "Prepare for an upcoming meeting by gathering relevant notes", {
|
|
274
|
+
meetingTopic: z.string().describe("Topic or subject of the meeting"),
|
|
275
|
+
attendees: z
|
|
276
|
+
.string()
|
|
277
|
+
.optional()
|
|
278
|
+
.describe("Names of attendees (comma-separated)"),
|
|
279
|
+
}, async ({ meetingTopic, attendees }) => ({
|
|
280
|
+
messages: [
|
|
281
|
+
{
|
|
282
|
+
role: "user",
|
|
283
|
+
content: {
|
|
284
|
+
type: "text",
|
|
285
|
+
text: `Please help me prepare for a meeting about "${meetingTopic}"${attendees ? ` with ${attendees}` : ""}:
|
|
286
|
+
|
|
287
|
+
1. Search for notes related to the topic
|
|
288
|
+
2. ${attendees ? `Search for notes about the attendees` : ""}
|
|
289
|
+
3. Find any previous meeting notes on this topic
|
|
290
|
+
4. Look for relevant projects or tasks
|
|
291
|
+
|
|
292
|
+
Compile:
|
|
293
|
+
- Key background information I should review
|
|
294
|
+
- Open questions or items to discuss
|
|
295
|
+
- Relevant past decisions or discussions
|
|
296
|
+
- Talking points and agenda suggestions
|
|
297
|
+
|
|
298
|
+
Optionally, create a meeting note using create_meeting_note with the prepared agenda.`,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
}));
|
|
303
|
+
console.error("✅ Obsidian prompts registered");
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=obsidian.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"obsidian.js","sourceRoot":"","sources":["../../src/prompts/obsidian.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,8EAA8E;IAC9E,yBAAyB;IACzB,8EAA8E;IAC9E,mCAAmC;IACnC,8EAA8E;IAE9E,MAAM,CAAC,MAAM,CACX,gBAAgB,EAChB,wCAAwC,EACxC;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC9D,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;aAC5C,QAAQ,EAAE;aACV,OAAO,CAAC,OAAO,CAAC;aAChB,QAAQ,CAAC,gBAAgB,CAAC;KAC9B,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EA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ChF;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,8EAA8E;IAC9E,uBAAuB;IACvB,8EAA8E;IAC9E,yBAAyB;IACzB,8EAA8E;IAE9E,MAAM,CAAC,MAAM,CACX,cAAc,EACd,6DAA6D,EAC7D;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QACpE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,sCAAsC,CAAC;KACpD,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QACtC,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,+CAA+C,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;;;KAGjH,SAAS,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;sFAU0B;iBAC3E;aACF;SACF;KACF,CAAC,CACH,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* MCP RESOURCES - Providing Data to AI
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Resources are data sources that AI can read. Unlike tools (which DO things),
|
|
7
|
+
* resources PROVIDE things - like files, database records, or API responses.
|
|
8
|
+
*
|
|
9
|
+
* WHEN TO USE RESOURCES vs TOOLS:
|
|
10
|
+
* - Resource: "Here's the content of config.json" (reading data)
|
|
11
|
+
* - Tool: "Update the config file with these values" (performing action)
|
|
12
|
+
*
|
|
13
|
+
* ANATOMY OF A RESOURCE:
|
|
14
|
+
*
|
|
15
|
+
* server.resource(
|
|
16
|
+
* "name", // Display name for the resource
|
|
17
|
+
* "mcp://your/uri", // Unique URI to identify it
|
|
18
|
+
* { description, mimeType }, // Metadata
|
|
19
|
+
* async (uri) => {} // Function that returns the content
|
|
20
|
+
* );
|
|
21
|
+
*
|
|
22
|
+
* NOTE: Resources are optional! Many MCP servers only have tools.
|
|
23
|
+
* ============================================================================
|
|
24
|
+
*/
|
|
25
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
26
|
+
/**
|
|
27
|
+
* Registers example resources.
|
|
28
|
+
* Delete or modify these - they're just examples!
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerResources(server: McpServer): void;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA+EzD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* MCP RESOURCES - Providing Data to AI
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* Resources are data sources that AI can read. Unlike tools (which DO things),
|
|
7
|
+
* resources PROVIDE things - like files, database records, or API responses.
|
|
8
|
+
*
|
|
9
|
+
* WHEN TO USE RESOURCES vs TOOLS:
|
|
10
|
+
* - Resource: "Here's the content of config.json" (reading data)
|
|
11
|
+
* - Tool: "Update the config file with these values" (performing action)
|
|
12
|
+
*
|
|
13
|
+
* ANATOMY OF A RESOURCE:
|
|
14
|
+
*
|
|
15
|
+
* server.resource(
|
|
16
|
+
* "name", // Display name for the resource
|
|
17
|
+
* "mcp://your/uri", // Unique URI to identify it
|
|
18
|
+
* { description, mimeType }, // Metadata
|
|
19
|
+
* async (uri) => {} // Function that returns the content
|
|
20
|
+
* );
|
|
21
|
+
*
|
|
22
|
+
* NOTE: Resources are optional! Many MCP servers only have tools.
|
|
23
|
+
* ============================================================================
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Registers example resources.
|
|
27
|
+
* Delete or modify these - they're just examples!
|
|
28
|
+
*/
|
|
29
|
+
export function registerResources(server) {
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// RESOURCE: readme (simple text resource)
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// This resource provides static text information about the server.
|
|
34
|
+
// Great for documentation or static content.
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
server.resource("readme", // Name shown in MCP clients
|
|
37
|
+
"mcp://server/readme", // URI - use mcp:// for custom resources
|
|
38
|
+
{
|
|
39
|
+
description: "Information about this MCP server",
|
|
40
|
+
mimeType: "text/plain", // Tells AI what kind of data this is
|
|
41
|
+
}, async (uri) => ({
|
|
42
|
+
contents: [
|
|
43
|
+
{
|
|
44
|
+
uri: uri.href, // Echo back the requested URI
|
|
45
|
+
mimeType: "text/plain",
|
|
46
|
+
text: `MCP Server Starter
|
|
47
|
+
|
|
48
|
+
This is a starter template for building MCP servers.
|
|
49
|
+
|
|
50
|
+
Available Tools:
|
|
51
|
+
- add: Add two numbers
|
|
52
|
+
- subtract: Subtract two numbers
|
|
53
|
+
- multiply: Multiply two numbers
|
|
54
|
+
- divide: Divide two numbers
|
|
55
|
+
- greet: Generate a personalized greeting
|
|
56
|
+
- get_current_time: Get the current date and time
|
|
57
|
+
- echo: Echo back a message
|
|
58
|
+
|
|
59
|
+
For more information, visit: https://modelcontextprotocol.io`,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
}));
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// RESOURCE: server-info (JSON data resource)
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// This resource provides structured JSON data.
|
|
67
|
+
// Useful for configuration, status info, or structured data.
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
server.resource("server-info", "mcp://server/info", {
|
|
70
|
+
description: "JSON data about this MCP server",
|
|
71
|
+
mimeType: "application/json",
|
|
72
|
+
}, async (uri) => ({
|
|
73
|
+
contents: [
|
|
74
|
+
{
|
|
75
|
+
uri: uri.href,
|
|
76
|
+
mimeType: "application/json",
|
|
77
|
+
// You can generate dynamic data here!
|
|
78
|
+
text: JSON.stringify({
|
|
79
|
+
name: "mcp-server-starter",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
capabilities: {
|
|
82
|
+
tools: true,
|
|
83
|
+
resources: true,
|
|
84
|
+
prompts: true,
|
|
85
|
+
},
|
|
86
|
+
toolCount: 7,
|
|
87
|
+
timestamp: new Date().toISOString(),
|
|
88
|
+
}, null, 2 // Pretty-print with 2-space indent
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
// =============================================================================
|
|
95
|
+
// MORE RESOURCE IDEAS
|
|
96
|
+
// =============================================================================
|
|
97
|
+
//
|
|
98
|
+
// Dynamic file content:
|
|
99
|
+
// import { readFile } from "fs/promises";
|
|
100
|
+
// text: await readFile("./data/config.json", "utf-8")
|
|
101
|
+
//
|
|
102
|
+
// API response:
|
|
103
|
+
// const response = await fetch("https://api.example.com/data");
|
|
104
|
+
// text: await response.text()
|
|
105
|
+
//
|
|
106
|
+
// Database query:
|
|
107
|
+
// const rows = await db.query("SELECT * FROM users");
|
|
108
|
+
// text: JSON.stringify(rows)
|
|
109
|
+
//
|
|
110
|
+
// =============================================================================
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;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ACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAChF,EAAE;AACF,wBAAwB;AACxB,4CAA4C;AAC5C,wDAAwD;AACxD,EAAE;AACF,gBAAgB;AAChB,kEAAkE;AAClE,gCAAgC;AAChC,EAAE;AACF,kBAAkB;AAClB,wDAAwD;AACxD,+BAA+B;AAC/B,EAAE;AACF,gFAAgF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================================
|
|
3
|
+
* OBSIDIAN MCP - Resources
|
|
4
|
+
* ============================================================================
|
|
5
|
+
*
|
|
6
|
+
* MCP Resources provide read-only data that AI can access.
|
|
7
|
+
* These resources provide vault information and status data.
|
|
8
|
+
* ============================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import { ObsidianClient } from "../utils/client.js";
|
|
12
|
+
/**
|
|
13
|
+
* Register Obsidian resources with the MCP server.
|
|
14
|
+
*
|
|
15
|
+
* @param server - The MCP server instance
|
|
16
|
+
* @param client - The Obsidian API client (or null if not configured)
|
|
17
|
+
*/
|
|
18
|
+
export declare function registerObsidianResources(server: McpServer, client: ObsidianClient | null): void;
|
|
19
|
+
//# sourceMappingURL=obsidian.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"obsidian.d.ts","sourceRoot":"","sources":["../../src/resources/obsidian.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,GAAG,IAAI,GAC5B,IAAI,CAiQN"}
|