viewgate-mcp 1.0.52 → 1.0.53

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 (2) hide show
  1. package/dist/index.js +33 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -429,6 +429,17 @@ function createMcpServer(apiKey, personalKey) {
429
429
  'mui': 'Material UI / MUI v5 (use @mui/material components and sx prop for styling; avoid raw CSS)',
430
430
  };
431
431
  const styleLabel = styleHandlerLabels[styleHandler] ?? styleHandler;
432
+ // Per-handler theming guidance so the LLM generates theme-aware components
433
+ const themingByHandler = {
434
+ 'css': `Use CSS custom properties for all colors. Read theme values like: const primary = theme?.primary || 'var(--vg-primary)'. Apply them inline or inject a <style> block using these variables. Never hardcode colors.`,
435
+ 'sass': `Use CSS custom properties as values. Resolve theme at runtime: const primary = theme?.primary || 'var(--vg-primary)'. Apply via inline style or injected <style>.`,
436
+ 'css-modules': `CSS Modules can use CSS vars. In JS: const primary = theme?.primary || 'var(--vg-primary)'. Pass primary as CSS var via style={{ '--component-primary': primary }} on the root element and reference it inside the .module.css.`,
437
+ 'tailwind': `Use Tailwind's arbitrary value syntax for theme colors: className={\`bg-[\${theme?.primary || 'var(--vg-primary)'}]\`}. For text and borders follow the same pattern. Never use fixed Tailwind color classes like text-blue-500.`,
438
+ 'css-in-js': `In styled-components template literals, read the theme prop: color: \${({ theme: t }) => t?.primary || 'var(--vg-primary)'}. Accept the full theme object via props and propagate it through styled-components ThemeProvider if needed.`,
439
+ 'bootstrap': `Override Bootstrap CSS vars on the root element: style={{ '--bs-primary': theme?.primary || 'var(--vg-primary)' }}. Use btn-primary, text-primary etc. classes which will inherit the overridden variable.`,
440
+ 'mui': `Use createTheme({ palette: { primary: { main: theme?.primary || 'var(--vg-primary)' } } }) inside the component and wrap with ThemeProvider. Accept the theme prop and recreate the MUI theme from it.`,
441
+ };
442
+ const themingInstruction = themingByHandler[styleHandler] ?? themingByHandler['css'];
432
443
  const fetchUrl = new URL(`${BACKEND_URL}/api/mcp/components`);
433
444
  fetchUrl.searchParams.append("limit", limit.toString());
434
445
  fetchUrl.searchParams.append("status", "pending");
@@ -465,6 +476,28 @@ function createMcpServer(apiKey, personalKey) {
465
476
  handler: styleHandler,
466
477
  instruction: `You MUST use ${styleLabel} for ALL styling. Do not mix or use any other styling approach. The component must be fully styled using this technology and be production-ready.`
467
478
  },
479
+ themingTokens: {
480
+ description: 'The component MUST accept an optional `theme` prop for color customization. This is the primary mechanism for users to apply their own brand colors via a JSON file in their project.',
481
+ propInterface: {
482
+ primary: 'string — main brand/accent color (buttons, links, active states)',
483
+ primaryHover: 'string — hover state of primary, slightly darker',
484
+ primaryLight: 'string — light tint of primary for backgrounds (10% opacity)',
485
+ surface: 'string — card/panel background color',
486
+ surfaceAlt: 'string — alternative surface for inputs/hover states',
487
+ border: 'string — border and divider color',
488
+ text: 'string — primary text color',
489
+ textMuted: 'string — secondary/muted text color',
490
+ radius: 'string — base border radius (e.g. "8px", "12px")',
491
+ },
492
+ fallbackMechanism: 'When theme prop is not provided, fall back to CSS custom properties: var(--vg-primary), var(--vg-surface), etc. This allows the ViewGate dashboard preview (which injects CSS vars) and custom ThemeProviders to work without explicit props.',
493
+ handlerSpecificInstruction: themingInstruction,
494
+ criticalRules: [
495
+ 'NEVER hardcode any color value (no #hex, no rgb(), no named colors like blue/red)',
496
+ 'ALWAYS prefer theme prop values first, then var(--vg-*) CSS vars as fallback',
497
+ 'The theme prop must be optional — component must work without it using CSS var fallbacks',
498
+ 'Expose the theme prop explicitly in the component TypeScript/PropTypes interface',
499
+ ]
500
+ },
468
501
  constraints: {
469
502
  mustBeFunctional: true,
470
503
  mustSupportRequiredProps: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"