reflect-mcp 1.0.3 → 1.0.4
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/dist/tools/index.js +35 -35
- package/package.json +2 -1
package/dist/tools/index.js
CHANGED
|
@@ -62,11 +62,11 @@ export function registerTools(server, dbPath) {
|
|
|
62
62
|
description: "Get backlinks for a note from Reflect. Use this tool to get more context about a note after calling the get_note tool.",
|
|
63
63
|
parameters: z.object({
|
|
64
64
|
subject: z.string().describe("The subject/title of the note to get backlinks for"),
|
|
65
|
-
|
|
65
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
66
66
|
limit: z.number().default(10).describe("Maximum number of backlinks to return"),
|
|
67
67
|
}),
|
|
68
68
|
execute: async (args) => {
|
|
69
|
-
const { subject,
|
|
69
|
+
const { subject, graph_id, limit } = args;
|
|
70
70
|
try {
|
|
71
71
|
const dbFile = resolvedDbPath;
|
|
72
72
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -79,7 +79,7 @@ export function registerTools(server, dbPath) {
|
|
|
79
79
|
ORDER BY bl.updatedAt DESC
|
|
80
80
|
LIMIT ?
|
|
81
81
|
`);
|
|
82
|
-
const results = stmt.all(subject,
|
|
82
|
+
const results = stmt.all(subject, graph_id, limit);
|
|
83
83
|
db.close();
|
|
84
84
|
const backlinks = results.map((row) => ({
|
|
85
85
|
fromSubject: row.from_subject,
|
|
@@ -91,7 +91,7 @@ export function registerTools(server, dbPath) {
|
|
|
91
91
|
content: [
|
|
92
92
|
{
|
|
93
93
|
type: "text",
|
|
94
|
-
text: JSON.stringify({ subject,
|
|
94
|
+
text: JSON.stringify({ subject, graph_id, backlinks }, null, 2),
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
97
|
};
|
|
@@ -114,10 +114,10 @@ export function registerTools(server, dbPath) {
|
|
|
114
114
|
description: "Get the most recent daily notes from Reflect.",
|
|
115
115
|
parameters: z.object({
|
|
116
116
|
limit: z.number().default(5).describe("Number of recent daily notes to return"),
|
|
117
|
-
|
|
117
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
118
118
|
}),
|
|
119
119
|
execute: async (args) => {
|
|
120
|
-
const { limit,
|
|
120
|
+
const { limit, graph_id } = args;
|
|
121
121
|
try {
|
|
122
122
|
const dbFile = resolvedDbPath;
|
|
123
123
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -128,7 +128,7 @@ export function registerTools(server, dbPath) {
|
|
|
128
128
|
ORDER BY dailyDate DESC
|
|
129
129
|
LIMIT ?
|
|
130
130
|
`);
|
|
131
|
-
const rows = stmt.all(
|
|
131
|
+
const rows = stmt.all(graph_id, limit);
|
|
132
132
|
db.close();
|
|
133
133
|
const dailyNotes = rows.map((row) => ({
|
|
134
134
|
id: row.id,
|
|
@@ -137,13 +137,13 @@ export function registerTools(server, dbPath) {
|
|
|
137
137
|
editedAt: formatDate(row.editedAt),
|
|
138
138
|
tags: row.tags ? JSON.parse(row.tags) : [],
|
|
139
139
|
dailyDate: formatDate(row.dailyDate),
|
|
140
|
-
|
|
140
|
+
graph_id: row.graphId,
|
|
141
141
|
}));
|
|
142
142
|
return {
|
|
143
143
|
content: [
|
|
144
144
|
{
|
|
145
145
|
type: "text",
|
|
146
|
-
text: JSON.stringify({
|
|
146
|
+
text: JSON.stringify({ graph_id, count: dailyNotes.length, dailyNotes }, null, 2),
|
|
147
147
|
},
|
|
148
148
|
],
|
|
149
149
|
};
|
|
@@ -166,10 +166,10 @@ export function registerTools(server, dbPath) {
|
|
|
166
166
|
description: "Get the daily note for a specific date.",
|
|
167
167
|
parameters: z.object({
|
|
168
168
|
date: z.string().describe("The date in YYYY-MM-DD format"),
|
|
169
|
-
|
|
169
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
170
170
|
}),
|
|
171
171
|
execute: async (args) => {
|
|
172
|
-
const { date,
|
|
172
|
+
const { date, graph_id } = args;
|
|
173
173
|
try {
|
|
174
174
|
const dbFile = resolvedDbPath;
|
|
175
175
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -180,14 +180,14 @@ export function registerTools(server, dbPath) {
|
|
|
180
180
|
FROM notes
|
|
181
181
|
WHERE isDaily = 1 AND isDeleted = 0 AND graphId = ? AND dailyDate = ?
|
|
182
182
|
`);
|
|
183
|
-
const result = stmt.get(
|
|
183
|
+
const result = stmt.get(graph_id, dateMs);
|
|
184
184
|
db.close();
|
|
185
185
|
if (!result) {
|
|
186
186
|
return {
|
|
187
187
|
content: [
|
|
188
188
|
{
|
|
189
189
|
type: "text",
|
|
190
|
-
text: JSON.stringify({ error: `No daily note found for ${date}`, date,
|
|
190
|
+
text: JSON.stringify({ error: `No daily note found for ${date}`, date, graph_id }),
|
|
191
191
|
},
|
|
192
192
|
],
|
|
193
193
|
};
|
|
@@ -199,13 +199,13 @@ export function registerTools(server, dbPath) {
|
|
|
199
199
|
editedAt: formatDate(result.editedAt),
|
|
200
200
|
tags: result.tags ? JSON.parse(result.tags) : [],
|
|
201
201
|
dailyDate: formatDate(result.dailyDate),
|
|
202
|
-
|
|
202
|
+
graph_id: result.graph_id,
|
|
203
203
|
};
|
|
204
204
|
return {
|
|
205
205
|
content: [
|
|
206
206
|
{
|
|
207
207
|
type: "text",
|
|
208
|
-
text: JSON.stringify({ date,
|
|
208
|
+
text: JSON.stringify({ date, graph_id, dailyNote }, null, 2),
|
|
209
209
|
},
|
|
210
210
|
],
|
|
211
211
|
};
|
|
@@ -229,10 +229,10 @@ export function registerTools(server, dbPath) {
|
|
|
229
229
|
parameters: z.object({
|
|
230
230
|
minBacklinks: z.number().default(5).describe("Minimum number of backlinks a note must have"),
|
|
231
231
|
limit: z.number().default(10).describe("Maximum number of notes to return"),
|
|
232
|
-
|
|
232
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
233
233
|
}),
|
|
234
234
|
execute: async (args) => {
|
|
235
|
-
const { minBacklinks, limit,
|
|
235
|
+
const { minBacklinks, limit, graph_id } = args;
|
|
236
236
|
try {
|
|
237
237
|
const dbFile = resolvedDbPath;
|
|
238
238
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -246,7 +246,7 @@ export function registerTools(server, dbPath) {
|
|
|
246
246
|
ORDER BY backlink_count DESC
|
|
247
247
|
LIMIT ?
|
|
248
248
|
`);
|
|
249
|
-
const results = stmt.all(
|
|
249
|
+
const results = stmt.all(graph_id, minBacklinks, limit);
|
|
250
250
|
db.close();
|
|
251
251
|
const notes = results.map((row) => ({
|
|
252
252
|
id: row.id,
|
|
@@ -258,7 +258,7 @@ export function registerTools(server, dbPath) {
|
|
|
258
258
|
content: [
|
|
259
259
|
{
|
|
260
260
|
type: "text",
|
|
261
|
-
text: JSON.stringify({
|
|
261
|
+
text: JSON.stringify({ graph_id, minBacklinks, count: notes.length, notes }, null, 2),
|
|
262
262
|
},
|
|
263
263
|
],
|
|
264
264
|
};
|
|
@@ -280,11 +280,11 @@ export function registerTools(server, dbPath) {
|
|
|
280
280
|
name: "get_tags",
|
|
281
281
|
description: "Get all unique tags with their usage counts from Reflect.",
|
|
282
282
|
parameters: z.object({
|
|
283
|
-
|
|
283
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
284
284
|
limit: z.number().default(50).describe("Maximum number of tags to return"),
|
|
285
285
|
}),
|
|
286
286
|
execute: async (args) => {
|
|
287
|
-
const {
|
|
287
|
+
const { graph_id, limit } = args;
|
|
288
288
|
try {
|
|
289
289
|
const dbFile = resolvedDbPath;
|
|
290
290
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -292,7 +292,7 @@ export function registerTools(server, dbPath) {
|
|
|
292
292
|
SELECT tags FROM notes
|
|
293
293
|
WHERE isDeleted = 0 AND graphId = ? AND tags IS NOT NULL AND tags != '[]'
|
|
294
294
|
`);
|
|
295
|
-
const rows = stmt.all(
|
|
295
|
+
const rows = stmt.all(graph_id);
|
|
296
296
|
db.close();
|
|
297
297
|
const tagCounts = {};
|
|
298
298
|
for (const row of rows) {
|
|
@@ -314,7 +314,7 @@ export function registerTools(server, dbPath) {
|
|
|
314
314
|
content: [
|
|
315
315
|
{
|
|
316
316
|
type: "text",
|
|
317
|
-
text: JSON.stringify({
|
|
317
|
+
text: JSON.stringify({ graph_id, totalTags: Object.keys(tagCounts).length, tags: sortedTags }, null, 2),
|
|
318
318
|
},
|
|
319
319
|
],
|
|
320
320
|
};
|
|
@@ -337,11 +337,11 @@ export function registerTools(server, dbPath) {
|
|
|
337
337
|
description: "Get notes that have a specific tag from Reflect.",
|
|
338
338
|
parameters: z.object({
|
|
339
339
|
tag: z.string().describe("The tag to search for"),
|
|
340
|
-
|
|
340
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
341
341
|
limit: z.number().default(20).describe("Maximum number of notes to return"),
|
|
342
342
|
}),
|
|
343
343
|
execute: async (args) => {
|
|
344
|
-
const { tag,
|
|
344
|
+
const { tag, graph_id, limit } = args;
|
|
345
345
|
try {
|
|
346
346
|
const dbFile = resolvedDbPath;
|
|
347
347
|
const db = new Database(dbFile, { readonly: true });
|
|
@@ -352,7 +352,7 @@ export function registerTools(server, dbPath) {
|
|
|
352
352
|
ORDER BY editedAt DESC
|
|
353
353
|
LIMIT ?
|
|
354
354
|
`);
|
|
355
|
-
const results = stmt.all(
|
|
355
|
+
const results = stmt.all(graph_id, `%"${tag}"%`, limit);
|
|
356
356
|
db.close();
|
|
357
357
|
const notes = results.map((row) => ({
|
|
358
358
|
id: row.id,
|
|
@@ -366,7 +366,7 @@ export function registerTools(server, dbPath) {
|
|
|
366
366
|
content: [
|
|
367
367
|
{
|
|
368
368
|
type: "text",
|
|
369
|
-
text: JSON.stringify({ tag,
|
|
369
|
+
text: JSON.stringify({ tag, graph_id, count: notes.length, notes }, null, 2),
|
|
370
370
|
},
|
|
371
371
|
],
|
|
372
372
|
};
|
|
@@ -389,10 +389,10 @@ export function registerTools(server, dbPath) {
|
|
|
389
389
|
description: "Get a note by its title (subject) from Reflect.",
|
|
390
390
|
parameters: z.object({
|
|
391
391
|
title: z.string().describe("The title/subject of the note to retrieve"),
|
|
392
|
-
|
|
392
|
+
graph_id: z.string().default("rapheal-brain").describe("The graph ID to search in"),
|
|
393
393
|
}),
|
|
394
394
|
execute: async (args) => {
|
|
395
|
-
const { title,
|
|
395
|
+
const { title, graph_id } = args;
|
|
396
396
|
const FUZZY_LIMIT = 3;
|
|
397
397
|
try {
|
|
398
398
|
const dbFile = resolvedDbPath;
|
|
@@ -403,7 +403,7 @@ export function registerTools(server, dbPath) {
|
|
|
403
403
|
FROM notes
|
|
404
404
|
WHERE isDeleted = 0 AND graphId = ? AND subject = ?
|
|
405
405
|
`);
|
|
406
|
-
const exactResult = exactStmt.get(
|
|
406
|
+
const exactResult = exactStmt.get(graph_id, title);
|
|
407
407
|
if (exactResult) {
|
|
408
408
|
db.close();
|
|
409
409
|
const note = {
|
|
@@ -418,7 +418,7 @@ export function registerTools(server, dbPath) {
|
|
|
418
418
|
content: [
|
|
419
419
|
{
|
|
420
420
|
type: "text",
|
|
421
|
-
text: JSON.stringify({ title,
|
|
421
|
+
text: JSON.stringify({ title, graph_id, note }, null, 2),
|
|
422
422
|
},
|
|
423
423
|
],
|
|
424
424
|
};
|
|
@@ -441,7 +441,7 @@ export function registerTools(server, dbPath) {
|
|
|
441
441
|
`);
|
|
442
442
|
const fuzzyResults = fuzzyStmt.all(`${searchTerm}%`, // starts with (score 2)
|
|
443
443
|
`%${searchTerm}%`, // contains (score 1)
|
|
444
|
-
|
|
444
|
+
graph_id, `${searchTerm}%`, // WHERE starts with
|
|
445
445
|
`%${searchTerm}%`, // WHERE contains
|
|
446
446
|
FUZZY_LIMIT);
|
|
447
447
|
db.close();
|
|
@@ -453,7 +453,7 @@ export function registerTools(server, dbPath) {
|
|
|
453
453
|
text: JSON.stringify({
|
|
454
454
|
error: `No notes found matching '${title}'`,
|
|
455
455
|
query: title,
|
|
456
|
-
|
|
456
|
+
graph_id
|
|
457
457
|
}),
|
|
458
458
|
},
|
|
459
459
|
],
|
|
@@ -475,7 +475,7 @@ export function registerTools(server, dbPath) {
|
|
|
475
475
|
type: "text",
|
|
476
476
|
text: JSON.stringify({
|
|
477
477
|
query: title,
|
|
478
|
-
|
|
478
|
+
graph_id,
|
|
479
479
|
note: notes[0],
|
|
480
480
|
matchType: "fuzzy"
|
|
481
481
|
}, null, 2),
|
|
@@ -489,7 +489,7 @@ export function registerTools(server, dbPath) {
|
|
|
489
489
|
type: "text",
|
|
490
490
|
text: JSON.stringify({
|
|
491
491
|
query: title,
|
|
492
|
-
|
|
492
|
+
graph_id,
|
|
493
493
|
matchCount: notes.length,
|
|
494
494
|
notes
|
|
495
495
|
}, null, 2),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reflect-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "MCP server for Reflect Notes - connect your notes to Claude Desktop. Just run: npx reflect-mcp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/server.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
40
40
|
"better-sqlite3": "^11.10.0",
|
|
41
41
|
"fastmcp": "^3.25.4",
|
|
42
|
+
"reflect-mcp": "^1.0.3",
|
|
42
43
|
"zod": "^4.1.13"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|