@thallylabs/mcp 0.7.5 → 0.8.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.js +36 -9
- package/dist/tools.js +36 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -329,6 +329,34 @@ function writeDocsJson(projectDir, config) {
|
|
|
329
329
|
writeFileSync2(docsPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
// src/lib/page-echo.ts
|
|
333
|
+
var BODY_DELIMITER = "--- MDX body ---";
|
|
334
|
+
function readPageBodyDelimiter() {
|
|
335
|
+
return BODY_DELIMITER;
|
|
336
|
+
}
|
|
337
|
+
function stripEchoedPageHeader(content, pageId) {
|
|
338
|
+
const lines = content.split("\n");
|
|
339
|
+
const delimiterIndex = lines.findIndex((line) => line.trim() === BODY_DELIMITER);
|
|
340
|
+
if (delimiterIndex !== -1 && delimiterIndex <= 6) {
|
|
341
|
+
return lines.slice(delimiterIndex + 1).join("\n").replace(/^\n+/, "");
|
|
342
|
+
}
|
|
343
|
+
const first = lines[0]?.trim() ?? "";
|
|
344
|
+
const second = lines[1]?.trim() ?? "";
|
|
345
|
+
if (first.startsWith("# ") && second === `*${pageId}*`) {
|
|
346
|
+
let index = 2;
|
|
347
|
+
while (index < lines.length && lines[index].trim() === "") index += 1;
|
|
348
|
+
if (lines[index]?.trim().startsWith("> ")) {
|
|
349
|
+
index += 1;
|
|
350
|
+
while (index < lines.length && lines[index].trim() === "") index += 1;
|
|
351
|
+
}
|
|
352
|
+
if (lines[index]?.trim() === "---") {
|
|
353
|
+
index += 1;
|
|
354
|
+
}
|
|
355
|
+
return lines.slice(index).join("\n").replace(/^\n+/, "");
|
|
356
|
+
}
|
|
357
|
+
return content;
|
|
358
|
+
}
|
|
359
|
+
|
|
332
360
|
// src/tools/add-page.ts
|
|
333
361
|
var addPageSchema = z2.object({
|
|
334
362
|
projectDir: z2.string().describe("Path to the Thally project root"),
|
|
@@ -359,7 +387,7 @@ async function handleAddPage(input) {
|
|
|
359
387
|
if (description) {
|
|
360
388
|
frontmatterLines.push(`description: ${description}`);
|
|
361
389
|
}
|
|
362
|
-
const bodyContent = content
|
|
390
|
+
const bodyContent = content ? stripEchoedPageHeader(content, pageId) : `## ${title}
|
|
363
391
|
|
|
364
392
|
Add your content here.`;
|
|
365
393
|
const mdxContent = `---
|
|
@@ -520,7 +548,7 @@ async function handleUpdatePage(input) {
|
|
|
520
548
|
if (input.mergeFrontmatter) {
|
|
521
549
|
Object.assign(newFm, input.mergeFrontmatter);
|
|
522
550
|
}
|
|
523
|
-
const newBody = input.content !== void 0 ? input.content : parsed.content;
|
|
551
|
+
const newBody = input.content !== void 0 ? stripEchoedPageHeader(input.content, pageId) : parsed.content;
|
|
524
552
|
const newContent = matter.stringify(newBody.trim(), newFm);
|
|
525
553
|
writeFileSync4(filePath, newContent, "utf8");
|
|
526
554
|
return [
|
|
@@ -542,7 +570,8 @@ var migrateDocsSchema = z6.object({
|
|
|
542
570
|
branch: z6.string().optional().describe("Git branch (default: auto-detect)"),
|
|
543
571
|
docsDir: z6.string().optional().describe("Docs subdirectory in repo (default: auto-detect)"),
|
|
544
572
|
apiKey: z6.string().optional().describe("Anthropic API key for non-Markdown file conversion"),
|
|
545
|
-
maxPages: z6.number().int().min(1).max(1e3).optional().describe("Maximum public URL pages to import")
|
|
573
|
+
maxPages: z6.number().int().min(1).max(1e3).optional().describe("Maximum public URL pages to import"),
|
|
574
|
+
platform: z6.enum(["mintlify", "docusaurus"]).optional().describe("Source platform (default: auto-detect)")
|
|
546
575
|
});
|
|
547
576
|
async function handleMigrateDocs(input) {
|
|
548
577
|
const apiKey = input.apiKey ?? process.env.ANTHROPIC_API_KEY;
|
|
@@ -554,6 +583,7 @@ async function handleMigrateDocs(input) {
|
|
|
554
583
|
branch: input.branch,
|
|
555
584
|
docsDir: input.docsDir,
|
|
556
585
|
maxPages: input.maxPages,
|
|
586
|
+
platform: input.platform,
|
|
557
587
|
yes: true
|
|
558
588
|
});
|
|
559
589
|
return `Migration complete! ${result.pagesWritten} pages written to ${result.projectDir}/src/content/`;
|
|
@@ -744,12 +774,9 @@ async function handleReadPage(input) {
|
|
|
744
774
|
const { data, content } = matter3(raw);
|
|
745
775
|
const title = data.title ?? pageId;
|
|
746
776
|
const description = data.description ?? "";
|
|
747
|
-
const lines = [
|
|
748
|
-
if (description) {
|
|
749
|
-
|
|
750
|
-
lines.push("");
|
|
751
|
-
}
|
|
752
|
-
lines.push("---", "", content.trim());
|
|
777
|
+
const lines = [`id: ${pageId}`, `title: ${title}`];
|
|
778
|
+
if (description) lines.push(`description: ${description}`);
|
|
779
|
+
lines.push("", readPageBodyDelimiter(), "", content.trim());
|
|
753
780
|
return lines.join("\n");
|
|
754
781
|
}
|
|
755
782
|
|
package/dist/tools.js
CHANGED
|
@@ -320,6 +320,34 @@ function writeDocsJson(projectDir, config) {
|
|
|
320
320
|
writeFileSync2(docsPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
// src/lib/page-echo.ts
|
|
324
|
+
var BODY_DELIMITER = "--- MDX body ---";
|
|
325
|
+
function readPageBodyDelimiter() {
|
|
326
|
+
return BODY_DELIMITER;
|
|
327
|
+
}
|
|
328
|
+
function stripEchoedPageHeader(content, pageId) {
|
|
329
|
+
const lines = content.split("\n");
|
|
330
|
+
const delimiterIndex = lines.findIndex((line) => line.trim() === BODY_DELIMITER);
|
|
331
|
+
if (delimiterIndex !== -1 && delimiterIndex <= 6) {
|
|
332
|
+
return lines.slice(delimiterIndex + 1).join("\n").replace(/^\n+/, "");
|
|
333
|
+
}
|
|
334
|
+
const first = lines[0]?.trim() ?? "";
|
|
335
|
+
const second = lines[1]?.trim() ?? "";
|
|
336
|
+
if (first.startsWith("# ") && second === `*${pageId}*`) {
|
|
337
|
+
let index = 2;
|
|
338
|
+
while (index < lines.length && lines[index].trim() === "") index += 1;
|
|
339
|
+
if (lines[index]?.trim().startsWith("> ")) {
|
|
340
|
+
index += 1;
|
|
341
|
+
while (index < lines.length && lines[index].trim() === "") index += 1;
|
|
342
|
+
}
|
|
343
|
+
if (lines[index]?.trim() === "---") {
|
|
344
|
+
index += 1;
|
|
345
|
+
}
|
|
346
|
+
return lines.slice(index).join("\n").replace(/^\n+/, "");
|
|
347
|
+
}
|
|
348
|
+
return content;
|
|
349
|
+
}
|
|
350
|
+
|
|
323
351
|
// src/tools/add-page.ts
|
|
324
352
|
var addPageSchema = z2.object({
|
|
325
353
|
projectDir: z2.string().describe("Path to the Thally project root"),
|
|
@@ -350,7 +378,7 @@ async function handleAddPage(input) {
|
|
|
350
378
|
if (description) {
|
|
351
379
|
frontmatterLines.push(`description: ${description}`);
|
|
352
380
|
}
|
|
353
|
-
const bodyContent = content
|
|
381
|
+
const bodyContent = content ? stripEchoedPageHeader(content, pageId) : `## ${title}
|
|
354
382
|
|
|
355
383
|
Add your content here.`;
|
|
356
384
|
const mdxContent = `---
|
|
@@ -511,7 +539,7 @@ async function handleUpdatePage(input) {
|
|
|
511
539
|
if (input.mergeFrontmatter) {
|
|
512
540
|
Object.assign(newFm, input.mergeFrontmatter);
|
|
513
541
|
}
|
|
514
|
-
const newBody = input.content !== void 0 ? input.content : parsed.content;
|
|
542
|
+
const newBody = input.content !== void 0 ? stripEchoedPageHeader(input.content, pageId) : parsed.content;
|
|
515
543
|
const newContent = matter.stringify(newBody.trim(), newFm);
|
|
516
544
|
writeFileSync4(filePath, newContent, "utf8");
|
|
517
545
|
return [
|
|
@@ -533,7 +561,8 @@ var migrateDocsSchema = z6.object({
|
|
|
533
561
|
branch: z6.string().optional().describe("Git branch (default: auto-detect)"),
|
|
534
562
|
docsDir: z6.string().optional().describe("Docs subdirectory in repo (default: auto-detect)"),
|
|
535
563
|
apiKey: z6.string().optional().describe("Anthropic API key for non-Markdown file conversion"),
|
|
536
|
-
maxPages: z6.number().int().min(1).max(1e3).optional().describe("Maximum public URL pages to import")
|
|
564
|
+
maxPages: z6.number().int().min(1).max(1e3).optional().describe("Maximum public URL pages to import"),
|
|
565
|
+
platform: z6.enum(["mintlify", "docusaurus"]).optional().describe("Source platform (default: auto-detect)")
|
|
537
566
|
});
|
|
538
567
|
async function handleMigrateDocs(input) {
|
|
539
568
|
const apiKey = input.apiKey ?? process.env.ANTHROPIC_API_KEY;
|
|
@@ -545,6 +574,7 @@ async function handleMigrateDocs(input) {
|
|
|
545
574
|
branch: input.branch,
|
|
546
575
|
docsDir: input.docsDir,
|
|
547
576
|
maxPages: input.maxPages,
|
|
577
|
+
platform: input.platform,
|
|
548
578
|
yes: true
|
|
549
579
|
});
|
|
550
580
|
return `Migration complete! ${result.pagesWritten} pages written to ${result.projectDir}/src/content/`;
|
|
@@ -735,12 +765,9 @@ async function handleReadPage(input) {
|
|
|
735
765
|
const { data, content } = matter3(raw);
|
|
736
766
|
const title = data.title ?? pageId;
|
|
737
767
|
const description = data.description ?? "";
|
|
738
|
-
const lines = [
|
|
739
|
-
if (description) {
|
|
740
|
-
|
|
741
|
-
lines.push("");
|
|
742
|
-
}
|
|
743
|
-
lines.push("---", "", content.trim());
|
|
768
|
+
const lines = [`id: ${pageId}`, `title: ${title}`];
|
|
769
|
+
if (description) lines.push(`description: ${description}`);
|
|
770
|
+
lines.push("", readPageBodyDelimiter(), "", content.trim());
|
|
744
771
|
return lines.join("\n");
|
|
745
772
|
}
|
|
746
773
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thallylabs/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "MCP server for scaffolding and managing Thally documentation projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@anthropic-ai/sdk": "^0.36.0",
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
37
|
-
"create-thally-docs": "0.
|
|
37
|
+
"create-thally-docs": "0.8.0",
|
|
38
38
|
"gray-matter": "^4.0.3",
|
|
39
39
|
"p-limit": "^6.1.0",
|
|
40
40
|
"tar": "^6.2.0",
|