mcp-memory-bucket 0.10.13 → 0.10.14

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.
@@ -73,7 +73,7 @@ export function registerBucketFolderTools(mcp, config, skillRepo, memoryRepo, db
73
73
  mcp.tool('bucket_connect_remote_folder', "Connects one of the user's own folderfoo folders (see bucket_list_remote_folders for `folderPath` values) as a new skill or memory source — syncs like a folder added via bucket_create_folder, so skill_create/memory_create can target it via `folder` and edits push back to folderfoo automatically. Idempotent: if this exact folderPath is already connected under this kind, returns that existing folder instead of creating a duplicate. Same login requirement as bucket_list_remote_folders.", {
74
74
  kind: KIND,
75
75
  folderPath: z.string().describe("a `path` value from bucket_list_remote_folders ('' for the folderfoo root)"),
76
- name: z.string().optional().describe("name for the folder; defaults to a sanitized version of folderPath's last segment"),
76
+ name: z.string().optional().describe("name for the folder; defaults to a sanitized version of folderPath's last segment. Auto-suffixed with the connecting username if it collides with a folder connected under a different folderfoo login."),
77
77
  }, async ({ kind, folderPath, name }) => {
78
78
  if (config.folderfooMode === 'off' || !config.folderfooHost) {
79
79
  return {
@@ -99,13 +99,19 @@ export function registerBucketFolderTools(mcp, config, skillRepo, memoryRepo, db
99
99
  if (!folderName) {
100
100
  return { content: [{ type: 'text', text: 'could not derive a valid folder name — provide one explicitly' }], isError: true };
101
101
  }
102
- const mirrorDir = mirrorDirFor(config.baseDir, current.mode, current.username, folderName);
103
- const remote = { name: folderName, server, tenantId: TENANT_ID, folderPath, mirrorDir, mode: current.mode, username: current.username };
104
102
  try {
103
+ // Resolved FIRST (before deriving mirrorDir) — auto-suffixes the requested name when it
104
+ // collides with a folder connected under a DIFFERENT folderfoo login (e.g. two different users
105
+ // each naturally wanting "bbbmemz"), still rejecting a collision against the CALLER's own
106
+ // identity. Mirrors the web route's POST /api/remote-folders logic (routes.ts) — see
107
+ // repo.resolveAvailableName's doc comment.
108
+ const resolvedName = repo.resolveAvailableName(folderName, current.username);
109
+ const mirrorDir = mirrorDirFor(config.baseDir, current.mode, current.username, resolvedName);
110
+ const remote = { name: resolvedName, server, tenantId: TENANT_ID, folderPath, mirrorDir, mode: current.mode, username: current.username };
105
111
  repo.registerRemoteFolder(remote);
106
- saveRemoteFolder(config, kind, { name: folderName, server, tenantId: TENANT_ID, folderPath, mode: current.mode, username: current.username });
112
+ saveRemoteFolder(config, kind, { name: resolvedName, server, tenantId: TENANT_ID, folderPath, mode: current.mode, username: current.username });
107
113
  await pollOne(db, specFor(kind), remote, config.baseDir);
108
- return { content: [{ type: 'text', text: JSON.stringify({ name: folderName, server, tenantId: TENANT_ID, folderPath, kind }, null, 2) }] };
114
+ return { content: [{ type: 'text', text: JSON.stringify({ name: resolvedName, server, tenantId: TENANT_ID, folderPath, kind }, null, 2) }] };
109
115
  }
110
116
  catch (err) {
111
117
  return { content: [{ type: 'text', text: err.message }], isError: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-memory-bucket",
3
- "version": "0.10.13",
3
+ "version": "0.10.14",
4
4
  "type": "module",
5
5
  "description": "MCP server exposing skill_* (reusable coding patterns) and memory_* (point-in-time working context) tools over a markdown+frontmatter source, cached into SQLite at runtime.",
6
6
  "repository": {