@abraca/mcp 1.0.25 → 1.1.1
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/abracadabra-mcp.cjs +45 -14
- package/dist/abracadabra-mcp.cjs.map +1 -1
- package/dist/abracadabra-mcp.esm.js +45 -14
- package/dist/abracadabra-mcp.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/converters/types.ts +54 -0
- package/src/hook-bridge.ts +6 -2
- package/src/server.ts +48 -12
- package/src/tools/meta.ts +1 -1
- package/src/tools/tree.ts +2 -2
|
@@ -19503,17 +19503,30 @@ var AbracadabraMCPServer = class {
|
|
|
19503
19503
|
this._serverInfo = await this.client.serverInfo();
|
|
19504
19504
|
let initialDocId = this._serverInfo.index_doc_id ?? null;
|
|
19505
19505
|
try {
|
|
19506
|
-
|
|
19507
|
-
|
|
19506
|
+
const roots = await this.client.listRootDocuments();
|
|
19507
|
+
this._spaces = roots.map(docToSpaceMeta);
|
|
19508
|
+
const hub = roots.find((d) => d.is_hub);
|
|
19508
19509
|
if (hub) {
|
|
19509
|
-
initialDocId = hub.
|
|
19510
|
-
console.error(`[abracadabra-mcp]
|
|
19511
|
-
} else if (
|
|
19512
|
-
initialDocId =
|
|
19513
|
-
console.error(`[abracadabra-mcp]
|
|
19510
|
+
initialDocId = hub.id;
|
|
19511
|
+
console.error(`[abracadabra-mcp] Root documents discovered. Hub: ${hub.label ?? hub.id} (${hub.id})`);
|
|
19512
|
+
} else if (roots.length > 0) {
|
|
19513
|
+
initialDocId = roots[0].id;
|
|
19514
|
+
console.error(`[abracadabra-mcp] No hub, using first root doc: ${roots[0].label ?? roots[0].id} (${roots[0].id})`);
|
|
19514
19515
|
}
|
|
19515
19516
|
} catch {
|
|
19516
|
-
|
|
19517
|
+
try {
|
|
19518
|
+
this._spaces = await this.client.listSpaces();
|
|
19519
|
+
const hub = this._spaces.find((s) => s.is_hub);
|
|
19520
|
+
if (hub) {
|
|
19521
|
+
initialDocId = hub.doc_id;
|
|
19522
|
+
console.error(`[abracadabra-mcp] Spaces extension active. Hub space: ${hub.name} (${hub.doc_id})`);
|
|
19523
|
+
} else if (this._spaces.length > 0) {
|
|
19524
|
+
initialDocId = this._spaces[0].doc_id;
|
|
19525
|
+
console.error(`[abracadabra-mcp] Spaces active but no hub, using first space: ${this._spaces[0].name} (${this._spaces[0].doc_id})`);
|
|
19526
|
+
}
|
|
19527
|
+
} catch {
|
|
19528
|
+
console.error("[abracadabra-mcp] Neither /docs?root=true nor /spaces available, using index_doc_id");
|
|
19529
|
+
}
|
|
19517
19530
|
}
|
|
19518
19531
|
if (!initialDocId) throw new Error("No entry point found: server has neither spaces nor index_doc_id configured.");
|
|
19519
19532
|
this._rootDocId = initialDocId;
|
|
@@ -19785,7 +19798,7 @@ var AbracadabraMCPServer = class {
|
|
|
19785
19798
|
provider.awareness.setLocalStateField("activeToolCall", null);
|
|
19786
19799
|
provider.awareness.setLocalStateField("statusContext", null);
|
|
19787
19800
|
this._stopTypingInterval();
|
|
19788
|
-
},
|
|
19801
|
+
}, 3e4);
|
|
19789
19802
|
}
|
|
19790
19803
|
/** Re-send typing indicator every 2s so dashboard keeps showing it (expires at 3s). */
|
|
19791
19804
|
_startTypingInterval(channel) {
|
|
@@ -19844,6 +19857,24 @@ var AbracadabraMCPServer = class {
|
|
|
19844
19857
|
console.error("[abracadabra-mcp] Shutdown complete");
|
|
19845
19858
|
}
|
|
19846
19859
|
};
|
|
19860
|
+
/** Map a DocumentMeta (from /docs?root=true) to the SpaceMeta shape for compat. */
|
|
19861
|
+
function docToSpaceMeta(doc) {
|
|
19862
|
+
const publicAccess = doc.public_access;
|
|
19863
|
+
let visibility = "private";
|
|
19864
|
+
if (publicAccess && publicAccess !== "none") visibility = "public";
|
|
19865
|
+
return {
|
|
19866
|
+
id: doc.id,
|
|
19867
|
+
doc_id: doc.id,
|
|
19868
|
+
name: doc.label ?? doc.id,
|
|
19869
|
+
description: doc.description ?? null,
|
|
19870
|
+
visibility,
|
|
19871
|
+
is_hub: doc.is_hub ?? false,
|
|
19872
|
+
owner_id: doc.owner_id ?? null,
|
|
19873
|
+
created_at: 0,
|
|
19874
|
+
updated_at: doc.updated_at ?? 0,
|
|
19875
|
+
public_access: publicAccess ?? null
|
|
19876
|
+
};
|
|
19877
|
+
}
|
|
19847
19878
|
|
|
19848
19879
|
//#endregion
|
|
19849
19880
|
//#region packages/mcp/src/tools/tree.ts
|
|
@@ -20001,7 +20032,7 @@ function registerTreeTools(mcp, server) {
|
|
|
20001
20032
|
mcp.tool("create_document", "Create a new document in the tree. Returns the new document ID.", {
|
|
20002
20033
|
parentId: z.string().optional().describe("Parent document ID. Omit for top-level pages. Use a document ID for nested/child pages."),
|
|
20003
20034
|
label: z.string().describe("Display name / title for the document."),
|
|
20004
|
-
type: z.string().optional().describe("Page type — sets how this document renders. \"doc\" (rich text), \"kanban\" (columns → cards), \"table\" (columns →
|
|
20035
|
+
type: z.string().optional().describe("Page type — sets how this document renders. \"doc\" (rich text), \"kanban\" (columns → cards), \"table\" (columns → rows with custom fields), \"calendar\" (events with datetimeStart/End), \"timeline\" (epics → tasks with dateStart/End + taskProgress), \"checklist\" (tasks with checked/priority, unlimited nesting), \"outline\" (nested items, unlimited depth), \"gallery\" (visual grid with covers/ratings), \"map\" (markers/lines with geoLat/geoLng), \"graph\" (force-directed knowledge graph), \"dashboard\" (positioned widgets with deskX/deskY/deskMode), \"spatial\" (3D scene with spShape/spX/spY/spZ), \"media\" (audio/video player with playlists), \"slides\" (presentation with transitions), \"chart\" (bar/line/donut/treemap from data points or aggregation), \"sheets\" (spreadsheet with formulas and formatting), \"overview\" (space home — activity and stats), \"call\" (video call room, no children). Omit to inherit parent view. Only set on the parent page, NEVER on child items."),
|
|
20005
20036
|
meta: z.record(z.unknown()).optional().describe("Initial metadata (PageMeta fields: color as hex string, icon as Lucide kebab-case name like \"star\"/\"code-2\"/\"users\" — never emoji, dateStart, dateEnd, priority 0-4, tags array, etc). Omit icon entirely to use page type default.")
|
|
20006
20037
|
}, async ({ parentId, label, type, meta }) => {
|
|
20007
20038
|
server.setAutoStatus("creating");
|
|
@@ -20159,7 +20190,7 @@ function registerTreeTools(mcp, server) {
|
|
|
20159
20190
|
});
|
|
20160
20191
|
mcp.tool("change_document_type", "Change the page type view of a document (data is preserved).", {
|
|
20161
20192
|
id: z.string().describe("Document ID."),
|
|
20162
|
-
type: z.string().describe("New page type
|
|
20193
|
+
type: z.string().describe("New page type: \"doc\", \"kanban\", \"table\", \"calendar\", \"timeline\", \"checklist\", \"outline\", \"gallery\", \"map\", \"graph\", \"dashboard\", \"spatial\", \"media\", \"slides\", \"chart\", \"sheets\", \"overview\", \"call\".")
|
|
20163
20194
|
}, async ({ id, type }) => {
|
|
20164
20195
|
server.setAutoStatus("writing");
|
|
20165
20196
|
server.setActiveToolCall({
|
|
@@ -21537,7 +21568,7 @@ function registerMetaTools(mcp, server) {
|
|
|
21537
21568
|
});
|
|
21538
21569
|
mcp.tool("update_metadata", "Update metadata fields on a document. Merges the provided fields into existing metadata.", {
|
|
21539
21570
|
docId: z.string().describe("Document ID."),
|
|
21540
|
-
meta: z.record(z.unknown()).describe("Metadata fields to update (merged with existing). Universal keys: color (hex), icon (Lucide kebab-case — NEVER emoji), dateStart/dateEnd, datetimeStart/datetimeEnd, allDay, tags (string[]), checked (bool), priority (0=none,1=low,2=med,3=high,4=urgent), status, rating (0-5), url, email, phone, number, unit, subtitle, note, taskProgress (0-100), members ({id,label}[]), coverUploadId. Geo/Map: geoType (\"marker\"|\"line\"|\"measure\"), geoLat, geoLng, geoDescription. Spatial 3D: spShape (\"box\"|\"sphere\"|\"cylinder\"|\"cone\"|\"plane\"|\"torus\"|\"glb\"), spX/spY/spZ, spRX/spRY/spRZ, spSX/spSY/spSZ, spColor, spOpacity (0-100). Dashboard: deskX, deskY, deskZ, deskMode (\"icon\"|\"widget-sm\"|\"widget-lg\"). Renderer config (on the page doc itself): kanbanColumnWidth, galleryColumns, galleryAspect, calendarView, calendarWeekStart, tableMode, showRefEdges. Set a key to null to clear it.")
|
|
21571
|
+
meta: z.record(z.unknown()).describe("Metadata fields to update (merged with existing). Universal keys: color (hex), icon (Lucide kebab-case — NEVER emoji), dateStart/dateEnd, datetimeStart/datetimeEnd, allDay, tags (string[]), checked (bool), priority (0=none,1=low,2=med,3=high,4=urgent), status, rating (0-5), url, email, phone, number, unit, subtitle, note, taskProgress (0-100), members ({id,label}[]), coverUploadId. Geo/Map: geoType (\"marker\"|\"line\"|\"measure\"), geoLat, geoLng, geoDescription. Spatial 3D: spShape (\"box\"|\"sphere\"|\"cylinder\"|\"cone\"|\"plane\"|\"torus\"|\"glb\"), spX/spY/spZ, spRX/spRY/spRZ, spSX/spSY/spSZ, spColor, spOpacity (0-100). Dashboard: deskX, deskY, deskZ, deskMode (\"icon\"|\"widget-sm\"|\"widget-lg\"). Slides: slidesTransition (\"none\"|\"fade\"|\"slide\"), slidesTheme (\"dark\"|\"light\"). Chart: chartType (\"bar\"|\"stacked bar\"|\"line\"|\"donut\"|\"treemap\"), chartMetric, chartColorScheme, chartLimit, chartShowLegend, chartShowValues. Sheets: sheetsDefaultColWidth, sheetsDefaultRowHeight, sheetsShowGridlines, sheetsFreezeRows, sheetsFreezeCols. Cell formatting: bold, italic, textColor, bgColor, align, formula. Renderer config (on the page doc itself): kanbanColumnWidth, galleryColumns, galleryAspect, galleryCardStyle, galleryShowLabels, gallerySortBy, calendarView, calendarWeekStart, calendarShowWeekNumbers, tableMode, tableSortDir, checklistFilter, checklistSort, mapShowLabels, spatialGridVisible, showRefEdges, mediaRepeat, mediaShuffle. Set a key to null to clear it.")
|
|
21541
21572
|
}, async ({ docId, meta }) => {
|
|
21542
21573
|
server.setAutoStatus("writing", docId);
|
|
21543
21574
|
server.setActiveToolCall({
|
|
@@ -22759,7 +22790,7 @@ var HookBridge = class {
|
|
|
22759
22790
|
}
|
|
22760
22791
|
onPostToolUse(payload) {
|
|
22761
22792
|
if ((payload.tool_name ?? "").startsWith("mcp__abracadabra__")) return;
|
|
22762
|
-
this.server.
|
|
22793
|
+
this.server.setAutoStatus("thinking");
|
|
22763
22794
|
}
|
|
22764
22795
|
onSubagentStart(payload) {
|
|
22765
22796
|
const agentType = payload.agent_type ?? "agent";
|
|
@@ -22770,7 +22801,7 @@ var HookBridge = class {
|
|
|
22770
22801
|
this.server.setAutoStatus("thinking");
|
|
22771
22802
|
}
|
|
22772
22803
|
onSubagentStop(_payload) {
|
|
22773
|
-
this.server.
|
|
22804
|
+
this.server.setAutoStatus("thinking");
|
|
22774
22805
|
}
|
|
22775
22806
|
onStop() {
|
|
22776
22807
|
this.server.setAutoStatus(null);
|