viewgate-mcp 1.0.51 → 1.0.52

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 +40 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -401,6 +401,34 @@ function createMcpServer(apiKey, personalKey) {
401
401
  case "generate_ui_components": {
402
402
  const args = argsAny;
403
403
  const limit = Math.min(args.limit || 1, 10);
404
+ // Fetch project styleHandler from config
405
+ let styleHandler = 'css';
406
+ try {
407
+ const configRes = await fetch(`${BACKEND_URL}/api/mcp/config`, {
408
+ headers: {
409
+ 'x-api-key': apiKey,
410
+ 'x-mcp-tool-name': 'generate_ui_components',
411
+ ...(personalKey ? { 'x-personal-key': personalKey } : {})
412
+ }
413
+ });
414
+ if (configRes.ok) {
415
+ const configData = (await configRes.json());
416
+ styleHandler = configData?.settings?.styleHandler || 'css';
417
+ }
418
+ }
419
+ catch (e) {
420
+ console.error('[MCP] Could not fetch project config for styleHandler:', e);
421
+ }
422
+ const styleHandlerLabels = {
423
+ 'css': 'Plain CSS (vanilla, no framework dependencies)',
424
+ 'sass': 'SASS/SCSS (use .scss syntax conventions in comments, output as CSS-in-string or inline styles for compatibility)',
425
+ 'tailwind': 'Tailwind CSS (use Tailwind utility classes exclusively for all styling)',
426
+ 'css-modules': 'CSS Modules (import styles from a separate .module.css file; use styles.className pattern)',
427
+ 'css-in-js': 'CSS-in-JS / styled-components (define all styles as JS template literals using styled.div`...` pattern)',
428
+ 'bootstrap': 'Bootstrap 5 (use Bootstrap class names exclusively; no custom CSS unless necessary)',
429
+ 'mui': 'Material UI / MUI v5 (use @mui/material components and sx prop for styling; avoid raw CSS)',
430
+ };
431
+ const styleLabel = styleHandlerLabels[styleHandler] ?? styleHandler;
404
432
  const fetchUrl = new URL(`${BACKEND_URL}/api/mcp/components`);
405
433
  fetchUrl.searchParams.append("limit", limit.toString());
406
434
  fetchUrl.searchParams.append("status", "pending");
@@ -433,12 +461,20 @@ function createMcpServer(apiKey, personalKey) {
433
461
  htmlContent: item.htmlContent,
434
462
  cssContent: item.cssContent,
435
463
  sourceType: item.sourceType,
464
+ stylingTechnology: {
465
+ handler: styleHandler,
466
+ 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
+ },
436
468
  constraints: {
437
469
  mustBeFunctional: true,
438
470
  mustSupportRequiredProps: true,
439
471
  mustSupportCommonProps: true,
440
472
  avoidBreakingChanges: true,
441
- useProvidedHtmlAndCssIfAvailable: true
473
+ useProvidedHtmlAndCssIfAvailable: true,
474
+ mustBeGeneric: true,
475
+ mustBeProductionReady: true,
476
+ mustUseFramerMotionForAnimations: true,
477
+ stylingHandlerIsStrict: true
442
478
  }
443
479
  };
444
480
  results.push({
@@ -447,6 +483,7 @@ function createMcpServer(apiKey, personalKey) {
447
483
  requiredProps,
448
484
  commonProps,
449
485
  db: item._id,
486
+ styleHandler,
450
487
  llmInstruction
451
488
  });
452
489
  }
@@ -456,7 +493,8 @@ function createMcpServer(apiKey, personalKey) {
456
493
  text: JSON.stringify({
457
494
  ok: true,
458
495
  generated: 0,
459
- instruction: "IMPORTANTE: Este tool NO debe generar código ni escribir archivos. Solo entrega al LLM la especificación (componentType + props) para que el LLM implemente un componente real y funcional en el repo.",
496
+ styleHandler,
497
+ instruction: `IMPORTANTE: Este tool NO debe generar código ni escribir archivos. Solo entrega al LLM la especificación (componentType + props + stylingTechnology) para que el LLM implemente un componente GENÉRICO, reutilizable y listo para producción. OBLIGATORIO: usar ${styleLabel} para todos los estilos.`,
460
498
  results
461
499
  }, null, 2)
462
500
  }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"