@imenam/mcp-documentor 1.0.55 → 1.0.56
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/README.md +1 -0
- package/dist/shared/read-only.d.ts +4 -0
- package/dist/shared/read-only.js +11 -0
- package/dist/src/gui-worker.js +18 -0
- package/dist/src/index.js +368 -333
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/gui/dist/assets/{arc-CCHCB-wD.js → arc-hl-9jVa3.js} +1 -1
- package/gui/dist/assets/{architectureDiagram-3BPJPVTR-CY9HTuIq.js → architectureDiagram-3BPJPVTR-Cv0e-QlI.js} +1 -1
- package/gui/dist/assets/{blockDiagram-GPEHLZMM-BOVxufIP.js → blockDiagram-GPEHLZMM-DmqN7ioQ.js} +1 -1
- package/gui/dist/assets/{c4Diagram-AAUBKEIU-D4gw0Vvh.js → c4Diagram-AAUBKEIU-CCmx3y3D.js} +1 -1
- package/gui/dist/assets/channel-Be8bJJxH.js +1 -0
- package/gui/dist/assets/{chunk-2J33WTMH-D9MZap0G.js → chunk-2J33WTMH-DkiBzADG.js} +1 -1
- package/gui/dist/assets/{chunk-4BX2VUAB-DZp7afnZ.js → chunk-4BX2VUAB-DNbC5-R6.js} +1 -1
- package/gui/dist/assets/{chunk-55IACEB6--z45PUIk.js → chunk-55IACEB6-BDo8xvgP.js} +1 -1
- package/gui/dist/assets/{chunk-727SXJPM-BpzsGHwS.js → chunk-727SXJPM-BXbVbdMj.js} +1 -1
- package/gui/dist/assets/{chunk-AQP2D5EJ-BHrif5nf.js → chunk-AQP2D5EJ-BYle6aB3.js} +1 -1
- package/gui/dist/assets/{chunk-FMBD7UC4-BJnvL7mL.js → chunk-FMBD7UC4-BdIrLn1p.js} +1 -1
- package/gui/dist/assets/{chunk-ND2GUHAM-B30rNlK9.js → chunk-ND2GUHAM-BkjdsZf2.js} +1 -1
- package/gui/dist/assets/{chunk-QZHKN3VN-C30k0U0w.js → chunk-QZHKN3VN-pwVXVLDb.js} +1 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-DxtDCVWj.js +1 -0
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-DxtDCVWj.js +1 -0
- package/gui/dist/assets/{cose-bilkent-S5V4N54A-D_ZPLp5P.js → cose-bilkent-S5V4N54A-COfRIcXU.js} +1 -1
- package/gui/dist/assets/{dagre-BM42HDAG-2XyC0YBj.js → dagre-BM42HDAG-BnD4nd21.js} +1 -1
- package/gui/dist/assets/{diagram-2AECGRRQ-fNv6yQF_.js → diagram-2AECGRRQ-E9oTEn4C.js} +1 -1
- package/gui/dist/assets/{diagram-5GNKFQAL-BUlxr0NW.js → diagram-5GNKFQAL-oSJwag8_.js} +1 -1
- package/gui/dist/assets/{diagram-KO2AKTUF-CtusNGfh.js → diagram-KO2AKTUF-B5ycmD2n.js} +1 -1
- package/gui/dist/assets/{diagram-LMA3HP47-Dkq3FOEe.js → diagram-LMA3HP47-DUo9wv_e.js} +1 -1
- package/gui/dist/assets/{diagram-OG6HWLK6-rjhcMJNr.js → diagram-OG6HWLK6-C-0r9-AW.js} +1 -1
- package/gui/dist/assets/{erDiagram-TEJ5UH35-Bqmogkqv.js → erDiagram-TEJ5UH35-C8w0nNRI.js} +1 -1
- package/gui/dist/assets/{flowDiagram-I6XJVG4X-BcYYq0Bh.js → flowDiagram-I6XJVG4X-CPZzt4CO.js} +1 -1
- package/gui/dist/assets/{ganttDiagram-6RSMTGT7-BGmJltMK.js → ganttDiagram-6RSMTGT7-B0TRw-bC.js} +1 -1
- package/gui/dist/assets/{gitGraphDiagram-PVQCEYII-JIYjcd0T.js → gitGraphDiagram-PVQCEYII-CxuhZqVM.js} +1 -1
- package/gui/dist/assets/{index-BwW5YDD1.js → index-84YuA9I8.js} +75 -75
- package/gui/dist/assets/{infoDiagram-5YYISTIA-CJKrfqe4.js → infoDiagram-5YYISTIA-qLgkATyo.js} +1 -1
- package/gui/dist/assets/{ishikawaDiagram-YF4QCWOH-Bu4wBvlL.js → ishikawaDiagram-YF4QCWOH-Bv8EcedY.js} +1 -1
- package/gui/dist/assets/{journeyDiagram-JHISSGLW-B2CtojGV.js → journeyDiagram-JHISSGLW-CO1wpi9j.js} +1 -1
- package/gui/dist/assets/{kanban-definition-UN3LZRKU-CKbuCL_h.js → kanban-definition-UN3LZRKU-INpnb6ij.js} +1 -1
- package/gui/dist/assets/{linear-BdHWi7h7.js → linear-yh3g20kh.js} +1 -1
- package/gui/dist/assets/{mindmap-definition-RKZ34NQL-Dbf71zzi.js → mindmap-definition-RKZ34NQL-BzSJP5cs.js} +1 -1
- package/gui/dist/assets/{pieDiagram-4H26LBE5-P8RSqdBA.js → pieDiagram-4H26LBE5-DH9i355H.js} +1 -1
- package/gui/dist/assets/{quadrantDiagram-W4KKPZXB-mVsJmQan.js → quadrantDiagram-W4KKPZXB-CNmW8Mck.js} +1 -1
- package/gui/dist/assets/{requirementDiagram-4Y6WPE33-BfHNLWFb.js → requirementDiagram-4Y6WPE33-DIxitFst.js} +1 -1
- package/gui/dist/assets/{sankeyDiagram-5OEKKPKP-CF28kVcG.js → sankeyDiagram-5OEKKPKP-BI4KHeTZ.js} +1 -1
- package/gui/dist/assets/{sequenceDiagram-3UESZ5HK-Bvs2r29Y.js → sequenceDiagram-3UESZ5HK-CbMtHFNi.js} +1 -1
- package/gui/dist/assets/{stateDiagram-AJRCARHV-Cbg-3kIx.js → stateDiagram-AJRCARHV-DWXkOhjJ.js} +1 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Dv9pwdh3.js +1 -0
- package/gui/dist/assets/{timeline-definition-PNZ67QCA-ChYm8r8v.js → timeline-definition-PNZ67QCA-DGsBQPbg.js} +1 -1
- package/gui/dist/assets/{vennDiagram-CIIHVFJN-CPcYOWG6.js → vennDiagram-CIIHVFJN-Dw5U_iYl.js} +1 -1
- package/gui/dist/assets/{wardley-L42UT6IY-KWdiWaFE.js → wardley-L42UT6IY-DGOHyaD_.js} +1 -1
- package/gui/dist/assets/{wardleyDiagram-YWT4CUSO-DAgBnDcZ.js → wardleyDiagram-YWT4CUSO-DpOyo37L.js} +1 -1
- package/gui/dist/assets/{xychartDiagram-2RQKCTM6-DwOk_srp.js → xychartDiagram-2RQKCTM6-BM5vPGiE.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/gui/dist/assets/channel-V0oafPxe.js +0 -1
- package/gui/dist/assets/classDiagram-4FO5ZUOK-BZlXnsXv.js +0 -1
- package/gui/dist/assets/classDiagram-v2-Q7XG4LA2-BZlXnsXv.js +0 -1
- package/gui/dist/assets/stateDiagram-v2-BHNVJYJU-Cg1sS-MT.js +0 -1
package/dist/src/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import { prepareExportBundle } from "./tools/prepare-export-bundle.js";
|
|
|
39
39
|
import { deleteExportBundle } from "./tools/delete-export-bundle.js";
|
|
40
40
|
import { uploadImage } from "./tools/upload-image.js";
|
|
41
41
|
import { getImage } from "./tools/get-image.js";
|
|
42
|
+
import { isReadOnly, WRITE_TOOLS } from "../shared/read-only.js";
|
|
42
43
|
const __filename = fileURLToPath(import.meta.url);
|
|
43
44
|
const __dirname = path.dirname(__filename);
|
|
44
45
|
function findProjectRoot(startDir) {
|
|
@@ -162,7 +163,7 @@ async function handleGetInitialState(msg) {
|
|
|
162
163
|
broadcastToGUI({
|
|
163
164
|
type: "INITIAL_STATE",
|
|
164
165
|
correlationId: msg.correlationId,
|
|
165
|
-
data: { config, docs, projects: config.projects, bundles },
|
|
166
|
+
data: { config, docs, projects: config.projects, bundles, readOnly: isReadOnly() },
|
|
166
167
|
timestamp: new Date().toISOString(),
|
|
167
168
|
});
|
|
168
169
|
}
|
|
@@ -175,7 +176,7 @@ async function handleGetConfig(msg) {
|
|
|
175
176
|
broadcastToGUI({
|
|
176
177
|
type: "CONFIG_RESPONSE",
|
|
177
178
|
correlationId: msg.correlationId,
|
|
178
|
-
data: { ...config, version: getConfig().version },
|
|
179
|
+
data: { ...config, version: getConfig().version, readOnly: isReadOnly() },
|
|
179
180
|
timestamp: new Date().toISOString(),
|
|
180
181
|
});
|
|
181
182
|
}
|
|
@@ -302,6 +303,15 @@ async function handleListFoldersIPC(msg) {
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
async function handleCreateDocIPC(msg) {
|
|
306
|
+
if (isReadOnly()) {
|
|
307
|
+
broadcastToGUI({
|
|
308
|
+
type: "CREATE_DOC_RESPONSE",
|
|
309
|
+
correlationId: msg.correlationId,
|
|
310
|
+
error: "READ_ONLY mode: creation disabled",
|
|
311
|
+
timestamp: new Date().toISOString(),
|
|
312
|
+
});
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
305
315
|
try {
|
|
306
316
|
const { title, content, folder, tags, project } = msg.data ?? {};
|
|
307
317
|
if (!title || !content)
|
|
@@ -356,6 +366,15 @@ async function handleCreateDocIPC(msg) {
|
|
|
356
366
|
}
|
|
357
367
|
}
|
|
358
368
|
async function handleUpdateDocIPC(msg) {
|
|
369
|
+
if (isReadOnly()) {
|
|
370
|
+
broadcastToGUI({
|
|
371
|
+
type: "UPDATE_DOC_RESPONSE",
|
|
372
|
+
correlationId: msg.correlationId,
|
|
373
|
+
error: "READ_ONLY mode: update disabled",
|
|
374
|
+
timestamp: new Date().toISOString(),
|
|
375
|
+
});
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
359
378
|
try {
|
|
360
379
|
const result = await updateDoc(storageEngine, embeddingEngine, {
|
|
361
380
|
path: msg.data.id,
|
|
@@ -516,6 +535,15 @@ async function handleGitDiff(msg) {
|
|
|
516
535
|
}
|
|
517
536
|
}
|
|
518
537
|
async function handleUpdateConfig(msg) {
|
|
538
|
+
if (isReadOnly()) {
|
|
539
|
+
broadcastToGUI({
|
|
540
|
+
type: "CONFIG_UPDATED",
|
|
541
|
+
correlationId: msg.correlationId,
|
|
542
|
+
error: "READ_ONLY mode: configuration changes disabled",
|
|
543
|
+
timestamp: new Date().toISOString(),
|
|
544
|
+
});
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
519
547
|
try {
|
|
520
548
|
const { key, value } = msg.data;
|
|
521
549
|
const envPath = path.join(rootDir, ".env");
|
|
@@ -611,403 +639,410 @@ function launchGUI() {
|
|
|
611
639
|
guiLauncher.start();
|
|
612
640
|
}
|
|
613
641
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
end: { type: "integer", minimum: 1, description: "Last line of the section (1-indexed, inclusive)" },
|
|
641
|
-
},
|
|
642
|
-
required: ["start", "end"],
|
|
642
|
+
const tools = [
|
|
643
|
+
{
|
|
644
|
+
name: "create_doc",
|
|
645
|
+
description: "Create a new documentation entry with markdown content, optional tracked files, and tags.",
|
|
646
|
+
inputSchema: {
|
|
647
|
+
type: "object",
|
|
648
|
+
properties: {
|
|
649
|
+
title: { type: "string", description: "Title of the documentation entry" },
|
|
650
|
+
content: { type: "string", description: "Documentation content in markdown. To link to another document inline, use the syntax [text](doc://target-doc-id) — the viewer will navigate to that document on click. To link to a heading within the same document, use [text](#heading-slug). Use check_links to validate both types. For code blocks, always specify a language identifier for syntax highlighting, e.g. ```typescript, ```python, ```bash, ```json, ```yaml, ```sql. To embed a code excerpt directly from a source file, use [copy-from-codebase|/absolute/path/to/file.ts|startLine|endLine] — the tag is replaced at save time by a fenced code block with automatic language detection, and the file+range is automatically added to tracked_files. IMPORTANT: always read the source file first to identify the exact line numbers before writing the tag." },
|
|
651
|
+
content_file: { type: "string", description: "Absolute path to a text file whose content will be used instead of the content parameter. Use this to reuse a previously persisted draft (path is returned in the error message when a previous call failed)." },
|
|
652
|
+
tracked_files: {
|
|
653
|
+
type: "array",
|
|
654
|
+
items: {
|
|
655
|
+
oneOf: [
|
|
656
|
+
{ type: "string", description: "Plain file path for whole-file tracking" },
|
|
657
|
+
{
|
|
658
|
+
type: "object",
|
|
659
|
+
properties: {
|
|
660
|
+
path: { type: "string", description: "File path to track" },
|
|
661
|
+
lines: {
|
|
662
|
+
type: "array",
|
|
663
|
+
items: {
|
|
664
|
+
type: "object",
|
|
665
|
+
properties: {
|
|
666
|
+
start: { type: "integer", minimum: 1, description: "First line of the section (1-indexed, inclusive)" },
|
|
667
|
+
end: { type: "integer", minimum: 1, description: "Last line of the section (1-indexed, inclusive)" },
|
|
643
668
|
},
|
|
644
|
-
|
|
645
|
-
description: "One or more line ranges to track within the file",
|
|
669
|
+
required: ["start", "end"],
|
|
646
670
|
},
|
|
671
|
+
minItems: 1,
|
|
672
|
+
description: "One or more line ranges to track within the file",
|
|
647
673
|
},
|
|
648
|
-
required: ["path", "lines"],
|
|
649
|
-
description: "Granular section tracking: only the specified line ranges are monitored",
|
|
650
674
|
},
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
tags: {
|
|
656
|
-
type: "array",
|
|
657
|
-
items: { type: "string" },
|
|
658
|
-
description: "Tags for categorization",
|
|
659
|
-
},
|
|
660
|
-
folder: { type: "string", description: "Folder path for organization, e.g. 'frontend/components'" },
|
|
661
|
-
related_docs: {
|
|
662
|
-
type: "array",
|
|
663
|
-
items: { type: "string" },
|
|
664
|
-
description: "IDs of related documentation entries",
|
|
675
|
+
required: ["path", "lines"],
|
|
676
|
+
description: "Granular section tracking: only the specified line ranges are monitored",
|
|
677
|
+
},
|
|
678
|
+
],
|
|
665
679
|
},
|
|
666
|
-
|
|
680
|
+
description: "Files to track for staleness detection. Use a plain path string for whole-file tracking, or { path, lines: [{ start, end }] } to track specific sections only (reduces false positives when unrelated parts of the file change).",
|
|
667
681
|
},
|
|
668
|
-
|
|
682
|
+
tags: {
|
|
683
|
+
type: "array",
|
|
684
|
+
items: { type: "string" },
|
|
685
|
+
description: "Tags for categorization",
|
|
686
|
+
},
|
|
687
|
+
folder: { type: "string", description: "Folder path for organization, e.g. 'frontend/components'" },
|
|
688
|
+
related_docs: {
|
|
689
|
+
type: "array",
|
|
690
|
+
items: { type: "string" },
|
|
691
|
+
description: "IDs of related documentation entries",
|
|
692
|
+
},
|
|
693
|
+
project: { type: "string", description: "Project to create the doc in (defaults to current project if omitted). If the project name does not exist yet, it will be created automatically." },
|
|
669
694
|
},
|
|
695
|
+
required: ["title"],
|
|
670
696
|
},
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
},
|
|
679
|
-
required: ["path"],
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: "get_doc",
|
|
700
|
+
description: "Retrieve a documentation entry by its path, including full content, tracked files, and metadata.",
|
|
701
|
+
inputSchema: {
|
|
702
|
+
type: "object",
|
|
703
|
+
properties: {
|
|
704
|
+
path: { type: "string", description: "Path of the documentation entry, e.g. 'backend/auth/authentication' or 'authentication' for root docs" },
|
|
680
705
|
},
|
|
706
|
+
required: ["path"],
|
|
681
707
|
},
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
},
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "list_docs",
|
|
711
|
+
description: "List all documentation entries in the current project with staleness indicators.",
|
|
712
|
+
inputSchema: {
|
|
713
|
+
type: "object",
|
|
714
|
+
properties: {
|
|
715
|
+
project: { type: "string", description: "Project to list (lists all projects if omitted)" },
|
|
690
716
|
},
|
|
691
717
|
},
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
},
|
|
722
|
-
required: ["start", "end"],
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: "update_doc",
|
|
721
|
+
description: "Fully replace the content and/or metadata of a documentation entry. WARNING: This overwrites the entire content. Prefer patch_doc for targeted edits — only use update_doc when the changes are so extensive that a patch is impractical. To move a doc to another folder, use move_doc instead.",
|
|
722
|
+
inputSchema: {
|
|
723
|
+
type: "object",
|
|
724
|
+
properties: {
|
|
725
|
+
path: { type: "string", description: "Path of the documentation entry to update, e.g. 'backend/auth/authentication' or 'authentication' for root docs" },
|
|
726
|
+
title: {
|
|
727
|
+
type: "string",
|
|
728
|
+
description: "New display title stored in frontmatter. Does not rename the file or change the document path — use move_doc to relocate or rename on disk.",
|
|
729
|
+
},
|
|
730
|
+
content: { type: "string", description: "New content (replaces existing). Supports [text](doc://target-doc-path) to link inline to other documents, and [text](#heading-slug) to link to headings within this document. For code blocks, always specify a language identifier for syntax highlighting, e.g. ```typescript, ```python, ```bash, ```json, ```yaml, ```sql. To embed a code excerpt directly from a source file, use [copy-from-codebase|/absolute/path/to/file.ts|startLine|endLine] — the tag is replaced at save time by a fenced code block with automatic language detection, and the file+range is automatically added to tracked_files. IMPORTANT: always read the source file first to identify the exact line numbers before writing the tag." },
|
|
731
|
+
content_file: { type: "string", description: "Absolute path to a text file whose content will be used instead of the content parameter. Use this to reuse a previously persisted draft (path is returned in the error message when a previous call failed)." },
|
|
732
|
+
tracked_files: {
|
|
733
|
+
type: "array",
|
|
734
|
+
items: {
|
|
735
|
+
oneOf: [
|
|
736
|
+
{ type: "string", description: "Plain file path for whole-file tracking" },
|
|
737
|
+
{
|
|
738
|
+
type: "object",
|
|
739
|
+
properties: {
|
|
740
|
+
path: { type: "string", description: "File path to track" },
|
|
741
|
+
lines: {
|
|
742
|
+
type: "array",
|
|
743
|
+
items: {
|
|
744
|
+
type: "object",
|
|
745
|
+
properties: {
|
|
746
|
+
start: { type: "integer", minimum: 1, description: "First line of the section (1-indexed, inclusive)" },
|
|
747
|
+
end: { type: "integer", minimum: 1, description: "Last line of the section (1-indexed, inclusive)" },
|
|
723
748
|
},
|
|
724
|
-
|
|
725
|
-
description: "One or more line ranges to track within the file",
|
|
749
|
+
required: ["start", "end"],
|
|
726
750
|
},
|
|
751
|
+
minItems: 1,
|
|
752
|
+
description: "One or more line ranges to track within the file",
|
|
727
753
|
},
|
|
728
|
-
required: ["path", "lines"],
|
|
729
|
-
description: "Granular section tracking: only the specified line ranges are monitored",
|
|
730
754
|
},
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
tags: {
|
|
736
|
-
type: "array",
|
|
737
|
-
items: { type: "string" },
|
|
738
|
-
description: "New tags (replaces existing)",
|
|
739
|
-
},
|
|
740
|
-
related_docs: {
|
|
741
|
-
type: "array",
|
|
742
|
-
items: { type: "string" },
|
|
743
|
-
description: "Paths of related documentation entries (replaces existing), e.g. ['backend/auth/authentication']",
|
|
755
|
+
required: ["path", "lines"],
|
|
756
|
+
description: "Granular section tracking: only the specified line ranges are monitored",
|
|
757
|
+
},
|
|
758
|
+
],
|
|
744
759
|
},
|
|
760
|
+
description: "New list of tracked files (replaces existing). Use a plain path string for whole-file tracking, or { path, lines: [{ start, end }] } to track specific sections only (reduces false positives when unrelated parts of the file change).",
|
|
745
761
|
},
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
path: { type: "string", description: "Current path of the documentation entry, e.g. 'backend/authentication'" },
|
|
756
|
-
new_path: { type: "string", description: "New path for the documentation entry, e.g. 'backend/v2/authentication'. Can change folder, name, or both." },
|
|
762
|
+
tags: {
|
|
763
|
+
type: "array",
|
|
764
|
+
items: { type: "string" },
|
|
765
|
+
description: "New tags (replaces existing)",
|
|
766
|
+
},
|
|
767
|
+
related_docs: {
|
|
768
|
+
type: "array",
|
|
769
|
+
items: { type: "string" },
|
|
770
|
+
description: "Paths of related documentation entries (replaces existing), e.g. ['backend/auth/authentication']",
|
|
757
771
|
},
|
|
758
|
-
required: ["path", "new_path"],
|
|
759
772
|
},
|
|
773
|
+
required: ["path"],
|
|
760
774
|
},
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
},
|
|
770
|
-
required: ["query"],
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: "move_doc",
|
|
778
|
+
description: "Move a documentation entry to a new path (changes its folder and/or name). All existing doc:// links and related_docs references pointing to the old path are automatically rewritten across the project. This is the only way to relocate a document — update_doc does not change the location.",
|
|
779
|
+
inputSchema: {
|
|
780
|
+
type: "object",
|
|
781
|
+
properties: {
|
|
782
|
+
path: { type: "string", description: "Current path of the documentation entry, e.g. 'backend/authentication'" },
|
|
783
|
+
new_path: { type: "string", description: "New path for the documentation entry, e.g. 'backend/v2/authentication'. Can change folder, name, or both." },
|
|
771
784
|
},
|
|
785
|
+
required: ["path", "new_path"],
|
|
772
786
|
},
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
},
|
|
782
|
-
required: [],
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
name: "search_docs",
|
|
790
|
+
description: "Semantic search across documentation entries using natural language. Requires OpenAI API key.",
|
|
791
|
+
inputSchema: {
|
|
792
|
+
type: "object",
|
|
793
|
+
properties: {
|
|
794
|
+
query: { type: "string", description: "Search query in natural language" },
|
|
795
|
+
top_k: { type: "number", description: "Number of results to return (default: 5)" },
|
|
783
796
|
},
|
|
797
|
+
required: ["query"],
|
|
784
798
|
},
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
},
|
|
793
|
-
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
name: "check_freshness",
|
|
802
|
+
description: "Check freshness of documentation. Pass a path to check a single entry, or omit it to scan all docs in a project and get a full staleness report.",
|
|
803
|
+
inputSchema: {
|
|
804
|
+
type: "object",
|
|
805
|
+
properties: {
|
|
806
|
+
path: { type: "string", description: "Path of a single documentation entry to check, e.g. 'backend/auth/authentication'. If omitted, scans all docs in the project." },
|
|
807
|
+
project: { type: "string", description: "Project to scan (scans all projects if omitted). Only used when path is omitted." },
|
|
794
808
|
},
|
|
809
|
+
required: [],
|
|
795
810
|
},
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
name: "set_project",
|
|
814
|
+
description: "Switch the active project and update it as the default for all subsequent MCP tool operations. If the project name does not exist yet, it is created automatically. Also controls what the GUI displays.",
|
|
815
|
+
inputSchema: {
|
|
816
|
+
type: "object",
|
|
817
|
+
properties: {
|
|
818
|
+
project: { type: "string", description: "Project name to switch to (created if it does not exist)" },
|
|
802
819
|
},
|
|
820
|
+
required: ["project"],
|
|
803
821
|
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
name: "list_projects",
|
|
825
|
+
description: "List all available documentation projects and show which one is currently active.",
|
|
826
|
+
inputSchema: {
|
|
827
|
+
type: "object",
|
|
828
|
+
properties: {},
|
|
829
|
+
},
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: "refresh_file_snapshot",
|
|
833
|
+
description: "Mark tracked files as up-to-date by updating their snapshot timestamps. Use when file changes don't affect the documentation. Accepts one or more doc paths.",
|
|
834
|
+
inputSchema: {
|
|
835
|
+
type: "object",
|
|
836
|
+
properties: {
|
|
837
|
+
paths: {
|
|
838
|
+
type: "array",
|
|
839
|
+
items: { type: "string" },
|
|
840
|
+
description: "Paths of documentation entries to refresh, e.g. ['backend/auth/authentication', 'setup']",
|
|
841
|
+
},
|
|
842
|
+
file_paths: {
|
|
843
|
+
type: "array",
|
|
844
|
+
items: { type: "string" },
|
|
845
|
+
description: "Specific tracked file paths to refresh (all tracked files if omitted)",
|
|
820
846
|
},
|
|
821
|
-
required: ["paths"],
|
|
822
847
|
},
|
|
848
|
+
required: ["paths"],
|
|
823
849
|
},
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
},
|
|
832
|
-
required: ["path"],
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
name: "get_doc_metadata",
|
|
853
|
+
description: "Get metadata of a documentation entry (path, title, tags, dates, tracked files with freshness) without loading the full content.",
|
|
854
|
+
inputSchema: {
|
|
855
|
+
type: "object",
|
|
856
|
+
properties: {
|
|
857
|
+
path: { type: "string", description: "Path of the documentation entry, e.g. 'backend/auth/authentication'" },
|
|
833
858
|
},
|
|
859
|
+
required: ["path"],
|
|
834
860
|
},
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
},
|
|
847
|
-
required: ["path", "search"],
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: "patch_doc",
|
|
864
|
+
description: "PREFERRED method for modifying documentation. Replaces a specific portion of a documentation entry's content using an exact search-and-replace, without touching the rest of the doc. Always use this instead of update_doc when making partial changes.",
|
|
865
|
+
inputSchema: {
|
|
866
|
+
type: "object",
|
|
867
|
+
properties: {
|
|
868
|
+
path: { type: "string", description: "Path of the documentation entry to patch, e.g. 'backend/auth/authentication'" },
|
|
869
|
+
search: { type: "string", description: "Exact text to find in the current content" },
|
|
870
|
+
search_file: { type: "string", description: "Absolute path to a text file whose content will be used as the search text. Use this to reuse a previously persisted draft (path is returned in the error message when a previous call failed)." },
|
|
871
|
+
replacement: { type: "string", description: "Text to replace it with. Supports [copy-from-codebase|/absolute/path/to/file.ts|startLine|endLine] — the tag is replaced at save time by a fenced code block, and the file+range is automatically added to tracked_files. IMPORTANT: always read the source file first to identify the exact line numbers before writing the tag." },
|
|
872
|
+
replacement_file: { type: "string", description: "Absolute path to a text file whose content will be used as the replacement. Use this to reuse a previously persisted draft (path is returned in the error message when a previous call failed)." },
|
|
848
873
|
},
|
|
874
|
+
required: ["path", "search"],
|
|
849
875
|
},
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: "git_diff_doc",
|
|
879
|
+
description: "Show the git diff for each tracked file of one or more docs, between their current state and the last commit before the stored snapshot date.",
|
|
880
|
+
inputSchema: {
|
|
881
|
+
type: "object",
|
|
882
|
+
properties: {
|
|
883
|
+
paths: {
|
|
884
|
+
type: "array",
|
|
885
|
+
items: { type: "string" },
|
|
886
|
+
description: "Paths of documentation entries to diff, e.g. ['backend/auth/authentication']",
|
|
887
|
+
},
|
|
888
|
+
file_paths: {
|
|
889
|
+
type: "array",
|
|
890
|
+
items: { type: "string" },
|
|
891
|
+
description: "Specific tracked file paths to diff (all tracked files if omitted)",
|
|
866
892
|
},
|
|
867
|
-
required: ["paths"],
|
|
868
893
|
},
|
|
894
|
+
required: ["paths"],
|
|
869
895
|
},
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
},
|
|
878
|
-
required: [],
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: "check_links",
|
|
899
|
+
description: "Check all links across a project and report broken references. Validates: related_docs IDs, inline doc links ([text](doc://id)) in content, and anchor links ([text](#heading-slug)) in content.",
|
|
900
|
+
inputSchema: {
|
|
901
|
+
type: "object",
|
|
902
|
+
properties: {
|
|
903
|
+
project: { type: "string", description: "Project to check (defaults to current project)" },
|
|
879
904
|
},
|
|
905
|
+
required: [],
|
|
880
906
|
},
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
},
|
|
889
|
-
required: ["path"],
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
name: "delete_doc",
|
|
910
|
+
description: "Permanently delete a documentation entry. Works across all projects — no need to set the active project first.",
|
|
911
|
+
inputSchema: {
|
|
912
|
+
type: "object",
|
|
913
|
+
properties: {
|
|
914
|
+
path: { type: "string", description: "Path of the documentation entry to delete, e.g. 'backend/auth/authentication'" },
|
|
890
915
|
},
|
|
916
|
+
required: ["path"],
|
|
891
917
|
},
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
},
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
name: "get_doc_tree",
|
|
921
|
+
description: "Get the full documentation tree showing folders, subfolders, and documentation names (not file names). Useful to quickly understand the documentation structure of a project.",
|
|
922
|
+
inputSchema: {
|
|
923
|
+
type: "object",
|
|
924
|
+
properties: {
|
|
925
|
+
project: { type: "string", description: "Project to display (shows all projects if omitted)" },
|
|
900
926
|
},
|
|
901
927
|
},
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
},
|
|
911
|
-
required: ["path"],
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
name: "list_doc_versions",
|
|
931
|
+
description: "List all saved versions of a documentation entry, with date and change type.",
|
|
932
|
+
inputSchema: {
|
|
933
|
+
type: "object",
|
|
934
|
+
properties: {
|
|
935
|
+
path: { type: "string", description: "Path of the documentation entry, e.g. 'backend/auth/authentication'" },
|
|
936
|
+
project: { type: "string", description: "Project to look in (defaults to current project)" },
|
|
912
937
|
},
|
|
938
|
+
required: ["path"],
|
|
913
939
|
},
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
},
|
|
924
|
-
required: ["path", "version"],
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
name: "get_doc_version",
|
|
943
|
+
description: "Retrieve the full content of a specific version of a documentation entry.",
|
|
944
|
+
inputSchema: {
|
|
945
|
+
type: "object",
|
|
946
|
+
properties: {
|
|
947
|
+
path: { type: "string", description: "Path of the documentation entry, e.g. 'backend/auth/authentication'" },
|
|
948
|
+
version: { type: "number", description: "Version number to retrieve" },
|
|
949
|
+
project: { type: "string", description: "Project to look in (defaults to current project)" },
|
|
925
950
|
},
|
|
951
|
+
required: ["path", "version"],
|
|
926
952
|
},
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
},
|
|
937
|
-
required: ["path", "version"],
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
name: "restore_doc_version",
|
|
956
|
+
description: "Restore a documentation entry to a previous version. The current state is saved as a new version before overwriting.",
|
|
957
|
+
inputSchema: {
|
|
958
|
+
type: "object",
|
|
959
|
+
properties: {
|
|
960
|
+
path: { type: "string", description: "Path of the documentation entry, e.g. 'backend/auth/authentication'" },
|
|
961
|
+
version: { type: "number", description: "Version number to restore" },
|
|
962
|
+
project: { type: "string", description: "Project to look in (defaults to current project)" },
|
|
938
963
|
},
|
|
964
|
+
required: ["path", "version"],
|
|
939
965
|
},
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
required: [],
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
name: "reindex_embeddings",
|
|
969
|
+
description: "Generate missing embeddings for all documentation entries in a project (or all projects). Useful when importing existing documentation that was created outside the MCP. Use force: true to regenerate embeddings for all docs, including those already indexed.",
|
|
970
|
+
inputSchema: {
|
|
971
|
+
type: "object",
|
|
972
|
+
properties: {
|
|
973
|
+
project: { type: "string", description: "Project to reindex (processes all projects if omitted)" },
|
|
974
|
+
force: { type: "boolean", description: "If true, regenerates embeddings for all docs even if they are already indexed (default: false)" },
|
|
950
975
|
},
|
|
976
|
+
required: [],
|
|
951
977
|
},
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
description: { type: "string", description: "Short description of the bundle (optional)" },
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
name: "prepare_export_bundle",
|
|
981
|
+
description: "Create or update a named export bundle: a set of documentation references that the user can download as a ZIP from the GUI. The ZIP contains clean markdown content (no frontmatter). Existing bundle with the same name is replaced.",
|
|
982
|
+
inputSchema: {
|
|
983
|
+
type: "object",
|
|
984
|
+
properties: {
|
|
985
|
+
name: { type: "string", description: "Bundle display name (becomes the identifier via slugify)" },
|
|
986
|
+
zip_filename: { type: "string", description: "ZIP filename to download, e.g. 'my-bundle.zip'" },
|
|
987
|
+
docs: {
|
|
988
|
+
type: "array",
|
|
989
|
+
items: { type: "string" },
|
|
990
|
+
description: "Doc references to include: 'project:doc-id' for cross-project, or 'doc-id' for current project",
|
|
966
991
|
},
|
|
967
|
-
|
|
992
|
+
description: { type: "string", description: "Short description of the bundle (optional)" },
|
|
968
993
|
},
|
|
994
|
+
required: ["name", "zip_filename", "docs"],
|
|
969
995
|
},
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
},
|
|
978
|
-
required: ["id"],
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
name: "delete_export_bundle",
|
|
999
|
+
description: "Delete an export bundle by its identifier (slug).",
|
|
1000
|
+
inputSchema: {
|
|
1001
|
+
type: "object",
|
|
1002
|
+
properties: {
|
|
1003
|
+
id: { type: "string", description: "Bundle identifier to delete (slug, e.g. 'my-bundle')" },
|
|
979
1004
|
},
|
|
1005
|
+
required: ["id"],
|
|
980
1006
|
},
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
},
|
|
992
|
-
required: ["filename", "filePath"],
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
name: "upload_image",
|
|
1010
|
+
description: "Upload an image to a project's assets from a local file path and get back the markdown link to insert in a document. Returns the URL and a ready-to-use markdown snippet: .",
|
|
1011
|
+
inputSchema: {
|
|
1012
|
+
type: "object",
|
|
1013
|
+
properties: {
|
|
1014
|
+
filename: { type: "string", description: "Filename with extension, e.g. 'screenshot.png'" },
|
|
1015
|
+
filePath: { type: "string", description: "Absolute path to the image file on the server" },
|
|
1016
|
+
project: { type: "string", description: "Target project (defaults to current project)" },
|
|
1017
|
+
alt: { type: "string", description: "Alt text for the markdown image link (optional)" },
|
|
993
1018
|
},
|
|
1019
|
+
required: ["filename", "filePath"],
|
|
994
1020
|
},
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
},
|
|
1003
|
-
required: ["uri"],
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: "get_image",
|
|
1024
|
+
description: "Retrieve an image stored in a project's assets by its URI and return it as a base64-encoded image. Use this when a document references an image (e.g. ) and you need to view its content.",
|
|
1025
|
+
inputSchema: {
|
|
1026
|
+
type: "object",
|
|
1027
|
+
properties: {
|
|
1028
|
+
uri: { type: "string", description: "Image URI as it appears in the document, e.g. '/api/images/my-project/screenshot.png'" },
|
|
1004
1029
|
},
|
|
1030
|
+
required: ["uri"],
|
|
1005
1031
|
},
|
|
1006
|
-
|
|
1032
|
+
},
|
|
1033
|
+
];
|
|
1034
|
+
return {
|
|
1035
|
+
tools: isReadOnly() ? tools.filter((t) => !WRITE_TOOLS.has(t.name)) : tools,
|
|
1007
1036
|
};
|
|
1008
1037
|
});
|
|
1009
1038
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1010
1039
|
const { name, arguments: args } = request.params;
|
|
1040
|
+
if (isReadOnly() && WRITE_TOOLS.has(name)) {
|
|
1041
|
+
return {
|
|
1042
|
+
content: [{ type: "text", text: `Error: tool "${name}" is disabled (READ_ONLY mode).` }],
|
|
1043
|
+
isError: true,
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1011
1046
|
try {
|
|
1012
1047
|
switch (name) {
|
|
1013
1048
|
case "create_doc":
|