@neuctra/ui-mcp 0.4.4 → 0.4.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.
package/README.md CHANGED
@@ -47,7 +47,9 @@ neuctra-ui-mcp/data/components.json (this package's local copy)
47
47
  │
48
48
  │ read once at server startup
49
49
  ▼
50
- neuctra-ui-mcp/src/server.mjs (defines 5 MCP tools over that data)
50
+ neuctra-ui-mcp/src/server.mjs (loads data and composes tool modules)
51
+ │
52
+ └── neuctra-ui-mcp/src/tools/*/ (one folder per MCP tool)
51
53
  │
52
54
  │ spoken over stdio (stdin/stdout), JSON-RPC under the hood
53
55
  ▼
@@ -76,8 +78,10 @@ Three independently-regenerable files feed the server:
76
78
  engine and generative engine optimisation, schema weaving, FAQs, the per-page meta
77
79
  checklist, where metadata goes in each framework plus Next.js metadata gotchas, page
78
80
  templates for tool/category/home pages, site-wide essentials, ads readiness, off-page
79
- and monitoring, and a launch checklist). Served by `get_seo_guide`; the logic behind `generate_page_seo` and
80
- `audit_page_seo` lives in `src/seo.mjs`.
81
+ and monitoring, and a launch checklist). The `neuctra-ui-seo-setup` tool returns the
82
+ complete rules plus framework-specific implementation steps.
83
+ - **`data/layouts.json`** — editable page-layout recipes consumed by
84
+ `neuctra-ui-page-builder`. Add a recipe there to support a new page type.
81
85
 
82
86
  ---
83
87
 
@@ -95,7 +99,7 @@ The host starts your server as a subprocess and talks to it over **stdio** — y
95
99
  server's stdout carries JSON-RPC messages, not human-readable logs (that's why
96
100
  `bin/cli.mjs` prints nothing except protocol traffic; use `console.error`, never
97
101
  `console.log`, if you ever add debug output). On connect, the client asks "what tools do
98
- you have?", gets back the 5 tool definitions below, and adds them to the AI's available
102
+ you have?", gets back the tool definitions below, and adds them to the AI's available
99
103
  actions — the same way the tools listed in *this* conversation's system prompt work.
100
104
  From then on, the AI decides on its own when a tool call would help, calls it, and reads
101
105
  the result back into its context before continuing.
@@ -104,131 +108,76 @@ the result back into its context before continuing.
104
108
 
105
109
  ## 4. Recommended workflow
106
110
 
111
+ For project initialization, call **`neuctra-ui-setup`** first with `action: "analyze"`.
112
+ It detects Next.js, Vite React, Remix, and React Router, then guides a separate setup
113
+ call. Setup can run the Neuctra UI CLI and install `lucide-react`, or return manual
114
+ instructions. Existing supported projects are kept in place; clearing a populated
115
+ directory requires explicit confirmation. An unspecified framework defaults to Next.js
116
+ App Router with JavaScript, Tailwind, and static export.
117
+
107
118
  The tools are designed to be called in roughly this order when generating UI, not
108
119
  grabbed ad hoc:
109
120
 
110
- 1. **`neuctra-ui-builder`** — use this for routine UI generation. It infers the UI
111
- category, returns a focused UX plan, core styling and accessibility rules, relevant
112
- design-guide sections, component candidates, and preference questions when useful.
113
- 2. Ask any high-impact questions returned in `uxPlan.preferenceQuestions`, then pass
114
- answers back through `preferences` if they change the implementation.
115
- 3. **`list_components`** (filtered by category) or **`search_components`** (keyword) —
116
- confirm which real components exist for what you need. This matters specifically
117
- because the design guide can describe a *pattern* (e.g. a sidebar nav item) without
118
- there being a dedicated component for it — don't assume one exists, confirm here.
119
- 4. **`get_component`** — full spec for every unfamiliar component before writing code against it.
120
- Do this every time you touch a component you haven't already pulled specs for in the
121
- current conversation, not just once at the start. Never guess prop names from memory.
122
- 5. **Write the UI**, applying the design rules, the tokens, and the exact props from
123
- step 4.
124
- 6. **Self-check** against the "Final UI Quality Checklist" section (§49, found by
125
- its `number` field in `productDesignGuide.sections` — not by array index) and
126
- `antiAiLookRules` from `get_design_rules` before considering the UI
127
- done — reread them, don't just rely on having read them once at the start.
128
-
129
- 7. **For public pages**, call **`get_seo_guide`** once, then **`generate_page_seo`** for
130
- each page (meta, OpenGraph and a woven JSON-LD graph in the project's framework) and
131
- **`audit_page_seo`** to check the finished page.
132
-
133
- Call `get_design_rules` for broad design reviews or unresolved edge cases, and `get_theme`
121
+ 1. **`neuctra-ui-page-builder`** — describe the page and its goal. It infers the page type,
122
+ selects a recipe from `data/layouts.json`, and combines matching component specs,
123
+ design rules, and framework-specific SEO guidance.
124
+ 2. Resolve any high-impact preferences the builder flags, then implement the returned
125
+ page outline using the exact Neuctra UI imports and props it supplies.
126
+ 3. **Self-check** against the returned responsive, accessibility, and visual rules.
127
+ 4. For detailed component discovery outside a page plan, use **`get-neuctra-ui-component`**.
128
+ 5. For design or SEO reference material, use **`get_design_rules`**,
129
+ **`neuctra-ui-theme-setup`**, or **`neuctra-ui-seo-setup`** as needed.
130
+
131
+ Call `get_design_rules` for broad design reviews or unresolved edge cases, and `neuctra-ui-theme-setup`
134
132
  when the complete token/setup reference is needed. The full guide remains the source of
135
- truth; the builder selects relevant sections for each request.
133
+ truth; `neuctra-ui-page-builder` selects relevant sections for each request.
136
134
 
137
135
  ---
138
136
 
139
- ## 5. The nine tools, in detail
137
+ ## 5. The six tools, in detail
140
138
 
141
- ### `neuctra-ui-builder`
139
+ ### `neuctra-ui-page-builder`
142
140
 
143
- Creates a compact, category-aware brief for the host model. It infers or accepts a UI
144
- category, selects relevant UX rules and component candidates, includes essential Neuctra
145
- styling rules and semantic token names, and asks about visual direction, density, or the
146
- primary action when those preferences are missing. It plans and curates context; the host
147
- model writes the UI. Use `get_component` for exact props before implementing an unfamiliar
148
- component.
141
+ Analyzes the request, infers a page type, and selects its layout recipe from
142
+ `data/layouts.json`. It combines the layout outline with matching full component specs,
143
+ relevant Neuctra UI design rules, and SEO rules/implementation steps for the selected
144
+ framework. Recipes can be edited or added to `layouts.json` without changing tool code.
149
145
 
150
- **Input:** `{ request: string, category?: "auto" | "dashboard" | "landing-page" | "form" | "settings" | "authentication" | "data-table" | "ecommerce" | "documentation" | "custom", preferences?: { visualDirection?, density?, primaryAction?, platform?, audience? } }`
146
+ **Input:** `{ request: string, pageType?: "auto" | layout id, framework?: "auto" | framework id, preferences?: { visualDirection?, density?, primaryAction?, platform?, audience? } }`
151
147
 
152
148
  ```json
153
149
  {
154
- "request": "Build a project dashboard where a team can review activity and invite members.",
155
- "category": "auto",
156
- "preferences": { "density": "balanced", "platform": "responsive" }
150
+ "request": "Build an online image compressor with upload, preview, and download steps.",
151
+ "pageType": "auto",
152
+ "framework": "auto"
157
153
  }
158
154
  ```
159
155
 
160
- ### `list_components`
161
-
162
- Lists every exported component, optionally filtered to one category. Cheap and compact
163
- (no props) — meant for browsing, not for writing code against.
164
-
165
- **Input:** `{ category?: "layout" | "typography" | "form" | "actions" | "data-display" | "feedback" | "overlay" | "navigation" }`
166
-
167
- **Example call → response:**
168
- ```jsonc
169
- // list_components({ category: "form" })
170
- [
171
- { "name": "Calendar", "category": "form", "description": "", "propCount": 9 },
172
- { "name": "Checkbox", "category": "form", "description": "A flexible checkbox component...", "propCount": 29 },
173
- { "name": "DatePicker", "category": "form", "description": "", "propCount": 15 }
174
- // ...
175
- ]
176
- ```
177
-
178
- ### `get_component`
156
+ The result includes page classification and evidence, the chosen section outline,
157
+ component imports/props/examples, relevant design rules, and public-page SEO guidance.
179
158
 
180
- The main tool. Full spec for exactly one component — every prop's name, TypeScript
181
- type, whether it's required, its default value, its JSDoc description if it has one,
182
- and a real usage snippet. The AI is instructed (via the tool's own description) to call
183
- this before writing code against any component it hasn't already used in the
184
- conversation.
185
-
186
- **Input:** `{ name: string }` — exact component name, e.g. `"Input"`, `"CardHeader"`.
187
-
188
- **Example call → response** (trimmed):
189
- ```jsonc
190
- // get_component({ name: "Button" })
191
- {
192
- "name": "Button",
193
- "category": "actions",
194
- "description": "The Button component is a flexible, highly customizable UI primitive...",
195
- "props": [
196
- { "name": "children", "type": "React.ReactNode", "required": false, "default": null,
197
- "description": "Optional so icon-only buttons are possible — pair with `aria-label`." },
198
- { "name": "loading", "type": "boolean", "required": false, "default": "false", "description": "" },
199
- { "name": "variant", "type": "\"default\" | \"outline\" | \"ghost\" | \"secondary\" | \"destructive\" | \"success\" | \"warning\" | \"info\"", "required": false, "default": null, "description": "" }
200
- // ...
201
- ],
202
- "example": "import { Button } from '@neuctra/ui';\n\nfunction BasicExample() {\n return (\n <Button onClick={() => console.log('Button clicked')}>\n Click Me\n </Button>\n );\n}"
203
- }
204
- ```
159
+ ### `get-neuctra-ui-component`
205
160
 
206
- If the name doesn't match, it doesn't just fail — it returns an error result with
207
- substring-matched suggestions (e.g. asking for `"Inpu"` suggests `"Input"`), so the AI
208
- can self-correct instead of giving up.
161
+ One component discovery and retrieval tool for the prebuilt `@neuctra/ui` library. Give
162
+ it a natural-language need such as `"responsive container for a page layout"`,
163
+ `"input fields for a signup form"`, `"product image carousel"`, or `"confirmation drawer"`.
164
+ It ranks matching components and returns each exact package import, full prop spec, and
165
+ documented example. Use `componentName` for an exact component, `category` to narrow or
166
+ browse, and `limit` to control how many full specs are returned.
209
167
 
210
- ### `search_components`
168
+ **Input:** `{ request?: string, componentName?: string, category?: ComponentCategory, limit?: number }`
211
169
 
212
- For when the AI knows what it needs but not the exact name — "date picker", "loading
213
- state", "icon button". Matches against name, category, description, and prop names.
214
-
215
- **Example:**
216
- ```jsonc
217
- // search_components({ query: "date" })
218
- [
219
- { "name": "Calendar", ... },
220
- { "name": "DatePicker", ... },
221
- { "name": "TagInput", ... } // matched because it has an "updatedAt"-style prop, etc.
222
- ]
170
+ ```json
171
+ { "request": "responsive carousel for product images", "limit": 3 }
223
172
  ```
224
173
 
225
- ### `get_theme`
174
+ ### `neuctra-ui-theme-setup`
226
175
 
227
176
  Returns the semantic color token system: the token list itself, a **setup** block
228
177
  pointing the AI at the `@neuctra/ui-cli` `init` command instead of hand-writing token CSS
229
178
  or a theme context, and a **toastNote** explaining the standalone `toast()` import.
230
- Without `get_theme`, an AI would happily write `className="bg-blue-500"`, ignoring the
231
- consumer's actual theme. `get_theme` does **not** carry the design/anti-AI-look rules —
179
+ Without `neuctra-ui-theme-setup`, an AI would happily write `className="bg-blue-500"`, ignoring the
180
+ consumer's actual theme. `neuctra-ui-theme-setup` does **not** carry the design/anti-AI-look rules —
232
181
  see `get_design_rules` below for those; call both together, not one instead of the other.
233
182
 
234
183
  **Response shape:**
@@ -266,7 +215,7 @@ per-component usage guidance (when to reach for `Card` vs plain whitespace, `Mod
266
215
  responsive design, accessibility, interaction design, and a final UI quality checklist.
267
216
 
268
217
  Use this for full-guide reviews and edge cases. For routine generation, use
269
- `neuctra-ui-builder` to retrieve the rules relevant to the request.
218
+ `neuctra-ui-page-builder` to retrieve the layout-specific rules and context.
270
219
 
271
220
  **Response shape (trimmed):**
272
221
  ```jsonc
@@ -295,51 +244,20 @@ Use this for full-guide reviews and edge cases. For routine generation, use
295
244
  }
296
245
  ```
297
246
 
298
- ### `get_seo_guide`
299
-
300
- Returns the SEO / AEO / GEO playbook from `data/seoGuide.json`: the whole guide, or one
301
- topic via `topic` (`technical`, `performance`, `on-page`, `keywords-intent`, `eeat`,
302
- `aeo`, `geo`, `schema`, `faq`, `meta-checklist`, `frameworks`, `page-templates`,
303
- `site-wide`, `ads-readiness`, `off-page-monitoring`, `launch-checklist`).
304
-
305
- ```json
306
- { "topic": "geo" }
307
- ```
308
-
309
- ### `generate_page_seo`
310
-
311
- Deterministic generator (no LLM, never invents facts) for everything one page needs:
312
- a meta title (60 chars max) and description (155 max), canonical, robots, OpenGraph
313
- and Twitter tags, and one JSON-LD `@graph` weaving Organization, WebSite, WebPage,
314
- BreadcrumbList, the page-type node (TechArticle, BlogPosting, SoftwareApplication for
315
- tool and product pages, Product with offers), HowTo (from the visible `steps`), ItemList
316
- (from a category's `items`) and FAQPage together by stable `@id`s (the same scheme as
317
- `neuctra-ui-docs-v2/lib/seo/schemas`). Returns a ready-to-paste snippet for
318
- `nextjs-app`, `nextjs-pages`, `react-vite`, `react-router`, `astro`, `tanstack-start`,
319
- `gatsby` or `html`, plus warnings and AEO/GEO follow-ups.
320
-
321
- ```json
322
- {
323
- "framework": "nextjs-app",
324
- "pageType": "docs",
325
- "siteName": "Neuctra UI",
326
- "siteUrl": "https://ui.neuctra.com",
327
- "path": "/docs/card",
328
- "primaryKeyword": "react card component",
329
- "description": "Composable React card component with header, body and footer sections...",
330
- "faqs": [{ "question": "Does Card support dark mode?", "answer": "Yes. ..." }]
331
- }
332
- ```
247
+ ### `neuctra-ui-seo-setup`
333
248
 
334
- ### `audit_page_seo`
249
+ Returns the complete SEO/AEO/GEO rules and practical implementation steps from
250
+ `data/seoGuide.json`. The JSON contains two main portions: `seoRules` (the full rules
251
+ covering technical SEO, keywords, titles, descriptions, headings, content, JSON-LD,
252
+ FAQs, performance, trust, and launch checks) and `implementationSteps` (ordered shared
253
+ steps plus framework-specific instructions).
335
254
 
336
- Rule-based check of one page. The easiest input is the page's built HTML (`html`, from
337
- view-source or the `out/` / `dist/` folder): title, description, canonical, headings,
338
- og:image, JSON-LD types, alt text and word count are extracted from it. Explicit fields
339
- override the extracted ones, and checks without input are skipped. It catches doubled or
340
- missing brand suffixes (with `brandName`), duplicate schema nodes, JSON-LD that doesn't
341
- parse, and pages that render client-only (no H1 in the HTML). Returns a 0–100 score and a sorted
342
- list of `fail` / `warn` / `pass` items, each with the exact fix.
255
+ Pass `framework` as `auto`, `nextjs-app`, `nextjs-pages`, `react-vite`, `react-router`,
256
+ `remix`, or another supported framework. With `auto`, inspect project files and select
257
+ steps that match the detected router and rendering mode. You can pass `projectContext`
258
+ with relevant project configuration when helpful. The tool returns the complete rules
259
+ alongside the applicable framework instructions; it does not emit a one-off metadata
260
+ snippet or accept a page audit payload.
343
261
 
344
262
  ---
345
263
 
@@ -439,15 +357,16 @@ neuctra-ui-mcp/
439
357
  ├── bin/
440
358
  │ └── cli.mjs # entry point: connects the server to a stdio transport
441
359
  ├── src/
442
- │ ├── server.mjs # defines the 9 tools and their handlers
443
- │ └── seo.mjs # pure builders behind generate_page_seo / audit_page_seo
360
+ │ ├── server.mjs # registers the MCP tool modules
361
+ │ └── seo.mjs # pure SEO builders used by neuctra-ui-seo-setup
444
362
  ├── scripts/
445
363
  │ └── sync-registry.mjs # copies registry/components.json from neuctra-ui-package
446
364
  ├── data/
447
365
  │ ├── components.json # synced (generated) — don't edit by hand
448
366
  │ ├── theme.json # hand-curated token + styling/anti-AI-look rules
449
367
  │ ├── aiDesignRules.json # hand-curated 63-section product/UX design guide
450
- │ └── seoGuide.json # hand-curated SEO / AEO / GEO playbook
368
+ │ ├── seoGuide.json # SEO / AEO / GEO rules and implementation steps
369
+ │ └── layouts.json # editable page layout recipes
451
370
  └── package.json
452
371
  ```
453
372