@ncds/ui-admin-mcp 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
@@ -2,12 +2,15 @@
2
2
 
3
3
  You are an agent that builds UI using NCUA (NCDS UI Admin) design system components from NHN Commerce.
4
4
 
5
- ## Absolute Rules
5
+ ## Absolute Rules (VIOLATION = CRITICAL FAILURE)
6
6
 
7
- 1. You MUST generate NCUA component HTML using the render_to_html tool only. Never write HTML/CSS manually.
8
- 2. Do NOT define or guess CSS variables (--ncua-\*), color values, or BEM classes. They are all included in the CDN CSS.
9
- 3. Do NOT write SVG icons manually. Use search_icon or list_icons to find icons.
10
- 4. If an NCUA component exists for the use case, you MUST use it. Do NOT recreate it manually.
7
+ 1. Call ping ONCE at the start of every session before using any other tool. This loads version info and usage rules.
8
+ 2. NEVER define, invent, or guess CSS variables, design tokens, or color values. Use ONLY tokens returned by get_design_tokens. If you write a custom CSS variable (e.g. --custom-anything) or hardcode a hex/rgb value (e.g. #5B5BD6, rgb(91,91,214)), you have FAILED.
9
+ 3. NEVER write SVG icons or icon markup manually. ALL icons MUST come from search_icon or list_icons. If you write a single <svg> tag by hand, you have FAILED.
10
+ 4. NEVER use emoji in generated HTML, CSS, or any output. No exceptions.
11
+ 5. You MUST generate NCUA component HTML using render_to_html or render_to_html_batch only. Never write component HTML/CSS manually.
12
+ 6. If an NCUA component exists for the use case, you MUST use it. Do NOT recreate it manually.
13
+ 7. For custom areas not covered by NCUA, use ONLY tokens from get_design_tokens for all colors, spacing, typography, and shadows. Call get_design_tokens BEFORE writing any custom CSS.
11
14
 
12
15
  ## Required Workflow (follow this order strictly)
13
16
 
@@ -38,7 +41,8 @@ You are an agent that builds UI using NCUA (NCDS UI Admin) design system compone
38
41
 
39
42
  ### Step 3: HTML Generation
40
43
 
41
- - Use **render_to_html** to get the exact HTML for each component
44
+ - When building a page with multiple components, use **render_to_html_batch** to render them all in one call (max 30). This is much more efficient than calling render_to_html repeatedly.
45
+ - For a single component, use **render_to_html**.
42
46
  - Use the returned html as-is. Do NOT modify class names, structure, or attributes.
43
47
 
44
48
  ### Step 4: CDN Inclusion
@@ -3,7 +3,8 @@
3
3
  "You MUST generate component HTML using the render_to_html tool. Never write HTML/CSS manually.",
4
4
  "Use the HTML returned by render_to_html as-is. Do NOT modify class names, structure, or attributes.",
5
5
  "Use search_component to find the right component by Korean/English keywords before building any UI.",
6
- "Use list_components to browse available components by category and choose the appropriate one."
6
+ "Use list_components to browse available components by category and choose the appropriate one.",
7
+ "When building a page with multiple components, use render_to_html_batch to render them all in one call instead of calling render_to_html repeatedly."
7
8
  ],
8
9
  "componentSelection": [
9
10
  "For password fields, you MUST use password-input. The input component is for plain text only.",
@@ -24,6 +24,9 @@
24
24
  "render_to_html": {
25
25
  "description": "Generate exact HTML for an NCUA component with given props. Returns html, appliedProps, defaultsUsed, js, cdn."
26
26
  },
27
+ "render_to_html_batch": {
28
+ "description": "Render multiple NCUA components in a single call (max 30). Pass an array of {name, props} objects. Returns an array of render results. Use this instead of calling render_to_html repeatedly when building a page."
29
+ },
27
30
  "get_design_tokens": {
28
31
  "description": "Get available design tokens (CSS variables) for colors, typography, spacing, and shadows. Use when building custom areas to pick real tokens instead of guessing."
29
32
  }
@@ -37,6 +40,7 @@
37
40
  { "tool": "get_component_props", "description": "Get component props spec" },
38
41
  { "tool": "validate_html", "description": "Validate HTML BEM classes + design system compliance score + auto-fix" },
39
42
  { "tool": "render_to_html", "description": "Props-based dynamic HTML rendering" },
43
+ { "tool": "render_to_html_batch", "description": "Batch render multiple components in one call (max 30)" },
40
44
  { "tool": "get_design_tokens", "description": "Design token (CSS variable) lookup by category" }
41
45
  ]
42
46
  }
package/bin/server.js CHANGED
@@ -23,6 +23,7 @@ const ping_js_1 = require("./tools/ping.js");
23
23
  const listIcons_js_1 = require("./tools/listIcons.js");
24
24
  const searchIcon_js_1 = require("./tools/searchIcon.js");
25
25
  const renderToHtml_js_1 = require("./tools/renderToHtml.js");
26
+ const response_js_1 = require("./utils/response.js");
26
27
  const getDesignTokens_js_1 = require("./tools/getDesignTokens.js");
27
28
  const version_js_1 = require("./version.js");
28
29
  const domEnvironment_js_1 = require("./utils/domEnvironment.js");
@@ -145,6 +146,34 @@ const main = async () => {
145
146
  name,
146
147
  props: props,
147
148
  }));
149
+ server.registerTool('render_to_html_batch', {
150
+ description: descriptions['render_to_html_batch'],
151
+ inputSchema: {
152
+ components: zod_1.z
153
+ .array(zod_1.z.object({
154
+ name: zod_1.z.string().min(1).describe('Component name'),
155
+ props: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional().describe('Component props'),
156
+ }))
157
+ .min(1)
158
+ .max(30)
159
+ .describe('Array of components to render (max 30)'),
160
+ },
161
+ }, ({ components }) => {
162
+ const results = components.map(({ name, props }) => (0, renderToHtml_js_1.renderToHtml)({
163
+ componentMap,
164
+ bundle,
165
+ cdnMeta,
166
+ iconMeta,
167
+ reactRuntime,
168
+ name,
169
+ props: props,
170
+ }));
171
+ const parsed = results.map((r) => {
172
+ const text = r.content[0].text;
173
+ return r.isError ? { error: JSON.parse(text) } : JSON.parse(text);
174
+ });
175
+ return (0, response_js_1.successResponse)(parsed);
176
+ });
148
177
  server.registerTool('get_design_tokens', {
149
178
  description: descriptions['get_design_tokens'],
150
179
  inputSchema: {
@@ -151,7 +151,7 @@ const renderToHtml = (params) => {
151
151
  const userProps = componentData.props ? sanitizeProps(safeProps, componentData.props) : safeProps;
152
152
  const element = reactRuntime.createElement(Component, userProps);
153
153
  const rawHtml = reactRuntime.renderToStaticMarkup(element);
154
- const html = `<!-- ncua:${normalized} -->\n${rawHtml}\n<!-- /ncua:${normalized} -->`;
154
+ const html = `<!-- ncua:${normalized} start -->\n${rawHtml}\n<!-- ncua:${normalized} end -->`;
155
155
  const defaultsUsed = componentData.props ? calcDefaultsUsed(componentData.props, userProps) : {};
156
156
  const react = buildReactOutput(componentData, userProps, iconMeta);
157
157
  const dataVersion = buildDataVersion(cdnMeta, iconMeta);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncds/ui-admin-mcp",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "NCDS UI Admin MCP 서버 — AI 에이전트가 NCUA 컴포넌트를 조회하고 HTML을 검증할 수 있는 MCP 서버",
5
5
  "bin": {
6
6
  "ncua-mcp": "./bin/server.mjs"