gemini-design-mcp 2.1.0 → 3.0.1

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/build/index.js CHANGED
@@ -1,90 +1,243 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { generateFrontendSchema, generateFrontend } from "./tools/generate-frontend.js";
4
+ import { createFrontendSchema, createFrontend } from "./tools/create-frontend.js";
5
+ import { modifyFrontendSchema, modifyFrontend } from "./tools/modify-frontend.js";
6
+ import { snippetFrontendSchema, snippetFrontend } from "./tools/snippet-frontend.js";
5
7
  // Create MCP server
6
8
  const server = new McpServer({
7
9
  name: "gemini-design-mcp",
8
- version: "2.0.0",
10
+ version: "3.0.1",
9
11
  });
10
- // Tool: generate_frontend
11
- server.tool("generate_frontend", `Generate premium, production-ready frontend code with Gemini's 1M context window.
12
+ // =============================================================================
13
+ // TOOL 1: CREATE_FRONTEND
14
+ // =============================================================================
15
+ server.tool("create_frontend", `Create a NEW, complete frontend file with PREMIUM DESIGN quality.
12
16
 
13
- ⚠️ CRITICAL: DO NOT call this tool immediately. Follow this flow STRICTLY:
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ 🎯 WHEN TO USE THIS TOOL
19
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20
+
21
+ This tool is for creating NEW files that need HIGH-QUALITY DESIGN.
22
+ Gemini excels at visual design, layout, and premium UI aesthetics.
23
+
24
+ ✅ USE THIS TOOL FOR:
25
+ • "Create a pricing page with 3 tiers" → Complex layout + design decisions
26
+ • "Create a dashboard with charts and stats" → Premium UI needed
27
+ • "Create a landing page for a SaaS" → Visual impact matters
28
+ • "Create a settings page" → Full page design
29
+ • "Create a user profile component" → Polished UI component
30
+
31
+ ❌ DO NOT USE THIS TOOL FOR:
32
+ • Creating utility functions → You can do this yourself
33
+ • Creating simple TypeScript types → You can do this yourself
34
+ • Creating config files → You can do this yourself
35
+ • Creating files that don't need design → You can do this yourself
36
+
37
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
38
+ ⚠️ CRITICAL: MANDATORY FLOW BEFORE CALLING
39
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
40
+
41
+ STEP 1: CHECK PROJECT STATE
42
+ ─────────────────────────────
43
+ A) EMPTY REPO (no package.json, no framework):
44
+ → DO NOT call any tool yet
45
+ → Ask user: "What tech stack do you want?"
46
+ → Help them initialize the project first
47
+
48
+ B) PROJECT EXISTS but NO frontend files/design yet:
49
+ → Proceed to Step 2 (Vibe Selection) - MANDATORY
50
+
51
+ C) PROJECT EXISTS with existing frontend code:
52
+ → Analyze existing files to understand design system
53
+ → Pass relevant files as context parameter
54
+ → Skip vibe selection (use existing design)
55
+
56
+ STEP 2: VIBE SELECTION (Required for new designs)
57
+ ──────────────────────────────────────────────────
58
+ If the project has no existing design system, you MUST run vibe selection:
59
+
60
+ 1. Generate 5 vibe options with RICH, EVOCATIVE descriptions (2-3 sentences each):
61
+
62
+ 🏛️ "Pristine Museum"
63
+ An ultra-clean, 'white-cube' aesthetic focused on vast negative space and
64
+ absolute stillness. Content displayed like art in a modern gallery.
65
+ Minimal chrome, maximum breathing room, typography as sculpture.
66
+
67
+ ⚡ "Technical Precision"
68
+ A layout-driven vibe emphasizing the grid and intentional structure.
69
+ Sharp edges, monospace accents, blueprint energy. Feels slightly
70
+ 'under construction' in a cool, architectural way.
71
+
72
+ 🌊 "Fluid & Organic"
73
+ Soft curves, flowing gradients, and natural movement throughout.
74
+ Like water or silk, everything feels smooth and interconnected.
75
+ Calming yet sophisticated, with gentle animations.
76
+
77
+ 🔥 "Bold & Unapologetic"
78
+ High contrast, oversized typography, dramatic color blocks.
79
+ Demands attention and makes a statement. Not for the faint of heart.
80
+ Strong visual hierarchy, impactful first impressions.
81
+
82
+ 🌙 "Dark Luxe"
83
+ Deep, rich darks with subtle metallic or jewel-tone accents.
84
+ Premium feel, like a high-end app at night. Sophisticated shadows,
85
+ glowing highlights, and refined micro-interactions.
86
+
87
+ 2. Present vibes to user, wait for selection
88
+ 3. Call this tool with designSystem.vibe filled
89
+
90
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91
+ 📤 OUTPUT
92
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
93
+
94
+ Returns a COMPLETE file with:
95
+ - All necessary imports
96
+ - Premium, polished UI design
97
+ - Proper exports
98
+ - Ready to save directly to filePath`, createFrontendSchema, createFrontend);
99
+ // =============================================================================
100
+ // TOOL 2: MODIFY_FRONTEND
101
+ // =============================================================================
102
+ server.tool("modify_frontend", `Redesign or significantly improve the VISUAL DESIGN of an existing file.
103
+
104
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
105
+ 🎯 THIS TOOL IS FOR DESIGN CHANGES, NOT CODE LOGIC
106
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
107
+
108
+ Gemini is a DESIGN specialist. Use this tool when the visual design needs work.
109
+
110
+ ✅ USE THIS TOOL FOR (design changes):
111
+ • "The sidebar looks ugly, redesign it" → Full visual redesign
112
+ • "Make this page look more premium/modern" → Design quality upgrade
113
+ • "This component looks dated, refresh the design" → Visual refresh
114
+ • "Redesign the header with a better layout" → Layout + design
115
+ • "The cards look boring, make them more visually appealing" → Design improvement
116
+
117
+ ❌ DO NOT USE THIS TOOL FOR (you can do these yourself):
118
+ • "Make the sidebar collapsible" → Logic change, just add useState + animation
119
+ • "Change the background to blue" → Just change bg-zinc-900 to bg-blue-900
120
+ • "Add a loading spinner" → Simple code addition
121
+ • "Add onClick handler" → Just code, no design needed
122
+ • "Fix the TypeScript error" → Not a design task
123
+ • "Add dark mode toggle" → Logic, not design
124
+ • "Make it responsive" → You can add breakpoints yourself
125
+
126
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
127
+ 💡 DECISION GUIDE: Should I use this tool?
128
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
129
+
130
+ Ask yourself: "Does this require VISUAL DESIGN expertise?"
131
+
132
+ | User says... | Use this tool? | Why |
133
+ |---------------------------------------|----------------|------------------------------|
134
+ | "Redesign the sidebar" | ✅ YES | Visual design needed |
135
+ | "Make it look more premium" | ✅ YES | Design quality improvement |
136
+ | "The UI looks bad, fix it" | ✅ YES | Design expertise needed |
137
+ | "Make the sidebar collapsible" | ❌ NO | Just logic (useState) |
138
+ | "Change background color" | ❌ NO | One class change |
139
+ | "Add a button" | ❌ NO | Simple code addition |
140
+ | "Add hover effects" | ❌ NO | Just add hover: classes |
141
+ | "Center this div" | ❌ NO | Just flex + items-center |
14
142
 
15
143
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
- STEP 1: CHECK PROJECT STATE (before ANY tool call)
144
+ ⚠️ REQUIRED BEFORE CALLING
17
145
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
146
 
19
- A) EMPTY REPO (no package.json, no framework installed):
20
- DO NOT call this tool
21
- → Ask user: "What tech stack do you want? (Next.js, React + Vite, Vue, etc.)"
22
- Wait for user to initialize the project first
23
- Only proceed after project is set up
147
+ 1. READ THE EXISTING FILE FIRST
148
+ Pass the complete file content as existingCode parameter.
149
+
150
+ 2. BE SPECIFIC ABOUT THE DESIGN PROBLEM
151
+ Good: "The sidebar looks outdated, redesign with modern aesthetics, better spacing"
152
+ Bad: "Fix the sidebar"
24
153
 
25
- B) PROJECT INITIALIZED but NO existing pages/components/design:
26
- DO NOT call this tool yet
27
- → MANDATORY: Run vibe selection questionnaire first (see Step 2)
154
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
+ 📤 OUTPUT
156
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
28
157
 
29
- C) PROJECT WITH EXISTING CODE:
30
- First, analyze the codebase to understand:
31
- Tech stack (React? Vue? Next.js? Tailwind? CSS Modules?)
32
- Project structure (where to put pages/components)
33
- Existing design patterns (colors, spacing, component style)
34
- Then pass relevant files as context parameter
158
+ Returns the COMPLETE modified file:
159
+ - Ready to replace the original file
160
+ - Design improvements applied
161
+ - All functionality preserved`, modifyFrontendSchema, modifyFrontend);
162
+ // =============================================================================
163
+ // TOOL 3: SNIPPET_FRONTEND
164
+ // =============================================================================
165
+ server.tool("snippet_frontend", `Generate a NEW UI component/section to INSERT into an existing file.
35
166
 
36
167
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37
- STEP 2: VIBE SELECTION (required for new designs)
168
+ 🎯 THIS TOOL IS FOR ADDING NEW DESIGNED UI ELEMENTS
38
169
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39
170
 
40
- If the project has no existing design system, you MUST:
171
+ Use this when you need to ADD a new UI element that requires design quality.
41
172
 
42
- 1. Generate 5 vibe options with RICH, EVOCATIVE descriptions (2-3 sentences each).
43
- Each vibe should paint a vivid picture of the aesthetic. Examples:
173
+ USE THIS TOOL FOR (new designed UI to insert):
174
+ "Add a sidebar to this dashboard" New designed component to insert
175
+ • "Add a stats section with charts" → Complex UI element
176
+ • "Add a pricing table" → Designed component
177
+ • "Add a testimonials carousel" → Needs visual design
178
+ • "Add a feature comparison grid" → Complex layout + design
44
179
 
45
- 🏛️ "Pristine Museum" - An ultra-clean, 'white-cube' aesthetic focused on
46
- vast negative space and absolute stillness. The focus is entirely on the
47
- content as if it were hanging in a modern gallery. Minimal chrome,
48
- maximum breathing room.
180
+ DO NOT USE THIS TOOL FOR (you can do these yourself):
181
+ "Add a button" Too simple, just write the button
182
+ "Add a loading spinner" Simple, do it yourself
183
+ "Add an onClick handler" → Just code, no design
184
+ • "Add a useState hook" → Logic, not design
185
+ • "Add an import statement" → Just code
49
186
 
50
- • ⚡ "Technical Precision" - A layout-driven vibe that emphasizes the grid.
51
- It feels intentional, structured, and slightly 'under construction' in a
52
- cool, architectural way. Sharp edges, monospace accents, blueprint energy.
187
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
188
+ 💡 DECISION GUIDE: snippet_frontend vs modify_frontend
189
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
53
190
 
54
- 🌊 "Fluid & Organic" - Soft curves, flowing gradients, and a sense of
55
- natural movement. Like water or silk, everything feels smooth and
56
- interconnected. Calming yet sophisticated.
191
+ | Situation | Tool |
192
+ |----------------------------------------------|-------------------|
193
+ | Adding NEW UI element to a file | snippet_frontend |
194
+ | Redesigning EXISTING UI in a file | modify_frontend |
195
+ | Creating a NEW file entirely | create_frontend |
57
196
 
58
- • 🔥 "Bold & Unapologetic" - High contrast, oversized typography, and
59
- dramatic color blocks. It demands attention and makes a statement.
60
- Not for the faint of heart.
197
+ Example:
198
+ - Dashboard.tsx exists with header + main content
199
+ - User: "Add a sidebar" → snippet_frontend (adding NEW element)
200
+ - User: "Redesign the header" → modify_frontend (changing EXISTING element)
61
201
 
62
- • 🌙 "Dark Luxe" - Deep, rich darks with subtle metallic or jewel-tone
63
- accents. Premium feel, like a high-end app at night. Sophisticated
64
- shadows and glowing highlights.
202
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
203
+ ⚠️ REQUIRED: INSERTION CONTEXT
204
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
205
+
206
+ The insertionContext parameter tells Gemini WHERE and HOW to match the design:
65
207
 
66
- 2. Present the 5 vibes to the user and wait for their selection
208
+ Good example:
209
+ "Inside Dashboard component's return, after <Header />.
210
+ Uses Tailwind with dark theme (bg-zinc-900, text-zinc-100).
211
+ Existing components use rounded-xl, p-6 padding, shadow-lg.
212
+ State managed with useState."
67
213
 
68
- 3. Only THEN call this tool with the designSystem.vibe parameter filled
69
- (Gemini will choose the best font to match the vibe automatically)
214
+ Bad example:
215
+ "In the dashboard"
70
216
 
71
217
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
- STEP 3: CALL THIS TOOL
218
+ 📤 OUTPUT FORMAT
73
219
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
220
 
75
- Only after completing the above steps:
76
- - New project: context=null, designSystem={vibe}, techStack specified
77
- - Existing project: context=<relevant files>, techStack from analysis
221
+ Returns snippet with optional new imports:
222
+
223
+ // NEW IMPORTS NEEDED:
224
+ import { useState } from "react";
225
+
226
+ // SNIPPET:
227
+ <Sidebar className="...">
228
+ ...
229
+ </Sidebar>
78
230
 
79
- CAPABILITIES:
80
- - Creates visually stunning, feature-rich interfaces (not wireframes)
81
- - Supports any tech stack: React, Vue, Svelte, HTML/CSS, Next.js, etc.
82
- - Maintains design consistency when given project context`, generateFrontendSchema, generateFrontend);
83
- // Start server
231
+ You are responsible for:
232
+ - Merging new imports with existing ones
233
+ - Inserting the snippet at the correct location`, snippetFrontendSchema, snippetFrontend);
234
+ // =============================================================================
235
+ // START SERVER
236
+ // =============================================================================
84
237
  async function main() {
85
238
  const transport = new StdioServerTransport();
86
239
  await server.connect(transport);
87
- console.error("gemini-design-mcp v2.0.0 running on stdio");
240
+ console.error("gemini-design-mcp v3.0.1 running on stdio");
88
241
  }
89
242
  main().catch((error) => {
90
243
  console.error("Fatal error:", error);
@@ -1 +1,3 @@
1
- export declare const GENERATE_FRONTEND_PROMPT = "You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.\n\nDESIGN EXCELLENCE REQUIREMENTS:\n\n1. **MAXIMUM DETAIL AND DENSITY**\n - The interface MUST be densely populated and feature-rich\n - NEVER produce simple wireframes, empty containers, or placeholder content\n - Fill the space with intricate details, realistic content, background elements, and meaningful UI components\n - Every section should feel like a fully finished, polished product\n\n2. **PREMIUM VISUAL STYLING**\n - Apply high-end design principles throughout\n - Use sophisticated styling: nuanced shadows, subtle gradients, refined borders, micro-textures\n - Add depth and dimension with layered elements\n - The aesthetic MUST feel modern, premium, and visually captivating\n - Use professional color palettes with proper contrast and hierarchy\n\n3. **COMPREHENSIVE INTERACTIVITY**\n - Design every element to look tangible and interactive\n - Include visual states: hover effects, focus rings, active states, transitions\n - Buttons should look clickable, inputs should look fillable\n - The interface should feel alive, not static\n\n4. **LAYOUT EXCELLENCE**\n - Use proper visual hierarchy with clear focal points\n - Apply consistent spacing rhythm throughout\n - Ensure the layout breathes - balance density with whitespace\n - Full viewport height designs (min-height: 100vh on body)\n - No awkward gaps or orphaned elements\n\n5. **RESPONSIVE BY DEFAULT**\n - Designs MUST work flawlessly on mobile and desktop\n - Touch-friendly sizing for interactive elements on mobile\n - Stackable grids that adapt naturally to screen size\n\n6. **REALISTIC CONTENT**\n - Use believable placeholder content (real-looking names, dates, numbers)\n - Include appropriate icons, avatars, and imagery\n - Data visualizations should have realistic data points\n - Text should be contextually appropriate, not \"Lorem ipsum\"\n\nTECHNICAL RULES:\n- Return COMPLETE, functional code - never use \"// TODO\", \"...\", or placeholders\n- If CONTEXT is provided, match its design language and component patterns\n- If no context, you have full creative freedom but MUST achieve premium quality\n- Respect the specified tech stack exactly\n- Return ONLY the code, no explanations or markdown fences";
1
+ export declare const CREATE_FRONTEND_PROMPT = "You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.\n\nYOUR TASK: Create a COMPLETE, NEW frontend file.\n\nDESIGN EXCELLENCE REQUIREMENTS:\n\n1. **MAXIMUM DETAIL AND DENSITY**\n - The interface MUST be densely populated and feature-rich\n - NEVER produce simple wireframes, empty containers, or placeholder content\n - Fill the space with intricate details, realistic content, background elements, and meaningful UI components\n - Every section should feel like a fully finished, polished product\n\n2. **PREMIUM VISUAL STYLING**\n - Apply high-end design principles throughout\n - Use sophisticated styling: nuanced shadows, subtle gradients, refined borders, micro-textures\n - Add depth and dimension with layered elements\n - The aesthetic MUST feel modern, premium, and visually captivating\n - Use professional color palettes with proper contrast and hierarchy\n\n3. **COMPREHENSIVE INTERACTIVITY**\n - Design every element to look tangible and interactive\n - Include visual states: hover effects, focus rings, active states, transitions\n - Buttons should look clickable, inputs should look fillable\n - The interface should feel alive, not static\n\n4. **LAYOUT EXCELLENCE**\n - Use proper visual hierarchy with clear focal points\n - Apply consistent spacing rhythm throughout\n - Ensure the layout breathes - balance density with whitespace\n - Full viewport height designs (min-height: 100vh on body)\n - No awkward gaps or orphaned elements\n\n5. **RESPONSIVE BY DEFAULT**\n - Designs MUST work flawlessly on mobile and desktop\n - Touch-friendly sizing for interactive elements on mobile\n - Stackable grids that adapt naturally to screen size\n\n6. **REALISTIC CONTENT**\n - Use believable placeholder content (real-looking names, dates, numbers)\n - Include appropriate icons, avatars, and imagery\n - Data visualizations should have realistic data points\n - Text should be contextually appropriate, not \"Lorem ipsum\"\n\nOUTPUT REQUIREMENTS:\n- Return a COMPLETE file with all necessary imports at the top\n- Include proper exports (default or named as appropriate)\n- The code must be ready to use as-is, no modifications needed\n- Follow the tech stack conventions exactly\n- Return ONLY the code, no explanations or markdown fences";
2
+ export declare const MODIFY_FRONTEND_PROMPT = "You are an elite UI/UX Designer modifying existing frontend code.\n\nYOUR TASK: Modify the provided code according to the user's request while maintaining design excellence.\n\nMODIFICATION PRINCIPLES:\n\n1. **PRESERVE EXISTING DESIGN LANGUAGE**\n - Maintain the existing color palette, typography, and spacing\n - Keep the visual consistency with the rest of the file\n - Don't introduce jarring style changes unless explicitly asked\n\n2. **ENHANCE, DON'T BREAK**\n - Your modifications should improve or extend, not degrade\n - Maintain all existing functionality unless asked to remove it\n - Keep the same code patterns and conventions used in the file\n\n3. **SURGICAL PRECISION**\n - Only change what needs to be changed\n - Don't refactor unrelated parts of the code\n - Preserve imports that are still needed, add new ones as required\n\n4. **QUALITY STANDARD**\n - New elements must match the premium quality of existing code\n - Apply the same level of visual polish to new additions\n - Ensure new interactive elements have proper states (hover, focus, etc.)\n\n5. **STRUCTURAL INTEGRITY**\n - Maintain proper component structure\n - Keep props/state management patterns consistent\n - Ensure the file remains properly typed (if TypeScript)\n\nOUTPUT REQUIREMENTS:\n- Return the COMPLETE modified file (not just the changes)\n- Include ALL original imports plus any new ones needed\n- Maintain the original file structure and export pattern\n- The code must be ready to replace the original file\n- Return ONLY the code, no explanations or markdown fences";
3
+ export declare const SNIPPET_FRONTEND_PROMPT = "You are an elite UI/UX Designer generating a code snippet.\n\nYOUR TASK: Generate a focused code snippet that will be INSERTED into an existing file.\n\nSNIPPET PRINCIPLES:\n\n1. **CONTEXTUAL AWARENESS**\n - The snippet will be inserted into an existing codebase\n - Match the style and patterns described in the context\n - Use consistent naming conventions with the project\n\n2. **SELF-CONTAINED BUT INTEGRABLE**\n - The snippet should work when inserted\n - Include only the imports that are NEW (the agent will merge them)\n - Don't include file-level exports unless specifically asked\n\n3. **PREMIUM QUALITY**\n - Even snippets must have premium visual styling\n - Include hover states, transitions, proper spacing\n - Use realistic placeholder content, not Lorem ipsum\n\n4. **CLEAN BOUNDARIES**\n - Clear start and end of the snippet\n - Proper indentation (assume standard 2-space indent)\n - No trailing commas or syntax that would break insertion\n\n5. **FOCUSED SCOPE**\n - Generate exactly what was asked, nothing more\n - Don't add \"nice to have\" features unless requested\n - Keep the snippet as lean as possible while meeting requirements\n\nOUTPUT REQUIREMENTS:\n- Return ONLY the code snippet\n- If new imports are needed, list them at the very top, clearly separated\n- The snippet should be ready to paste/insert\n- Match the tech stack and patterns from context\n- Return ONLY the code, no explanations or markdown fences\n\nFORMAT (if imports needed):\n// NEW IMPORTS NEEDED:\nimport { X } from \"y\";\n\n// SNIPPET:\n<your code here>";
@@ -1,4 +1,10 @@
1
- export const GENERATE_FRONTEND_PROMPT = `You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.
1
+ // =============================================================================
2
+ // CREATE_FRONTEND PROMPT
3
+ // Used for creating NEW complete files (pages, components, sections)
4
+ // =============================================================================
5
+ export const CREATE_FRONTEND_PROMPT = `You are an elite UI/UX Designer creating production-ready, visually stunning interfaces.
6
+
7
+ YOUR TASK: Create a COMPLETE, NEW frontend file.
2
8
 
3
9
  DESIGN EXCELLENCE REQUIREMENTS:
4
10
 
@@ -39,9 +45,98 @@ DESIGN EXCELLENCE REQUIREMENTS:
39
45
  - Data visualizations should have realistic data points
40
46
  - Text should be contextually appropriate, not "Lorem ipsum"
41
47
 
42
- TECHNICAL RULES:
43
- - Return COMPLETE, functional code - never use "// TODO", "...", or placeholders
44
- - If CONTEXT is provided, match its design language and component patterns
45
- - If no context, you have full creative freedom but MUST achieve premium quality
46
- - Respect the specified tech stack exactly
48
+ OUTPUT REQUIREMENTS:
49
+ - Return a COMPLETE file with all necessary imports at the top
50
+ - Include proper exports (default or named as appropriate)
51
+ - The code must be ready to use as-is, no modifications needed
52
+ - Follow the tech stack conventions exactly
53
+ - Return ONLY the code, no explanations or markdown fences`;
54
+ // =============================================================================
55
+ // MODIFY_FRONTEND PROMPT
56
+ // Used for modifying EXISTING files while preserving design quality
57
+ // =============================================================================
58
+ export const MODIFY_FRONTEND_PROMPT = `You are an elite UI/UX Designer modifying existing frontend code.
59
+
60
+ YOUR TASK: Modify the provided code according to the user's request while maintaining design excellence.
61
+
62
+ MODIFICATION PRINCIPLES:
63
+
64
+ 1. **PRESERVE EXISTING DESIGN LANGUAGE**
65
+ - Maintain the existing color palette, typography, and spacing
66
+ - Keep the visual consistency with the rest of the file
67
+ - Don't introduce jarring style changes unless explicitly asked
68
+
69
+ 2. **ENHANCE, DON'T BREAK**
70
+ - Your modifications should improve or extend, not degrade
71
+ - Maintain all existing functionality unless asked to remove it
72
+ - Keep the same code patterns and conventions used in the file
73
+
74
+ 3. **SURGICAL PRECISION**
75
+ - Only change what needs to be changed
76
+ - Don't refactor unrelated parts of the code
77
+ - Preserve imports that are still needed, add new ones as required
78
+
79
+ 4. **QUALITY STANDARD**
80
+ - New elements must match the premium quality of existing code
81
+ - Apply the same level of visual polish to new additions
82
+ - Ensure new interactive elements have proper states (hover, focus, etc.)
83
+
84
+ 5. **STRUCTURAL INTEGRITY**
85
+ - Maintain proper component structure
86
+ - Keep props/state management patterns consistent
87
+ - Ensure the file remains properly typed (if TypeScript)
88
+
89
+ OUTPUT REQUIREMENTS:
90
+ - Return the COMPLETE modified file (not just the changes)
91
+ - Include ALL original imports plus any new ones needed
92
+ - Maintain the original file structure and export pattern
93
+ - The code must be ready to replace the original file
47
94
  - Return ONLY the code, no explanations or markdown fences`;
95
+ // =============================================================================
96
+ // SNIPPET_FRONTEND PROMPT
97
+ // Used for generating code snippets to INSERT into existing files
98
+ // =============================================================================
99
+ export const SNIPPET_FRONTEND_PROMPT = `You are an elite UI/UX Designer generating a code snippet.
100
+
101
+ YOUR TASK: Generate a focused code snippet that will be INSERTED into an existing file.
102
+
103
+ SNIPPET PRINCIPLES:
104
+
105
+ 1. **CONTEXTUAL AWARENESS**
106
+ - The snippet will be inserted into an existing codebase
107
+ - Match the style and patterns described in the context
108
+ - Use consistent naming conventions with the project
109
+
110
+ 2. **SELF-CONTAINED BUT INTEGRABLE**
111
+ - The snippet should work when inserted
112
+ - Include only the imports that are NEW (the agent will merge them)
113
+ - Don't include file-level exports unless specifically asked
114
+
115
+ 3. **PREMIUM QUALITY**
116
+ - Even snippets must have premium visual styling
117
+ - Include hover states, transitions, proper spacing
118
+ - Use realistic placeholder content, not Lorem ipsum
119
+
120
+ 4. **CLEAN BOUNDARIES**
121
+ - Clear start and end of the snippet
122
+ - Proper indentation (assume standard 2-space indent)
123
+ - No trailing commas or syntax that would break insertion
124
+
125
+ 5. **FOCUSED SCOPE**
126
+ - Generate exactly what was asked, nothing more
127
+ - Don't add "nice to have" features unless requested
128
+ - Keep the snippet as lean as possible while meeting requirements
129
+
130
+ OUTPUT REQUIREMENTS:
131
+ - Return ONLY the code snippet
132
+ - If new imports are needed, list them at the very top, clearly separated
133
+ - The snippet should be ready to paste/insert
134
+ - Match the tech stack and patterns from context
135
+ - Return ONLY the code, no explanations or markdown fences
136
+
137
+ FORMAT (if imports needed):
138
+ // NEW IMPORTS NEEDED:
139
+ import { X } from "y";
140
+
141
+ // SNIPPET:
142
+ <your code here>`;
@@ -1,8 +1,9 @@
1
1
  import { z } from "zod";
2
- export declare const generateFrontendSchema: {
2
+ export declare const createFrontendSchema: {
3
3
  request: z.ZodString;
4
+ filePath: z.ZodString;
5
+ techStack: z.ZodString;
4
6
  context: z.ZodNullable<z.ZodString>;
5
- techStack: z.ZodOptional<z.ZodString>;
6
7
  designSystem: z.ZodOptional<z.ZodObject<{
7
8
  vibe: z.ZodObject<{
8
9
  name: z.ZodString;
@@ -31,10 +32,11 @@ export declare const generateFrontendSchema: {
31
32
  };
32
33
  }>>;
33
34
  };
34
- export declare function generateFrontend(params: {
35
+ export declare function createFrontend(params: {
35
36
  request: string;
37
+ filePath: string;
38
+ techStack: string;
36
39
  context: string | null;
37
- techStack?: string;
38
40
  designSystem?: {
39
41
  vibe: {
40
42
  name: string;
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { generateWithGemini } from "../lib/gemini.js";
3
+ import { CREATE_FRONTEND_PROMPT } from "../prompts/system.js";
4
+ export const createFrontendSchema = {
5
+ request: z.string().describe("What to create: describe the page, component, or section. " +
6
+ "Be specific about functionality and content. " +
7
+ "Example: 'A pricing page with 3 tiers (Basic, Pro, Enterprise) with feature comparison table'"),
8
+ filePath: z.string().describe("The path where this file will be created. " +
9
+ "Example: 'src/components/PricingPage.tsx' or 'app/dashboard/page.tsx'"),
10
+ techStack: z.string().describe("The tech stack to use. Be specific. " +
11
+ "Examples: 'React + TypeScript + Tailwind CSS', 'Next.js 14 App Router + shadcn/ui', 'Vue 3 + Composition API + CSS Modules'"),
12
+ context: z.string().nullable().describe("Existing project code for design consistency. " +
13
+ "Pass relevant files (components, styles, theme config) so Gemini matches your design system. " +
14
+ "Null only if this is the FIRST file in a new project."),
15
+ designSystem: z.object({
16
+ vibe: z.object({
17
+ name: z.string().describe("Vibe name (e.g., 'Pristine Museum', 'Dark Luxe')"),
18
+ description: z.string().describe("Rich, evocative description of the mood (2-3 sentences)"),
19
+ keywords: z.array(z.string()).describe("Style keywords (e.g., ['minimal', 'whitespace', 'gallery'])"),
20
+ }).describe("The selected design vibe"),
21
+ }).optional().describe("Design system with selected vibe. REQUIRED for new projects without existing design. " +
22
+ "The calling agent generates 5 vibe options, user selects, then pass the selection here."),
23
+ };
24
+ export async function createFrontend(params) {
25
+ const { request, filePath, techStack, context, designSystem } = params;
26
+ // Build design system instructions if provided
27
+ let designSystemInstructions = '';
28
+ if (designSystem?.vibe) {
29
+ const { vibe } = designSystem;
30
+ designSystemInstructions = `
31
+ MANDATORY DESIGN SYSTEM (User Selected Vibe):
32
+
33
+ **Design Vibe: "${vibe.name}"**
34
+ ${vibe.description}
35
+
36
+ Keywords to embody: ${vibe.keywords.join(', ')}
37
+
38
+ Interpret this vibe creatively:
39
+ - Choose colors, gradients, and visual styling that embody this atmosphere
40
+ - Select a font from Google Fonts that perfectly matches this vibe
41
+ - Apply consistent visual language throughout the entire interface
42
+ - You have freedom in the specific implementation, but the overall feel MUST match this vibe
43
+ `;
44
+ }
45
+ // Build context instructions
46
+ let contextInstructions = '';
47
+ if (context) {
48
+ contextInstructions = `
49
+ EXISTING PROJECT CONTEXT (match this design system):
50
+ ${context}
51
+
52
+ IMPORTANT: Analyze the existing code carefully and match:
53
+ - Color palette and theme
54
+ - Typography and font choices
55
+ - Component patterns and naming conventions
56
+ - Spacing and layout rhythms
57
+ - Import patterns and file structure
58
+ `;
59
+ }
60
+ const systemPrompt = `${CREATE_FRONTEND_PROMPT}
61
+ ${designSystemInstructions}
62
+ ${contextInstructions}
63
+ TECH STACK: ${techStack}
64
+ FILE PATH: ${filePath}
65
+
66
+ Remember: Return a COMPLETE file ready to save at ${filePath}`.trim();
67
+ const result = await generateWithGemini(systemPrompt, request);
68
+ return {
69
+ content: [{ type: "text", text: result }],
70
+ };
71
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const modifyFrontendSchema: {
3
+ request: z.ZodString;
4
+ filePath: z.ZodString;
5
+ existingCode: z.ZodString;
6
+ context: z.ZodOptional<z.ZodString>;
7
+ };
8
+ export declare function modifyFrontend(params: {
9
+ request: string;
10
+ filePath: string;
11
+ existingCode: string;
12
+ context?: string;
13
+ }): Promise<{
14
+ content: {
15
+ type: "text";
16
+ text: string;
17
+ }[];
18
+ }>;
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { generateWithGemini } from "../lib/gemini.js";
3
+ import { MODIFY_FRONTEND_PROMPT } from "../prompts/system.js";
4
+ export const modifyFrontendSchema = {
5
+ request: z.string().describe("What modification to make. Be specific and clear. " +
6
+ "Examples: " +
7
+ "'Add a delete button with confirmation modal to each card', " +
8
+ "'Change the color scheme from blue to purple', " +
9
+ "'Add loading and error states to this component', " +
10
+ "'Make the sidebar collapsible with animation'"),
11
+ filePath: z.string().describe("The path of the file being modified. " +
12
+ "Example: 'src/components/Sidebar.tsx'"),
13
+ existingCode: z.string().describe("The COMPLETE current content of the file to modify. " +
14
+ "Pass the entire file, not just a snippet. " +
15
+ "Gemini will return the complete modified file."),
16
+ context: z.string().optional().describe("Additional project context if needed for the modification. " +
17
+ "Pass related files if the modification needs to match patterns from elsewhere. " +
18
+ "Optional - only include if relevant to the modification."),
19
+ };
20
+ export async function modifyFrontend(params) {
21
+ const { request, filePath, existingCode, context } = params;
22
+ // Build context instructions
23
+ let contextInstructions = '';
24
+ if (context) {
25
+ contextInstructions = `
26
+ ADDITIONAL PROJECT CONTEXT (for reference):
27
+ ${context}
28
+ `;
29
+ }
30
+ const systemPrompt = `${MODIFY_FRONTEND_PROMPT}
31
+ ${contextInstructions}
32
+ FILE BEING MODIFIED: ${filePath}
33
+
34
+ EXISTING CODE TO MODIFY:
35
+ \`\`\`
36
+ ${existingCode}
37
+ \`\`\`
38
+
39
+ MODIFICATION REQUESTED: ${request}
40
+
41
+ Remember: Return the COMPLETE modified file, ready to replace the original.`.trim();
42
+ const result = await generateWithGemini(systemPrompt, request);
43
+ return {
44
+ content: [{ type: "text", text: result }],
45
+ };
46
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export declare const snippetFrontendSchema: {
3
+ request: z.ZodString;
4
+ targetFile: z.ZodString;
5
+ techStack: z.ZodString;
6
+ insertionContext: z.ZodString;
7
+ context: z.ZodOptional<z.ZodString>;
8
+ };
9
+ export declare function snippetFrontend(params: {
10
+ request: string;
11
+ targetFile: string;
12
+ techStack: string;
13
+ insertionContext: string;
14
+ context?: string;
15
+ }): Promise<{
16
+ content: {
17
+ type: "text";
18
+ text: string;
19
+ }[];
20
+ }>;
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { generateWithGemini } from "../lib/gemini.js";
3
+ import { SNIPPET_FRONTEND_PROMPT } from "../prompts/system.js";
4
+ export const snippetFrontendSchema = {
5
+ request: z.string().describe("What code snippet to generate. Be specific about what you need. " +
6
+ "Examples: " +
7
+ "'A sidebar component with navigation links and user profile section', " +
8
+ "'A data table with sorting, filtering, and pagination', " +
9
+ "'A form validation function for email and password', " +
10
+ "'A custom hook for handling API requests with loading/error states'"),
11
+ targetFile: z.string().describe("The file where this snippet will be inserted. " +
12
+ "Example: 'src/components/Dashboard.tsx' - helps Gemini match the file's patterns"),
13
+ techStack: z.string().describe("The tech stack being used. " +
14
+ "Examples: 'React + TypeScript + Tailwind CSS', 'Vue 3 + Composition API'"),
15
+ insertionContext: z.string().describe("WHERE in the file this snippet will go and surrounding code context. " +
16
+ "This helps Gemini generate code that integrates smoothly. " +
17
+ "Example: 'Inside the Dashboard component, after the header section. " +
18
+ "The file uses useState for state and has a dark theme with zinc colors.'"),
19
+ context: z.string().optional().describe("Additional project files for design/pattern reference. " +
20
+ "Pass components, styles, or utilities that the snippet should match. " +
21
+ "Optional but recommended for consistency."),
22
+ };
23
+ export async function snippetFrontend(params) {
24
+ const { request, targetFile, techStack, insertionContext, context } = params;
25
+ // Build context instructions
26
+ let contextInstructions = '';
27
+ if (context) {
28
+ contextInstructions = `
29
+ PROJECT CONTEXT (match these patterns):
30
+ ${context}
31
+ `;
32
+ }
33
+ const systemPrompt = `${SNIPPET_FRONTEND_PROMPT}
34
+ ${contextInstructions}
35
+ TECH STACK: ${techStack}
36
+ TARGET FILE: ${targetFile}
37
+
38
+ INSERTION CONTEXT:
39
+ ${insertionContext}
40
+
41
+ Generate a snippet that will integrate smoothly at this location.`.trim();
42
+ const result = await generateWithGemini(systemPrompt, request);
43
+ return {
44
+ content: [{ type: "text", text: result }],
45
+ };
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemini-design-mcp",
3
- "version": "2.1.0",
3
+ "version": "3.0.1",
4
4
  "description": "MCP server that uses Gemini 3 Pro for frontend/design code generation",
5
5
  "main": "build/index.js",
6
6
  "bin": {
@@ -1,56 +0,0 @@
1
- import { z } from "zod";
2
- import { generateWithGemini } from "../lib/gemini.js";
3
- import { GENERATE_FRONTEND_PROMPT } from "../prompts/system.js";
4
- export const generateFrontendSchema = {
5
- request: z.string().describe("Description of what to create (component, page, section, etc.)"),
6
- context: z.string().nullable().describe("Existing project code for reference (components, styles, config). " +
7
- "Send relevant files to ensure design consistency. " +
8
- "Null if new project."),
9
- techStack: z.string().optional().describe("Tech stack (e.g., 'React + Tailwind', 'Vue + CSS', 'HTML/CSS vanilla', 'Next.js + shadcn'). " +
10
- "If not specified, Gemini will choose based on context."),
11
- designSystem: z.object({
12
- vibe: z.object({
13
- name: z.string().describe("Vibe name (e.g., 'Pristine Museum', 'Dark Luxe')"),
14
- description: z.string().describe("Rich, evocative description of the mood and aesthetic (2-3 sentences)"),
15
- keywords: z.array(z.string()).describe("Style keywords (e.g., ['minimal', 'whitespace', 'gallery'])"),
16
- }).describe("Selected design vibe from the vibe selection step"),
17
- }).optional().describe("Design system with selected vibe. The calling agent generates vibe options, " +
18
- "user selects, then pass the selection here. Gemini chooses the best font automatically."),
19
- };
20
- export async function generateFrontend(params) {
21
- const { request, context, techStack, designSystem } = params;
22
- // Build design system instructions if provided
23
- let designSystemInstructions = '';
24
- if (designSystem?.vibe) {
25
- const { vibe } = designSystem;
26
- designSystemInstructions = `
27
- MANDATORY DESIGN SYSTEM (User Selected Vibe):
28
-
29
- **Design Vibe: "${vibe.name}"**
30
- ${vibe.description}
31
- Keywords: ${vibe.keywords.join(', ')}
32
-
33
- Interpret this vibe creatively:
34
- - Choose colors, gradients, and visual styling that embody this atmosphere
35
- - Select a font from Google Fonts that perfectly matches this vibe
36
- - Apply consistent visual language throughout the entire interface
37
- - You have freedom in the specific implementation, but the overall feel MUST match this vibe
38
- `;
39
- }
40
- const systemPrompt = `${GENERATE_FRONTEND_PROMPT}
41
- ${designSystemInstructions}
42
- ${techStack ? `TECH STACK: ${techStack}` : ""}`.trim();
43
- const userPrompt = context
44
- ? `PROJECT CONTEXT (match this style):
45
- ${context}
46
-
47
- ---
48
-
49
- REQUEST:
50
- ${request}`
51
- : request;
52
- const result = await generateWithGemini(systemPrompt, userPrompt);
53
- return {
54
- content: [{ type: "text", text: result }],
55
- };
56
- }