@abraca/mcp 2.47.0 → 2.49.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/dist/index.d.ts CHANGED
@@ -69,6 +69,14 @@ declare class AbracadabraMCPServer {
69
69
  * `kind === "space"`. Populated by {@link connect}.
70
70
  */
71
71
  get spaces(): DocumentMeta[];
72
+ /**
73
+ * Re-fetch the server's top-level `kind="space"` docs and refresh the
74
+ * cached `_spaces` snapshot. {@link connect} only takes the snapshot once,
75
+ * so a space created/seeded after connect (or removed) would otherwise stay
76
+ * invisible to `list_spaces` until a full reconnect. Tools that surface the
77
+ * space list should call this first so they reflect server truth.
78
+ */
79
+ refreshSpaces(): Promise<DocumentMeta[]>;
72
80
  get rootDocument(): Y.Doc | null;
73
81
  get rootYProvider(): AbracadabraProvider | null;
74
82
  get userId(): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/mcp",
3
- "version": "2.47.0",
3
+ "version": "2.49.0",
4
4
  "description": "MCP server for Abracadabra — AI agent collaboration on CRDT documents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "y-protocols": "^1.0.6",
36
36
  "yjs": "^13.6.8",
37
37
  "zod": "^4.3.6",
38
- "@abraca/convert": "2.47.0"
38
+ "@abraca/convert": "2.49.0"
39
39
  },
40
40
  "scripts": {
41
41
  "test": "node --no-warnings --conditions=source --experimental-transform-types --test 'tests/*.test.ts'"
@@ -43,6 +43,7 @@ const DISCONNECTED: Record<string, unknown> = {
43
43
  // ── data accessors (called as functions) ──
44
44
  getTreeMap: () => null,
45
45
  getTrashMap: () => null,
46
+ refreshSpaces: async () => [],
46
47
  getDocSummary: () => null,
47
48
  getEnabledPluginNames: () => [],
48
49
 
package/src/server.ts CHANGED
@@ -163,6 +163,25 @@ export class AbracadabraMCPServer {
163
163
  return this._spaces;
164
164
  }
165
165
 
166
+ /**
167
+ * Re-fetch the server's top-level `kind="space"` docs and refresh the
168
+ * cached `_spaces` snapshot. {@link connect} only takes the snapshot once,
169
+ * so a space created/seeded after connect (or removed) would otherwise stay
170
+ * invisible to `list_spaces` until a full reconnect. Tools that surface the
171
+ * space list should call this first so they reflect server truth.
172
+ */
173
+ async refreshSpaces(): Promise<DocumentMeta[]> {
174
+ if (!this.client) return this._spaces;
175
+ try {
176
+ const { spaces } = pickEntrySpace(await this.client.listChildren());
177
+ this._spaces = spaces;
178
+ } catch {
179
+ // Network/transient failure — keep the last-known snapshot rather
180
+ // than blanking the list.
181
+ }
182
+ return this._spaces;
183
+ }
184
+
166
185
  get rootDocument(): Y.Doc | null {
167
186
  return this._activeConnection?.doc ?? null;
168
187
  }
package/src/tools/tree.ts CHANGED
@@ -592,7 +592,10 @@ export function registerTreeTools(
592
592
  {},
593
593
  async () => {
594
594
  server.setActiveToolCall({ name: 'list_spaces' })
595
- const spaces = server.spaces
595
+ // Refresh from the server first — `_spaces` is otherwise a connect-time
596
+ // snapshot, so a space seeded/created (or removed) after connect would
597
+ // stay stale until a full reconnect (the "space disappeared" bug).
598
+ const spaces = await server.refreshSpaces()
596
599
  if (!spaces.length) {
597
600
  return { content: [{ type: 'text', text: 'No spaces available — create one to get started.' }] }
598
601
  }