@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
|
@@ -18491,8 +18491,9 @@ var AbracadabraMCPServer = class {
|
|
|
18491
18491
|
});
|
|
18492
18492
|
console.error(`[abracadabra-mcp] Logged in as ${this.config.username}`);
|
|
18493
18493
|
try {
|
|
18494
|
-
|
|
18495
|
-
|
|
18494
|
+
const me = await this.client.getMe();
|
|
18495
|
+
this._userId = me.publicKey ?? me.id;
|
|
18496
|
+
console.error(`[abracadabra-mcp] User ID (pubkey): ${this._userId}`);
|
|
18496
18497
|
} catch {
|
|
18497
18498
|
console.error("[abracadabra-mcp] Could not fetch user profile, proceeding without userId");
|
|
18498
18499
|
}
|
|
@@ -18777,7 +18778,10 @@ function childrenOf$1(entries, parentId) {
|
|
|
18777
18778
|
}
|
|
18778
18779
|
function descendantsOf(entries, id) {
|
|
18779
18780
|
const result = [];
|
|
18781
|
+
const visited = /* @__PURE__ */ new Set();
|
|
18780
18782
|
function collect(pid) {
|
|
18783
|
+
if (visited.has(pid)) return;
|
|
18784
|
+
visited.add(pid);
|
|
18781
18785
|
for (const child of childrenOf$1(entries, pid)) {
|
|
18782
18786
|
result.push(child);
|
|
18783
18787
|
collect(child.id);
|
|
@@ -18786,18 +18790,39 @@ function descendantsOf(entries, id) {
|
|
|
18786
18790
|
collect(id);
|
|
18787
18791
|
return result;
|
|
18788
18792
|
}
|
|
18789
|
-
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0) {
|
|
18793
|
+
function buildTree$1(entries, rootId, maxDepth, currentDepth = 0, visited = /* @__PURE__ */ new Set()) {
|
|
18790
18794
|
if (maxDepth >= 0 && currentDepth >= maxDepth) return [];
|
|
18791
|
-
return childrenOf$1(entries, rootId).map((entry) =>
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18795
|
+
return childrenOf$1(entries, rootId).filter((e) => !visited.has(e.id)).map((entry) => {
|
|
18796
|
+
const next = new Set(visited);
|
|
18797
|
+
next.add(entry.id);
|
|
18798
|
+
return {
|
|
18799
|
+
id: entry.id,
|
|
18800
|
+
label: entry.label,
|
|
18801
|
+
type: entry.type,
|
|
18802
|
+
meta: entry.meta,
|
|
18803
|
+
order: entry.order,
|
|
18804
|
+
children: buildTree$1(entries, entry.id, maxDepth, currentDepth + 1, next)
|
|
18805
|
+
};
|
|
18806
|
+
});
|
|
18799
18807
|
}
|
|
18800
18808
|
function registerTreeTools(mcp, server) {
|
|
18809
|
+
mcp.tool("_debug_list_all", "List ALL tree entries with their raw parentId. For debugging circular references.", {}, async () => {
|
|
18810
|
+
const treeMap = server.getTreeMap();
|
|
18811
|
+
if (!treeMap) return { content: [{
|
|
18812
|
+
type: "text",
|
|
18813
|
+
text: "Not connected"
|
|
18814
|
+
}] };
|
|
18815
|
+
const entries = readEntries$1(treeMap);
|
|
18816
|
+
return { content: [{
|
|
18817
|
+
type: "text",
|
|
18818
|
+
text: JSON.stringify(entries.map((e) => ({
|
|
18819
|
+
id: e.id,
|
|
18820
|
+
label: e.label,
|
|
18821
|
+
parentId: e.parentId,
|
|
18822
|
+
type: e.type
|
|
18823
|
+
})), null, 2)
|
|
18824
|
+
}] };
|
|
18825
|
+
});
|
|
18801
18826
|
mcp.tool("list_documents", "List direct children of a document (defaults to root). Returns id, label, type, meta, order.", { parentId: z.string().optional().describe("Parent document ID. Omit for root-level documents.") }, async ({ parentId }) => {
|
|
18802
18827
|
const treeMap = server.getTreeMap();
|
|
18803
18828
|
if (!treeMap) return { content: [{
|
|
@@ -18831,7 +18856,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18831
18856
|
mcp.tool("create_document", "Create a new document in the tree. Returns the new document ID.", {
|
|
18832
18857
|
parentId: z.string().optional().describe("Parent document ID. Omit for top-level pages. Use a document ID for nested/child pages."),
|
|
18833
18858
|
label: z.string().describe("Display name / title for the document."),
|
|
18834
|
-
type: z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18859
|
+
type: z.string().optional().describe("Page type: \"doc\", \"kanban\", \"calendar\", \"table\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\". Omit to inherit parent view."),
|
|
18835
18860
|
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.")
|
|
18836
18861
|
}, async ({ parentId, label, type, meta }) => {
|
|
18837
18862
|
const treeMap = server.getTreeMap();
|
|
@@ -18945,7 +18970,7 @@ function registerTreeTools(mcp, server) {
|
|
|
18945
18970
|
});
|
|
18946
18971
|
mcp.tool("change_document_type", "Change the page type view of a document (data is preserved).", {
|
|
18947
18972
|
id: z.string().describe("Document ID."),
|
|
18948
|
-
type: z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"
|
|
18973
|
+
type: z.string().describe("New page type (e.g. \"doc\", \"kanban\", \"table\", \"calendar\", \"outline\", \"gallery\", \"slides\", \"timeline\", \"whiteboard\", \"map\", \"dashboard\", \"mindmap\", \"graph\").")
|
|
18949
18974
|
}, async ({ id, type }) => {
|
|
18950
18975
|
const treeMap = server.getTreeMap();
|
|
18951
18976
|
if (!treeMap) return { content: [{
|