flowbite-mcp 1.1.0 → 1.1.2

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.
Files changed (3) hide show
  1. package/README.md +9 -11
  2. package/build/index.js +122 -4
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p>
2
- <a href="https://flowbite.com" >
2
+ <a href="[https://flowbite.com](https://flowbite.com/docs/getting-started/mcp/)" >
3
3
  <img alt="Flowbite - Tailwind CSS components" width="350" src="https://flowbite.s3.amazonaws.com/github/flowbite-mcp-github-2.png">
4
4
  </a><br>
5
5
  Official MCP server for Flowbite to leverage AI for UI creation and theme generation
@@ -14,24 +14,22 @@
14
14
 
15
15
  [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=flowbite&config=eyJlbnYiOnsiRklHTUFfQUNDRVNTX1RPS0VOIjoiWU9VUl9QRVJTT05BTF9GSUdNQV9BQ0NFU1NfVE9LRU4ifSwiY29tbWFuZCI6Im5weCAteSBmbG93Yml0ZS1tY3AifQ%3D%3D)
16
16
 
17
- An MCP server that enables AI assistants to access the [Flowbite](https://flowbite.com/) library of Tailwind CSS components—including UI elements, forms, typography, and plugins—while offering an intelligent theme generator for creating custom branded designs within AI-driven development environments.
17
+ An [MCP server](https://flowbite.com/docs/getting-started/mcp/) that enables AI assistants to access the [Flowbite](https://flowbite.com/) library of Tailwind CSS components—including UI elements, forms, typography, and plugins—while offering an intelligent theme generator for creating custom branded designs within AI-driven development environments.
18
18
 
19
19
  ## MCP Features
20
20
 
21
- ### Resources:
22
-
23
- - **📦 60+ UI Components** - Complete access the [Flowbite Library](https://flowbite.com/docs/getting-started/introduction/) components of buttons, cards, modals, dropdowns, and more
24
-
25
21
  ### Tools:
26
22
 
27
- - **🎯 AI-Powered Theme Generator** - Create custom branded themes from any branded hex color
28
- - **🎨 [NEW] Figma to Code Generator** - Copy the Figma node url and generate code ([video demo](https://x.com/zoltanszogyenyi/status/1996953610966405547))
23
+ - **🎨 [NEW] Figma to code** - Copy the Figma node url and generate code ([video demo](https://x.com/zoltanszogyenyi/status/1996953610966405547))
24
+ - **🎯 Theme file generator** - Create custom branded themes from any branded hex color
25
+
26
+ ### Resources:
29
27
 
28
+ - **📦 60+ UI components** - Complete access to the [Flowbite UI components](https://flowbite.com/docs/getting-started/introduction/)
30
29
  ### Server:
31
30
 
32
- - **🌐 Dual Transport Support** - Standard I/O (stdio) for CLI or HTTP Streamable for server deployments
33
- - **⚡ Production Ready** - Docker support with health checks and monitoring
34
- - **🎨 Quickstart Guide** - Complete setup and integration documentation
31
+ - **🌐 Dual transport support** - Standard I/O (stdio) for CLI or HTTP Streamable for server deployments
32
+ - **⚡ Production ready** - Docker support with health checks and monitoring
35
33
 
36
34
  ## Quickstart
37
35
 
package/build/index.js CHANGED
@@ -744,6 +744,122 @@ Node data was retrieved successfully.`,
744
744
  const imageData = await imageResponse.json();
745
745
  // Extract the image URL from the response
746
746
  const imageUrl = imageData.images?.[nodeId] || imageData.images?.[Object.keys(imageData.images)[0]] || null;
747
+ // Helper function to simplify Figma node data - extracts only essential info for code conversion
748
+ const simplifyNode = (node) => {
749
+ if (!node)
750
+ return null;
751
+ const simplified = {
752
+ type: node.type,
753
+ name: node.name,
754
+ };
755
+ // Add dimensions if available
756
+ if (node.absoluteBoundingBox) {
757
+ simplified.size = {
758
+ width: Math.round(node.absoluteBoundingBox.width),
759
+ height: Math.round(node.absoluteBoundingBox.height),
760
+ };
761
+ }
762
+ // Add layout info for frames
763
+ if (node.layoutMode) {
764
+ simplified.layout = {
765
+ mode: node.layoutMode, // HORIZONTAL, VERTICAL, NONE
766
+ padding: node.paddingLeft || node.paddingTop ? {
767
+ top: node.paddingTop,
768
+ right: node.paddingRight,
769
+ bottom: node.paddingBottom,
770
+ left: node.paddingLeft,
771
+ } : undefined,
772
+ gap: node.itemSpacing,
773
+ align: node.primaryAxisAlignItems,
774
+ justify: node.counterAxisAlignItems,
775
+ };
776
+ }
777
+ // Add corner radius
778
+ if (node.cornerRadius) {
779
+ simplified.borderRadius = node.cornerRadius;
780
+ }
781
+ else if (node.rectangleCornerRadii) {
782
+ simplified.borderRadius = node.rectangleCornerRadii;
783
+ }
784
+ // Add fills (background colors)
785
+ if (node.fills && node.fills.length > 0) {
786
+ simplified.fills = node.fills
787
+ .filter((fill) => fill.visible !== false)
788
+ .map((fill) => ({
789
+ type: fill.type,
790
+ color: fill.color ? {
791
+ r: Math.round(fill.color.r * 255),
792
+ g: Math.round(fill.color.g * 255),
793
+ b: Math.round(fill.color.b * 255),
794
+ a: fill.color.a !== undefined ? Math.round(fill.color.a * 100) / 100 : 1,
795
+ } : undefined,
796
+ opacity: fill.opacity,
797
+ }));
798
+ }
799
+ // Add strokes (borders)
800
+ if (node.strokes && node.strokes.length > 0) {
801
+ simplified.strokes = node.strokes
802
+ .filter((stroke) => stroke.visible !== false)
803
+ .map((stroke) => ({
804
+ type: stroke.type,
805
+ color: stroke.color ? {
806
+ r: Math.round(stroke.color.r * 255),
807
+ g: Math.round(stroke.color.g * 255),
808
+ b: Math.round(stroke.color.b * 255),
809
+ } : undefined,
810
+ }));
811
+ if (node.strokeWeight) {
812
+ simplified.strokeWeight = node.strokeWeight;
813
+ }
814
+ }
815
+ // Add effects (shadows, blur)
816
+ if (node.effects && node.effects.length > 0) {
817
+ simplified.effects = node.effects
818
+ .filter((effect) => effect.visible !== false)
819
+ .map((effect) => ({
820
+ type: effect.type,
821
+ radius: effect.radius,
822
+ offset: effect.offset,
823
+ color: effect.color ? {
824
+ r: Math.round(effect.color.r * 255),
825
+ g: Math.round(effect.color.g * 255),
826
+ b: Math.round(effect.color.b * 255),
827
+ a: Math.round(effect.color.a * 100) / 100,
828
+ } : undefined,
829
+ }));
830
+ }
831
+ // Add text-specific properties
832
+ if (node.type === 'TEXT') {
833
+ simplified.text = node.characters;
834
+ if (node.style) {
835
+ simplified.textStyle = {
836
+ fontFamily: node.style.fontFamily,
837
+ fontWeight: node.style.fontWeight,
838
+ fontSize: node.style.fontSize,
839
+ lineHeight: node.style.lineHeightPx,
840
+ letterSpacing: node.style.letterSpacing,
841
+ textAlign: node.style.textAlignHorizontal,
842
+ };
843
+ }
844
+ }
845
+ // Recursively process children
846
+ if (node.children && node.children.length > 0) {
847
+ simplified.children = node.children.map(simplifyNode).filter(Boolean);
848
+ }
849
+ return simplified;
850
+ };
851
+ // Simplify the node data
852
+ const simplifiedNodeData = nodeData.nodes ?
853
+ Object.keys(nodeData.nodes).reduce((acc, key) => {
854
+ const node = nodeData.nodes[key];
855
+ acc[key] = {
856
+ document: simplifyNode(node.document),
857
+ components: node.components ? Object.keys(node.components).length + ' components' : undefined,
858
+ styles: node.styles ? Object.keys(node.styles).length + ' styles' : undefined,
859
+ };
860
+ return acc;
861
+ }, {})
862
+ : simplifyNode(nodeData);
747
863
  // Return combined result with AI instructions
748
864
  return {
749
865
  content: [
@@ -834,15 +950,17 @@ Generate clean, semantic HTML with Tailwind CSS classes following these guidelin
834
950
  - **Source URL**: ${figmaNodeUrl}
835
951
 
836
952
  ### Rendered Design Image
837
- ${imageUrl ? `![Figma Design](${imageUrl})
953
+ ${imageUrl ? `
954
+
955
+ <img src="${imageUrl}">
838
956
 
839
957
  **Direct Image URL**: ${imageUrl}` : '⚠️ No image URL available - analyze the node data structure below'}
840
958
 
841
- ### Node Structure Data
842
- The following JSON contains the Figma node structure with layers, styles, and properties:
959
+ ### Node Structure Data (Simplified)
960
+ The following JSON contains the essential Figma node structure for code conversion:
843
961
 
844
962
  \`\`\`json
845
- ${JSON.stringify(nodeData, null, 2)}
963
+ ${JSON.stringify(simplifiedNodeData, null, 2)}
846
964
  \`\`\`
847
965
 
848
966
  ---
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "flowbite-mcp",
3
- "version": "1.1.0",
4
- "description": "Model Context Protocol server providing AI assistants with access to Flowbite UI components and an intelligent theme generator for Tailwind CSS",
3
+ "version": "1.1.2",
4
+ "mcpName": "io.github.themesberg/flowbite-mcp",
5
+ "description": "MCP server to convert Figma designs to Flowbite UI components in Tailwind CSS",
5
6
  "main": "build/index.js",
6
7
  "type": "module",
7
8
  "bin": {
8
- "flowbite-mcp": "./build/index.js"
9
+ "flowbite-mcp": "build/index.js"
9
10
  },
10
11
  "files": [
11
12
  "build",