@abraca/mcp 1.0.1 → 1.0.5
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 +38 -13
- package/dist/abracadabra-mcp.cjs.map +1 -1
- package/dist/abracadabra-mcp.esm.js +38 -13
- package/dist/abracadabra-mcp.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/server.ts +2 -2
- package/src/tools/tree.ts +31 -11
package/dist/abracadabra-mcp.cjs
CHANGED
|
@@ -18496,8 +18496,9 @@ var AbracadabraMCPServer = class {
|
|
|
18496
18496
|
});
|
|
18497
18497
|
console.error(`[abracadabra-mcp] Logged in as ${this.config.username}`);
|
|
18498
18498
|
try {
|
|
18499
|
-
|
|
18500
|
-
|
|
18499
|
+
const me = await this.client.getMe();
|
|
18500
|
+
this._userId = me.publicKey ?? me.id;
|
|
18501
|
+
console.error(`[abracadabra-mcp] User ID (pubkey): ${this._userId}`);
|
|
18501
18502
|
} catch {
|
|
18502
18503
|
console.error("[abracadabra-mcp] Could not fetch user profile, proceeding without userId");
|
|
18503
18504
|
}
|
|
@@ -18782,7 +18783,10 @@ function childrenOf$1(entries, parentId) {
|
|
|
18782
18783
|
}
|
|
18783
18784
|
function descendantsOf(entries, id) {
|
|
18784
18785
|
const result = [];
|
|
18786
|
+
const visited = /* @__PURE__ */ new Set();
|
|
18785
18787
|
function collect(pid) {
|
|
18788
|
+
if (visited.has(pid)) return;
|
|
18789
|
+
visited.add(pid);
|
|
18786
18790
|
for (const child of childrenOf$1(entries, pid)) {
|
|
18787
18791
|
result.push(child);
|
|
18788
18792
|
collect(child.id);
|
|
@@ -18791,18 +18795,39 @@ function descendantsOf(entries, id) {
|
|
|
18791
18795
|
collect(id);
|
|
18792
18796
|
return result;
|
|
18793
18797
|
}
|
|
18794
|
-
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0) {
|
|
18798
|
+
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0, visited = /* @__PURE__ */ new Set()) {
|
|
18795
18799
|
if (maxDepth >= 0 && currentDepth >= maxDepth) return [];
|
|
18796
|
-
return childrenOf$1(entries, rootId).map((entry) =>
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18800
|
+
return childrenOf$1(entries, rootId).filter((e) => !visited.has(e.id)).map((entry) => {
|
|
18801
|
+
const next = new Set(visited);
|
|
18802
|
+
next.add(entry.id);
|
|
18803
|
+
return {
|
|
18804
|
+
id: entry.id,
|
|
18805
|
+
label: entry.label,
|
|
18806
|
+
type: entry.type,
|
|
18807
|
+
meta: entry.meta,
|
|
18808
|
+
order: entry.order,
|
|
18809
|
+
children: buildTree$1(entries, entry.id, maxDepth, currentDepth + 1, next)
|
|
18810
|
+
};
|
|
18811
|
+
});
|
|
18804
18812
|
}
|
|
18805
18813
|
function registerTreeTools(mcp, server) {
|
|
18814
|
+
mcp.tool("_debug_list_all", "List ALL tree entries with their raw parentId. For debugging circular references.", {}, async () => {
|
|
18815
|
+
const treeMap = server.getTreeMap();
|
|
18816
|
+
if (!treeMap) return { content: [{
|
|
18817
|
+
type: "text",
|
|
18818
|
+
text: "Not connected"
|
|
18819
|
+
}] };
|
|
18820
|
+
const entries = readEntries$1(treeMap);
|
|
18821
|
+
return { content: [{
|
|
18822
|
+
type: "text",
|
|
18823
|
+
text: JSON.stringify(entries.map((e) => ({
|
|
18824
|
+
id: e.id,
|
|
18825
|
+
label: e.label,
|
|
18826
|
+
parentId: e.parentId,
|
|
18827
|
+
type: e.type
|
|
18828
|
+
})), null, 2)
|
|
18829
|
+
}] };
|
|
18830
|
+
});
|
|
18806
18831
|
mcp.tool("list_documents", "List direct children of a document (defaults to root). Returns id, label, type, meta, order.", { parentId: zod.z.string().optional().describe("Parent document ID. Omit for root-level documents.") }, async ({ parentId }) => {
|
|
18807
18832
|
const treeMap = server.getTreeMap();
|
|
18808
18833
|
if (!treeMap) return { content: [{
|
|
@@ -18836,7 +18861,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18836
18861
|
mcp.tool("create_document", "Create a new document in the tree. Returns the new document ID.", {
|
|
18837
18862
|
parentId: zod.z.string().optional().describe("Parent document ID. Omit for top-level pages. Use a document ID for nested/child pages."),
|
|
18838
18863
|
label: zod.z.string().describe("Display name / title for the document."),
|
|
18839
|
-
type: zod.z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18864
|
+
type: zod.z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\". Omit to inherit parent view."),
|
|
18840
18865
|
meta: zod.z.record(zod.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.")
|
|
18841
18866
|
}, async ({ parentId, label, type, meta }) => {
|
|
18842
18867
|
const treeMap = server.getTreeMap();
|
|
@@ -18950,7 +18975,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18950
18975
|
});
|
|
18951
18976
|
mcp.tool("change_document_type", "Change the page type view of a document (data is preserved).", {
|
|
18952
18977
|
id: zod.z.string().describe("Document ID."),
|
|
18953
|
-
type: zod.z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18978
|
+
type: zod.z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\").")
|
|
18954
18979
|
}, async ({ id, type }) => {
|
|
18955
18980
|
const treeMap = server.getTreeMap();
|
|
18956
18981
|
if (!treeMap) return { content: [{
|