@urbicon-ui/mcp-server 8.19.0 → 8.20.0

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
@@ -79,7 +79,7 @@ All tools are read-only (`readOnlyHint: true`) — this server never touches the
79
79
 
80
80
  | Tool | Purpose |
81
81
  | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82
- | `find_components` | Fuzzy search across component names, tags, and descriptions. Filterable by package (`blocks`, `table`, `auth`). |
82
+ | `find_components` | Fuzzy search across component names, tags, and descriptions. Filterable by package (`blocks`, `table`, `auth`). A hit needs a whole, distinctive query word, or two ordinary ones meeting on one component: when none lands, the answer is "no components found" plus the weak near misses that still scored, which are also listed beside the matches when one of them outranks the lot. |
83
83
  | `get_component` | Full per-component documentation: props, variants, slots, examples, source link. Optional `section` argument for streamed chunks (overview / examples / variants / api / slots). |
84
84
  | `get_recipe` | Full production-ready recipe (login-form, dashboard, settings-page, etc.) with component tree, code, and notes. |
85
85
  | `suggest_implementation` | Takes a natural-language goal and returns a component-tree suggestion, relevant recipes, Style-Patterns guide, and the implementation checklist. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urbicon-ui/mcp-server",
3
- "version": "8.19.0",
3
+ "version": "8.20.0",
4
4
  "description": "Model Context Protocol server exposing the Urbicon UI component catalog, recipes and design intelligence to LLM agents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@modelcontextprotocol/sdk": "^1.30.0",
42
- "@urbicon-ui/design-content": "8.19.0",
43
- "@urbicon-ui/design-engine": "8.19.0",
42
+ "@urbicon-ui/design-content": "8.20.0",
43
+ "@urbicon-ui/design-engine": "8.20.0",
44
44
  "zod": "^4.5.4"
45
45
  },
46
46
  "devDependencies": {
@@ -1,5 +1,5 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { matchComponents } from '@urbicon-ui/design-engine/search';
2
+ import { CLOSEST_NOTE, searchComponents } from '@urbicon-ui/design-engine/search';
3
3
  import { z } from 'zod';
4
4
  import { loadCatalog } from '../data/catalog-loader.js';
5
5
  import { formatCompactCatalog, formatComponentLine } from '../utils/format-catalog.js';
@@ -8,8 +8,14 @@ import { formatCompactCatalog, formatComponentLine } from '../utils/format-catal
8
8
  * Register the `find_components` tool: the catalog entry point. With no query it
9
9
  * renders the full catalog grouped by category (via `formatCompactCatalog`);
10
10
  * with a query it fuzzy-matches names, descriptions, summaries, prop docs, variant
11
- * values and tags through the engine's `matchComponents` (top 10). Every line keeps the origin-package tag so a
12
- * non-blocks match (e.g. `Table`) is never mistaken for a blocks export.
11
+ * values and tags through the engine's `searchComponents` (top 10) the same ranker
12
+ * the `urbicon find` CLI uses, so local and remote discovery agree. Every line keeps
13
+ * the origin-package tag so a non-blocks match (e.g. `Table`) is never mistaken for a
14
+ * blocks export.
15
+ *
16
+ * A result needs a query word that *landed*; the engine's near misses come back as
17
+ * `closest` and are reported as such, never as matches. Without that floor the tool
18
+ * answered every query with a best-of (#444).
13
19
  */
14
20
  export function registerFindComponentsTool(server: McpServer): void {
15
21
  server.tool(
@@ -34,14 +40,22 @@ export function registerFindComponentsTool(server: McpServer): void {
34
40
  const catalog = await loadCatalog();
35
41
 
36
42
  if (query) {
37
- const results = matchComponents(catalog.components, query, tags, 10);
43
+ const { matches: results, closest } = searchComponents(catalog.components, query, tags, 10);
44
+
45
+ // The near misses render the same way in both branches, and as one line —
46
+ // the full bullet a match gets would read as a result, which is what these
47
+ // are not. Same shape as the CLI's `Closest (weak):` line.
48
+ const closestBlock =
49
+ closest.length > 0
50
+ ? `\n> Closest, but weak: ${closest.map((c) => `${c.name} (${c.slug})`).join(' · ')}\n> ${CLOSEST_NOTE}\n`
51
+ : '';
38
52
 
39
53
  if (results.length === 0) {
40
54
  return {
41
55
  content: [
42
56
  {
43
57
  type: 'text' as const,
44
- text: `No components found for "${query}". Try broader terms or browse all with \`find_components\` (no query).`
58
+ text: `No components found for "${query}". Try broader terms or browse all with \`find_components\` (no query).\n${closestBlock}`
45
59
  }
46
60
  ]
47
61
  };
@@ -57,6 +71,7 @@ export function registerFindComponentsTool(server: McpServer): void {
57
71
  md += formatComponentLine(comp);
58
72
  }
59
73
 
74
+ md += closestBlock;
60
75
  md += '\n> Use `get_component` with the component slug for full API docs.\n';
61
76
  md += '> Use `get_css_reference` for CSS token documentation.\n';
62
77
  md += '> Use `find_icons()` to browse all available icons.\n';