A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix(mcp): Fix spacing around the bookmarks
Mohamed Bassem1568fe903d46
diff --git a/apps/mcp/package.json b/apps/mcp/package.jsonindex dfa38ed7..0229ea1d 100644--- a/apps/mcp/package.json+++ b/apps/mcp/package.json@@ -1,7 +1,7 @@{"$schema": "https://json.schemastore.org/package.json","name": "@karakeep/mcp",- "version": "0.23.8",+ "version": "0.23.9","description": "MCP server for Karakeep","license": "GNU Affero General Public License version 3","type": "module",diff --git a/apps/mcp/src/bookmarks.ts b/apps/mcp/src/bookmarks.tsindex 747bcd18..3b580e86 100644--- a/apps/mcp/src/bookmarks.ts+++ b/apps/mcp/src/bookmarks.ts@@ -16,7 +16,7 @@ You can search bookmarks using specific qualifiers. is:fav finds favorited bookmis:archived searches archived bookmarks, is:tagged finds those with tags,is:inlist finds those in lists, and is:link, is:text, and is:media filter by bookmark type.url:<value> searches for URL substrings, #<tag> searches for bookmarks with a specific tag,-list:<name> searches for bookmarks in a specific list given its name,+list:<name> searches for bookmarks in a specific list given its name (without the icon),after:<date> finds bookmarks created on or after a date (YYYY-MM-DD), and before:<date> finds bookmarks created on or before a date (YYYY-MM-DD).If you need to pass names with spaces, you can quote them with double quotes. If you want to negate a qualifier, prefix it with a minus sign.## Examples:diff --git a/apps/mcp/src/lists.ts b/apps/mcp/src/lists.tsindex 242229cb..4180b3ee 100644--- a/apps/mcp/src/lists.ts+++ b/apps/mcp/src/lists.ts@@ -18,9 +18,9 @@ mcpServer.tool(type: "text",text: res.data.lists.map(- (list) => `-List ID: ${list.id}-Name: ${list.icon} ${list.name}+ (list) => `List ID: ${list.id}+Name: ${list.name}+Icon: ${list.icon}Description: ${list.description ?? ""}Parent ID: ${list.parentId}`,)diff --git a/apps/mcp/src/utils.ts b/apps/mcp/src/utils.tsindex 6d7d8ad5..f34383ea 100644--- a/apps/mcp/src/utils.ts+++ b/apps/mcp/src/utils.ts@@ -21,33 +21,25 @@ export function compactBookmark(): string {let content: string;if (bookmark.content.type === "link") {- content = `-Bookmark type: link-urk: ${bookmark.content.url}+ content = `Bookmark type: link+Bookmarked URL: ${bookmark.content.url}description: ${bookmark.content.description ?? ""}author: ${bookmark.content.author ?? ""}publisher: ${bookmark.content.publisher ?? ""}`;} else if (bookmark.content.type === "text") {- content = `- Bookmark type: text- Source URL: ${bookmark.content.sourceUrl ?? ""}-`;+ content = `Bookmark type: text+ Source URL: ${bookmark.content.sourceUrl ?? ""}`;} else if (bookmark.content.type === "asset") {- content = `-Bookmark type: media+ content = `Bookmark type: mediaAsset ID: ${bookmark.content.assetId}Asset type: ${bookmark.content.assetType}-Source URL: ${bookmark.content.sourceUrl ?? ""}-`;+Source URL: ${bookmark.content.sourceUrl ?? ""}`;} else {- content = `-Bookmark type: unknown-`;+ content = `Bookmark type: unknown`;}- return `- Bookmark ID: ${bookmark.id}+ return `Bookmark ID: ${bookmark.id}Created at: ${bookmark.createdAt}Title: ${bookmark.title@@ -57,6 +49,5 @@ Bookmark type: unknownSummary: ${bookmark.summary ?? ""}Note: ${bookmark.note ?? ""}${content}- Tags: ${bookmark.tags.map((t) => t.name).join(", ")}- `;+ Tags: ${bookmark.tags.map((t) => t.name).join(", ")}`;}