@lumeo-ui/mcp-server 5.10.5 → 5.11.1

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/dist/index.js CHANGED
@@ -36,6 +36,7 @@ import { components as curatedExamples } from "./components.js";
36
36
  import { loadRegistry } from "./registry.js";
37
37
  import { setupFor, PORTAL_COMPONENTS, NEEDS_OVERLAY_PROVIDER } from "./installInfo.js";
38
38
  import { createValidator } from "./validate.js";
39
+ import { searchComponents } from "./search.js";
39
40
  import { readFileSync } from "node:fs";
40
41
  const DOCS_BASE = "https://lumeo.nativ.sh";
41
42
  // Server version, read from package.json so it can never drift from the published
@@ -112,47 +113,11 @@ function findComponent(name) {
112
113
  // so e.g. "SheetContent" / "CardHeader" / "SelectTrigger" resolve.
113
114
  return byName.get(name.toLowerCase()) ?? bySubName.get(name.toLowerCase());
114
115
  }
115
- function score(c, q) {
116
- const needle = q.toLowerCase();
117
- if (!needle)
118
- return 0;
119
- let s = 0;
120
- if (c.name.toLowerCase() === needle)
121
- s += 100;
122
- if (c.name.toLowerCase().startsWith(needle))
123
- s += 50;
124
- if (c.name.toLowerCase().includes(needle))
125
- s += 25;
126
- if (c.category.toLowerCase().includes(needle))
127
- s += 10;
128
- if (c.description.toLowerCase().includes(needle))
129
- s += 5;
130
- // Sub-component name matches surface the parent — so searching a nested
131
- // element ("SheetContent", "TabsTrigger") finds the component that owns it.
132
- for (const sub of Object.values(c.subComponents)) {
133
- const sn = sub.componentName.toLowerCase();
134
- if (sn === needle) {
135
- s += 80;
136
- break;
137
- }
138
- if (sn.includes(needle)) {
139
- s += 20;
140
- break;
141
- }
142
- }
143
- return s;
144
- }
116
+ // Tokenized fuzzy search over the component catalog (LU-15) — see search.ts for the
117
+ // scoring rules. Multi-word queries ("flow diagram nodes edges") match components that
118
+ // hit ANY of the words, not just the whole phrase verbatim.
145
119
  function searchCatalog(query, category) {
146
- let pool = components;
147
- if (category)
148
- pool = pool.filter((c) => c.category.toLowerCase() === category.toLowerCase());
149
- if (!query)
150
- return pool;
151
- return pool
152
- .map((c) => ({ c, s: score(c, query) }))
153
- .filter((x) => x.s > 0)
154
- .sort((a, b) => b.s - a.s)
155
- .map((x) => x.c);
120
+ return searchComponents(components, query, category);
156
121
  }
157
122
  function docsUrl(c) {
158
123
  // Convert PascalCase to kebab-case for the docs URL
@@ -27,7 +27,10 @@ export const PACKAGE_SETUP = {
27
27
  dotnetAdd: "dotnet add package Lumeo.Charts --prerelease",
28
28
  lumeoAddNote: "`lumeo add chart` copies the Chart component + ECharts interop.",
29
29
  usings: ["@using Lumeo"],
30
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoCharts();"],
30
+ // LU-16: there is no AddLumeoCharts() — `AddLumeo()` is the only DI registration
31
+ // extension method in the whole library (src/Lumeo/Extensions/LumeoServiceExtensions.cs);
32
+ // satellites add components/markup, not their own service registrations.
33
+ di: ["builder.Services.AddLumeo();"],
31
34
  hostIncludes: [
32
35
  `<script src="_content/Lumeo.Charts/js/echarts.min.js"></script>`,
33
36
  `<script src="_content/Lumeo.Charts/js/chart-interop.js"></script>`,
@@ -39,7 +42,9 @@ export const PACKAGE_SETUP = {
39
42
  dotnetAdd: "dotnet add package Lumeo.DataGrid --prerelease",
40
43
  lumeoAddNote: "`lumeo add datagrid` copies the DataGrid + supporting types.",
41
44
  usings: ["@using Lumeo"],
42
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoDataGrid(); // registers IDataGridExportService"],
45
+ // LU-16: there is no AddLumeoDataGrid() — IDataGridExportService is already
46
+ // registered by the core AddLumeo() call (see LumeoServiceExtensions.cs).
47
+ di: ["builder.Services.AddLumeo(); // also registers IDataGridExportService"],
43
48
  hostIncludes: [],
44
49
  notes: [
45
50
  "Excel/PDF export pulls in ClosedXML (MIT) and QuestPDF (dual-licensed — free under $1M revenue, otherwise paid). CSV/JSON export has no third-party dependency.",
@@ -51,7 +56,8 @@ export const PACKAGE_SETUP = {
51
56
  dotnetAdd: "dotnet add package Lumeo.Editor --prerelease",
52
57
  lumeoAddNote: "`lumeo add rich-text-editor`.",
53
58
  usings: ["@using Lumeo"],
54
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoEditor();"],
59
+ // LU-16: there is no AddLumeoEditor().
60
+ di: ["builder.Services.AddLumeo();"],
55
61
  hostIncludes: [`<script src="_content/Lumeo.Editor/js/editor-interop.js"></script>`],
56
62
  notes: [],
57
63
  },
@@ -60,7 +66,8 @@ export const PACKAGE_SETUP = {
60
66
  dotnetAdd: "dotnet add package Lumeo.Scheduler --prerelease",
61
67
  lumeoAddNote: "`lumeo add scheduler`.",
62
68
  usings: ["@using Lumeo"],
63
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoScheduler();"],
69
+ // LU-16: there is no AddLumeoScheduler().
70
+ di: ["builder.Services.AddLumeo();"],
64
71
  hostIncludes: [],
65
72
  notes: [],
66
73
  },
@@ -69,7 +76,8 @@ export const PACKAGE_SETUP = {
69
76
  dotnetAdd: "dotnet add package Lumeo.Gantt --prerelease",
70
77
  lumeoAddNote: "`lumeo add gantt`.",
71
78
  usings: ["@using Lumeo"],
72
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoGantt();"],
79
+ // LU-16: there is no AddLumeoGantt().
80
+ di: ["builder.Services.AddLumeo();"],
73
81
  hostIncludes: [],
74
82
  notes: [],
75
83
  },
@@ -78,7 +86,8 @@ export const PACKAGE_SETUP = {
78
86
  dotnetAdd: "dotnet add package Lumeo.Motion --prerelease",
79
87
  lumeoAddNote: "`lumeo add <motion-component>` (e.g. `lumeo add border-beam`).",
80
88
  usings: ["@using Lumeo"],
81
- di: ["builder.Services.AddLumeo();", "builder.Services.AddLumeoMotion();"],
89
+ // LU-16: there is no AddLumeoMotion().
90
+ di: ["builder.Services.AddLumeo();"],
82
91
  hostIncludes: [`<script src="_content/Lumeo.Motion/js/motion-interop.js"></script>`],
83
92
  notes: ["Animation primitives (BorderBeam, Marquee, NumberTicker, Confetti, …). Most are pure CSS; a few use a small JS interop module."],
84
93
  },
package/dist/search.js ADDED
@@ -0,0 +1,76 @@
1
+ // Component search — extracted from index.ts so it can be unit-tested in isolation
2
+ // (same rationale as validate.ts: parameterized by a minimal structural shape rather
3
+ // than reaching into module-level state).
4
+ //
5
+ // LU-15 (field report against 5.11.0): lumeo_search("flow diagram nodes edges") returned
6
+ // [] even though FlowCanvas's own description mentions "flow", "nodes" and "edges" — its
7
+ // description just never contains that exact FOUR-WORD substring. The old `score()` did
8
+ // `c.description.toLowerCase().includes(needle)` with `needle` = the WHOLE lowercased
9
+ // query string, so any multi-word query only matched a component whose name/category/
10
+ // description happened to contain that literal phrase verbatim. Real queries are natural
11
+ // -language phrases ("flow diagram nodes edges", "chat message bubble"), not exact
12
+ // substrings. Fixed by tokenizing the query on whitespace and scoring + summing each
13
+ // token independently — a component now surfaces if ANY of the query's words hit its
14
+ // name/category/description/sub-component names, ranked by how many (and how well) they
15
+ // hit, which is what "fuzzy search" in the tool description already promised.
16
+ /** Splits a query into lowercase, non-empty whitespace-separated words. */
17
+ export function tokenize(query) {
18
+ return query
19
+ .toLowerCase()
20
+ .split(/\s+/)
21
+ .map((t) => t.trim())
22
+ .filter(Boolean);
23
+ }
24
+ /** Score a single component against a single (already-lowercased) query token. */
25
+ function scoreToken(c, needle) {
26
+ let s = 0;
27
+ const name = c.name.toLowerCase();
28
+ if (name === needle)
29
+ s += 100;
30
+ else if (name.startsWith(needle))
31
+ s += 50;
32
+ else if (name.includes(needle))
33
+ s += 25;
34
+ if (c.category.toLowerCase().includes(needle))
35
+ s += 10;
36
+ if (c.description.toLowerCase().includes(needle))
37
+ s += 5;
38
+ // Sub-component name matches surface the parent — so searching a nested
39
+ // element ("SheetContent", "TabsTrigger") finds the component that owns it.
40
+ for (const sub of Object.values(c.subComponents)) {
41
+ const sn = sub.componentName.toLowerCase();
42
+ if (sn === needle) {
43
+ s += 80;
44
+ break;
45
+ }
46
+ if (sn.includes(needle)) {
47
+ s += 20;
48
+ break;
49
+ }
50
+ }
51
+ return s;
52
+ }
53
+ /** Score a component against a full (possibly multi-word) query: the sum of its
54
+ * per-token scores. A component needs to match only SOME of the query's words to
55
+ * surface — it does not have to contain the whole phrase verbatim. */
56
+ export function scoreComponent(c, query) {
57
+ const tokens = tokenize(query);
58
+ if (tokens.length === 0)
59
+ return 0;
60
+ let total = 0;
61
+ for (const t of tokens)
62
+ total += scoreToken(c, t);
63
+ return total;
64
+ }
65
+ export function searchComponents(components, query, category) {
66
+ let pool = components;
67
+ if (category)
68
+ pool = pool.filter((c) => c.category.toLowerCase() === category.toLowerCase());
69
+ if (!query)
70
+ return pool.slice();
71
+ return pool
72
+ .map((c) => ({ c, s: scoreComponent(c, query) }))
73
+ .filter((x) => x.s > 0)
74
+ .sort((a, b) => b.s - a.s)
75
+ .map((x) => x.c);
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumeo-ui/mcp-server",
3
- "version": "5.10.5",
3
+ "version": "5.11.1",
4
4
  "description": "Model Context Protocol server for the Lumeo Blazor component library. Lets LLMs (Claude, Copilot, Cursor) author correct Lumeo markup.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",