@czi-sds/mcp 0.2.2 → 0.3.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/data/zeroheight-cache.json +5195 -0
- package/data/zeroheight-exports/Accordion.md +675 -0
- package/data/zeroheight-exports/Banner.md +576 -0
- package/data/zeroheight-exports/Borders.md +118 -0
- package/data/zeroheight-exports/Buttons.md +2260 -0
- package/data/zeroheight-exports/Callout.md +756 -0
- package/data/zeroheight-exports/Colors.md +633 -0
- package/data/zeroheight-exports/Content-Card.md +162 -0
- package/data/zeroheight-exports/Contributing-to-SDS.md +99 -0
- package/data/zeroheight-exports/Control-Inputs.md +2066 -0
- package/data/zeroheight-exports/Corners.md +112 -0
- package/data/zeroheight-exports/Cover-page.md +4 -0
- package/data/zeroheight-exports/Dialog.md +1133 -0
- package/data/zeroheight-exports/Downloads.md +121 -0
- package/data/zeroheight-exports/Drop-Shadows.md +80 -0
- package/data/zeroheight-exports/Dropdown-Input.md +1149 -0
- package/data/zeroheight-exports/Dropdown-Menu.md +3787 -0
- package/data/zeroheight-exports/Element-Status-Tracker.md +268 -0
- package/data/zeroheight-exports/Field-Inputs.md +965 -0
- package/data/zeroheight-exports/Filters.md +868 -0
- package/data/zeroheight-exports/Getting-Started.md +1296 -0
- package/data/zeroheight-exports/Hero.md +256 -0
- package/data/zeroheight-exports/Icons.md +432 -0
- package/data/zeroheight-exports/Intent.md +47 -0
- package/data/zeroheight-exports/Introduction-to-Bases.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Cells.md +36 -0
- package/data/zeroheight-exports/Introduction-to-DNA.md +36 -0
- package/data/zeroheight-exports/Introduction-to-Genes.md +36 -0
- package/data/zeroheight-exports/Introduction.md +116 -0
- package/data/zeroheight-exports/Link.md +373 -0
- package/data/zeroheight-exports/Lists.md +617 -0
- package/data/zeroheight-exports/Loading-Indicator.md +38 -0
- package/data/zeroheight-exports/Navigation.md +853 -0
- package/data/zeroheight-exports/Notification.md +858 -0
- package/data/zeroheight-exports/Panel.md +862 -0
- package/data/zeroheight-exports/README.md +124 -0
- package/data/zeroheight-exports/Responsive-Design.md +275 -0
- package/data/zeroheight-exports/Search-Input.md +54 -0
- package/data/zeroheight-exports/Search.md +609 -0
- package/data/zeroheight-exports/Segmented-Control.md +561 -0
- package/data/zeroheight-exports/Spacing.md +298 -0
- package/data/zeroheight-exports/Table.md +4832 -0
- package/data/zeroheight-exports/Tabs.md +773 -0
- package/data/zeroheight-exports/Tags.md +1025 -0
- package/data/zeroheight-exports/Text-Link.md +185 -0
- package/data/zeroheight-exports/Theming.md +313 -0
- package/data/zeroheight-exports/Tooltips.md +1564 -0
- package/data/zeroheight-exports/Typography.md +769 -0
- package/dist/stdio.js +188 -0
- package/package.json +4 -3
package/dist/stdio.js
CHANGED
|
@@ -632,11 +632,199 @@ var getTailwindTokensTool = {
|
|
|
632
632
|
);
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
|
+
var filename2 = fileURLToPath(import.meta.url);
|
|
636
|
+
var dirname2 = path.dirname(filename2);
|
|
637
|
+
function mapComponentToFile(componentName, exportedFiles) {
|
|
638
|
+
const componentToFileMap = {
|
|
639
|
+
// Button components
|
|
640
|
+
"Button": "Buttons",
|
|
641
|
+
"ButtonDropdown": "Buttons",
|
|
642
|
+
"ButtonIcon": "Buttons",
|
|
643
|
+
"ButtonToggle": "Buttons",
|
|
644
|
+
// Table components
|
|
645
|
+
"TableHeader": "Table",
|
|
646
|
+
"TableRow": "Table",
|
|
647
|
+
// Input components
|
|
648
|
+
"InputCheckbox": "Control-Inputs",
|
|
649
|
+
"InputRadio": "Control-Inputs",
|
|
650
|
+
"InputToggle": "Control-Inputs",
|
|
651
|
+
"InputText": "Field-Inputs",
|
|
652
|
+
"InputDropdown": "Dropdown-Input",
|
|
653
|
+
"InputSearch": "Search-Input",
|
|
654
|
+
"InputSlider": "Control-Inputs",
|
|
655
|
+
// Dropdown components
|
|
656
|
+
"Dropdown": "Dropdown-Menu",
|
|
657
|
+
"DropdownMenu": "Dropdown-Menu",
|
|
658
|
+
// Content components
|
|
659
|
+
"ContentCard": "Content-Card",
|
|
660
|
+
"LoadingIndicator": "Loading-Indicator",
|
|
661
|
+
// Navigation components
|
|
662
|
+
"NavigationFooter": "Navigation",
|
|
663
|
+
"NavigationHeader": "Navigation",
|
|
664
|
+
"NavigationJumpTo": "Navigation",
|
|
665
|
+
// Control components
|
|
666
|
+
"SegmentedControl": "Segmented-Control",
|
|
667
|
+
// List and menu components
|
|
668
|
+
"List": "Lists",
|
|
669
|
+
"Menu": "Dropdown-Menu",
|
|
670
|
+
"MenuItem": "Dropdown-Menu",
|
|
671
|
+
"MenuSelect": "Dropdown-Menu",
|
|
672
|
+
// Tag components
|
|
673
|
+
"Tag": "Tags",
|
|
674
|
+
"TagFilter": "Tags",
|
|
675
|
+
// Tooltip components
|
|
676
|
+
"Tooltip": "Tooltips",
|
|
677
|
+
"TooltipCondensed": "Tooltips",
|
|
678
|
+
"TooltipTable": "Tooltips",
|
|
679
|
+
// Table Cell components
|
|
680
|
+
"CellBasic": "Table",
|
|
681
|
+
"CellComponent": "Table",
|
|
682
|
+
"CellHeader": "Table",
|
|
683
|
+
// Filter components
|
|
684
|
+
"ComplexFilter": "Filters",
|
|
685
|
+
// Other components
|
|
686
|
+
"Icon": "Icons",
|
|
687
|
+
"Chip": "Tags",
|
|
688
|
+
// Chips are often similar to tags
|
|
689
|
+
"Pagination": "Navigation"
|
|
690
|
+
// Pagination is often part of navigation
|
|
691
|
+
};
|
|
692
|
+
const mappedFile = componentToFileMap[componentName];
|
|
693
|
+
if (mappedFile && exportedFiles.includes(mappedFile)) {
|
|
694
|
+
return `${mappedFile}.md`;
|
|
695
|
+
}
|
|
696
|
+
if (exportedFiles.includes(componentName)) {
|
|
697
|
+
return `${componentName}.md`;
|
|
698
|
+
}
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
function getExportedFiles() {
|
|
702
|
+
try {
|
|
703
|
+
const possiblePaths = [
|
|
704
|
+
path.join(dirname2, "../../data/zeroheight-exports"),
|
|
705
|
+
// From src/lib in dev
|
|
706
|
+
path.join(dirname2, "../data/zeroheight-exports"),
|
|
707
|
+
// From dist in prod
|
|
708
|
+
path.join(process.cwd(), "data/zeroheight-exports")
|
|
709
|
+
// From current working directory
|
|
710
|
+
];
|
|
711
|
+
let exportDir = "";
|
|
712
|
+
for (const p of possiblePaths) {
|
|
713
|
+
if (fs.existsSync(p)) {
|
|
714
|
+
exportDir = p;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (!exportDir) {
|
|
719
|
+
console.warn("Export directory not found in any expected location. Please run Zeroheight export first.");
|
|
720
|
+
return [];
|
|
721
|
+
}
|
|
722
|
+
const files = fs.readdirSync(exportDir).filter((file) => file.endsWith(".md") && file !== "README.md").map((file) => file.replace(".md", ""));
|
|
723
|
+
return files;
|
|
724
|
+
} catch (error) {
|
|
725
|
+
console.warn("Could not read exported files:", error);
|
|
726
|
+
return [];
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function getComponentsWithDocs(allComponents, exportedFiles) {
|
|
730
|
+
return allComponents.filter((component) => {
|
|
731
|
+
const mappedFile = mapComponentToFile(component, exportedFiles);
|
|
732
|
+
return mappedFile !== null;
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
var getComponentDocsTool = {
|
|
736
|
+
name: "get_component_docs",
|
|
737
|
+
description: "Get design system documentation for a specific component. Retrieves the corresponding Zeroheight documentation file for the given component name. Supports all SDS components and maps them to their appropriate documentation files.",
|
|
738
|
+
async ctx() {
|
|
739
|
+
try {
|
|
740
|
+
const componentList = await getAllComponentNames();
|
|
741
|
+
const allComponents = [
|
|
742
|
+
...componentList.components,
|
|
743
|
+
...componentList["data-viz"]
|
|
744
|
+
];
|
|
745
|
+
const exportedFiles = getExportedFiles();
|
|
746
|
+
const componentsWithDocs = getComponentsWithDocs(allComponents, exportedFiles);
|
|
747
|
+
return {
|
|
748
|
+
componentsWithDocs,
|
|
749
|
+
exportedFiles
|
|
750
|
+
};
|
|
751
|
+
} catch (error) {
|
|
752
|
+
throw new Error(
|
|
753
|
+
`Failed to initialize get component docs tool: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
exec(server2, { ctx, name, description }) {
|
|
758
|
+
server2.tool(
|
|
759
|
+
name,
|
|
760
|
+
description,
|
|
761
|
+
{
|
|
762
|
+
component: z.enum(ctx.componentsWithDocs).describe("The name of the SDS component to get documentation for")
|
|
763
|
+
},
|
|
764
|
+
async ({ component }) => {
|
|
765
|
+
try {
|
|
766
|
+
const mappedFile = mapComponentToFile(component, ctx.exportedFiles);
|
|
767
|
+
if (!mappedFile) {
|
|
768
|
+
return {
|
|
769
|
+
content: [
|
|
770
|
+
{
|
|
771
|
+
type: "text",
|
|
772
|
+
text: `No documentation found for component '${component}'. This component may not have design system documentation available.`
|
|
773
|
+
}
|
|
774
|
+
]
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
const possiblePaths = [
|
|
778
|
+
path.join(dirname2, "../../data/zeroheight-exports", mappedFile),
|
|
779
|
+
// From src/lib in dev
|
|
780
|
+
path.join(dirname2, "../data/zeroheight-exports", mappedFile),
|
|
781
|
+
// From dist in prod
|
|
782
|
+
path.join(process.cwd(), "data/zeroheight-exports", mappedFile)
|
|
783
|
+
// From current working directory
|
|
784
|
+
];
|
|
785
|
+
let filePath = "";
|
|
786
|
+
for (const p of possiblePaths) {
|
|
787
|
+
if (fs.existsSync(p)) {
|
|
788
|
+
filePath = p;
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
if (!filePath) {
|
|
793
|
+
throw new Error(`Documentation file ${mappedFile} not found`);
|
|
794
|
+
}
|
|
795
|
+
const documentation = fs.readFileSync(filePath, "utf8");
|
|
796
|
+
return {
|
|
797
|
+
content: [
|
|
798
|
+
{
|
|
799
|
+
type: "text",
|
|
800
|
+
text: `# Documentation for ${component}
|
|
801
|
+
|
|
802
|
+
Source: ${mappedFile}
|
|
803
|
+
|
|
804
|
+
${documentation}`
|
|
805
|
+
}
|
|
806
|
+
]
|
|
807
|
+
};
|
|
808
|
+
} catch (error) {
|
|
809
|
+
return {
|
|
810
|
+
content: [
|
|
811
|
+
{
|
|
812
|
+
type: "text",
|
|
813
|
+
text: `Error reading documentation file for '${component}': ${error instanceof Error ? error.message : "Unknown error"}`
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
};
|
|
635
822
|
|
|
636
823
|
// src/tools/index.ts
|
|
637
824
|
var tools = [
|
|
638
825
|
getComponentPropsTool,
|
|
639
826
|
getComponentPropsStorybookTool,
|
|
827
|
+
getComponentDocsTool,
|
|
640
828
|
listComponentsTool,
|
|
641
829
|
getTailwindTokensTool
|
|
642
830
|
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@czi-sds/mcp",
|
|
3
3
|
"description": "The official MCP server for SDS",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"main": "dist/stdio.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"generate:components-list": "tsx scripts/generate-component-list.ts",
|
|
24
24
|
"generate:component-props": "tsx scripts/generate-component-props.ts",
|
|
25
25
|
"generate:component-props-storybook": "tsx scripts/generate-component-props-from-storybook.ts",
|
|
26
|
-
"generate:
|
|
26
|
+
"generate:zeroheight-export": "tsx scripts/export-zeroheight-pages.ts",
|
|
27
|
+
"generate:all": "yarn generate:tailwind-tokens && yarn generate:components-list && yarn generate:component-props && yarn generate:component-props-storybook && yarn generate:zeroheight-export",
|
|
27
28
|
"prebuild": "yarn generate:all",
|
|
28
29
|
"build": "yarn prebuild && tsup && chmod 755 dist/stdio.js",
|
|
29
30
|
"dev": "tsup --watch",
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"tsx": "^4.20.3",
|
|
63
64
|
"typescript": "^5.9.2"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "c4bbb6751f8efd89ff5b6e560d8aea687cf8a84c"
|
|
66
67
|
}
|