bestax-mcp 1.18.37 → 1.18.38

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/format.d.ts CHANGED
@@ -94,11 +94,23 @@ export declare function referencePointer(record: ComponentRecord): string;
94
94
  * `Navbar.Brand` with Navbar's own table and no word about the switch (#935).
95
95
  */
96
96
  export interface PartFocus {
97
- /** The dot-path as asked. */
97
+ /** The dot-path, as the record it names a part of spells it. */
98
98
  wanted: string;
99
99
  /** The part it names, or null when it names none. */
100
100
  part: Part | null;
101
+ /**
102
+ * The dot-path as asked, when it ran through a static that is a component
103
+ * of its own: `Stats.Stat.Label`, for `Stat.Label` (#1480).
104
+ */
105
+ asked?: string;
101
106
  }
107
+ /**
108
+ * What a dot-path that ran through a static that is a component of its own
109
+ * names: `Stats.Stat` is `Stat`, so `Stats.Stat.Label` is `Stat.Label`. Each
110
+ * step keeps the rest of the path, so the static is the path as asked less
111
+ * the segments after the component's name.
112
+ */
113
+ export declare function throughLine(asked: string, path: string): string;
102
114
  /**
103
115
  * The import a part is used through: its record's, or one of its own for a
104
116
  * standalone export that import leaves out (`Input`'s names no `InputBase`).
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,MAAM,EACN,OAAO,EACP,IAAI,EAEJ,KAAK,EACN,MAAM,WAAW,CAAC;AAUnB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgB9C;AA2FD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiCxD;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAO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EAAE,MAAM,EAAE,EACjB,KAAK,CAAC,EAAE,SAAS,EACjB,EAAE,QAAQ,EAAE,GAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAM,GAC/C,MAAM,CAiHR;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAI1D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAyDpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAmBR;AA6BD,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAoB7D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAgBpD;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;;;;;EAM3D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM;;;;;;EAK1C"}
package/dist/format.js CHANGED
@@ -307,6 +307,18 @@ export function referencePointer(record) {
307
307
  `\`get_component({ name: "${record.name}", include: ["reference"] })\` ` +
308
308
  `returns all of it (${referenceOf(record).length.toLocaleString('en-US')} characters).`);
309
309
  }
310
+ /**
311
+ * What a dot-path that ran through a static that is a component of its own
312
+ * names: `Stats.Stat` is `Stat`, so `Stats.Stat.Label` is `Stat.Label`. Each
313
+ * step keeps the rest of the path, so the static is the path as asked less
314
+ * the segments after the component's name.
315
+ */
316
+ export function throughLine(asked, path) {
317
+ const [component, ...rest] = path.split('.');
318
+ const segments = asked.split('.');
319
+ const via = segments.slice(0, segments.length - rest.length).join('.');
320
+ return `\`${via}\` is \`${component}\`, so \`${asked}\` is \`${path}\`.`;
321
+ }
310
322
  /**
311
323
  * The import a part is used through: its record's, or one of its own for a
312
324
  * standalone export that import leaves out (`Input`'s names no `InputBase`).
@@ -348,6 +360,9 @@ export function partLists(record) {
348
360
  export function renderComponent(record, include, focus, { hasEntry } = {}) {
349
361
  const part = focus?.part && focus.part !== record.parts[0] ? focus.part : null;
350
362
  const out = [`# ${part ? part.path : record.name}`];
363
+ if (focus?.asked) {
364
+ out.push(throughLine(focus.asked, focus.part?.path ?? focus.wanted));
365
+ }
351
366
  if (part?.standalone) {
352
367
  out.push(`${standaloneLine(part, record.name)} The props are its own; any ` +
353
368
  `examples, CSS variables and notes are \`${record.name}\`'s, and ` +
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,SAAS,EAEV,MAAM,yCAAyC,CAAC;AA6LjD,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,SAAS,CAAC,CAs5BpB"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,SAAS,EAEV,MAAM,yCAAyC,CAAC;AA0OjD,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAChC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,SAAS,CAAC,CA06BpB"}
package/dist/server.js CHANGED
@@ -24,7 +24,7 @@ import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
24
24
  import { z } from 'zod';
25
25
  import { classTokens, lookupClasses, renderLookup } from './bulma-classes.js';
26
26
  import { documentedExport, dotPath, loadBulmaClasses, loadCatalog, loadComponent, loadServerVersion, loadSkills, loadSkillFile, resolveName, } from './data.js';
27
- import { errorResult, HELPER_PROPS_PAGE, partLists, renderCatalog, renderComponent, renderCssVarsAnswer, renderExamples, renderHelperApi, renderPart, renderSkills, referenceOf, referencePointer, table, textResult, } from './format.js';
27
+ import { errorResult, HELPER_PROPS_PAGE, partLists, renderCatalog, renderComponent, renderCssVarsAnswer, renderExamples, renderHelperApi, renderPart, renderSkills, referenceOf, referencePointer, table, textResult, throughLine, } from './format.js';
28
28
  import { GROUP_NAMES, renderHelperDefault, renderHelperGroup, resolveGroup, } from './helper-props.js';
29
29
  import { searchAll, skillSections, suggest, usesExport, } from './search.js';
30
30
  import { missingInstallNote, resolveVersions, versionNote, } from './version.js';
@@ -107,15 +107,51 @@ const notFoundError = (message) => new McpError(ErrorCode.InvalidParams, message
107
107
  async function wantedPath(input) {
108
108
  return dotPath(input) ?? (await documentedExport(input))?.entry.path ?? null;
109
109
  }
110
- /** What a name names in a record: the part, or null when it names none. */
111
- async function partFocus(record, input) {
112
- const wanted = await wantedPath(input);
113
- if (!wanted)
114
- return null;
115
- const part = record.parts.find(p => p.path === wanted) ??
116
- record.parts.find(p => p.path.toLowerCase() === wanted.toLowerCase()) ??
117
- null;
118
- return { wanted, part };
110
+ /** The part a dot-path names in a record, as spelled there or in any letter case. */
111
+ function findPart(record, path) {
112
+ return (record.parts.find(p => p.path === path) ??
113
+ record.parts.find(p => p.path.toLowerCase() === path.toLowerCase()));
114
+ }
115
+ /**
116
+ * The record a dot-path names a part of, and the path as that record spells it.
117
+ * A static that is a component with an entry of its own hands the rest of the
118
+ * path to that component's record: `Stats.Stat` is `Stat`, so `Stats.Stat.Label`
119
+ * is `Stat.Label` (#1480). Only a part's `component` is followed, so the rest of
120
+ * a path through `Combobox.Menu`, which is no export of its own, stays
121
+ * Combobox's rather than going to `Menu`, another component. A path the record
122
+ * names a part for as it stands (`Card.Header.Title`) is never followed.
123
+ */
124
+ async function followPath(record, wanted) {
125
+ if (findPart(record, wanted))
126
+ return { record, wanted };
127
+ const { components } = await loadCatalog();
128
+ const segments = wanted.split('.');
129
+ // The longest prefix first, so a static inside another static wins. Each
130
+ // step leaves a shorter path than it took, so the walk ends.
131
+ for (let i = segments.length - 1; i >= 2; i--) {
132
+ const via = findPart(record, segments.slice(0, i).join('.'))?.component;
133
+ if (via && components.some(c => c.name === via)) {
134
+ return followPath(await loadComponent(via), [via, ...segments.slice(i)].join('.'));
135
+ }
136
+ }
137
+ return { record, wanted };
138
+ }
139
+ /**
140
+ * What a name names: the record whose part it is, with that part, or the record
141
+ * as resolved and no focus for a name that asks for none.
142
+ */
143
+ async function focusOn(record, input) {
144
+ const asked = await wantedPath(input);
145
+ if (!asked)
146
+ return { record };
147
+ const followed = await followPath(record, asked);
148
+ const focus = {
149
+ wanted: followed.wanted,
150
+ part: findPart(followed.record, followed.wanted) ?? null,
151
+ };
152
+ if (followed.wanted !== asked)
153
+ focus.asked = asked;
154
+ return { record: followed.record, focus };
119
155
  }
120
156
  /** Load every component record. Only `search_bestax` needs this much. */
121
157
  async function allComponents() {
@@ -383,8 +419,8 @@ export async function createServer(options = {}) {
383
419
  const resolved = await resolveName(name);
384
420
  if (!resolved)
385
421
  return notFound(name);
386
- const record = await loadComponent(resolved);
387
- return textResult(renderComponent(record, include ?? ['props'], (await partFocus(record, name)) ?? undefined, { hasEntry }), note());
422
+ const { record, focus } = await focusOn(await loadComponent(resolved), name);
423
+ return textResult(renderComponent(record, include ?? ['props'], focus, { hasEntry }), note());
388
424
  });
389
425
  server.registerTool('get_props', {
390
426
  title: 'Get props',
@@ -407,27 +443,31 @@ export async function createServer(options = {}) {
407
443
  const resolved = await resolveName(component);
408
444
  if (!resolved)
409
445
  return notFound(component);
410
- const record = await loadComponent(resolved);
411
- if (record.kind === 'helper') {
446
+ const named = await loadComponent(resolved);
447
+ if (named.kind === 'helper') {
412
448
  // The signature itself rather than a pointer at a tool that has it, so the
413
449
  // question is answered on this call.
414
- return textResult(`# ${record.name}\n\n${renderHelperApi(record)}`, note());
450
+ return textResult(`# ${named.name}\n\n${renderHelperApi(named)}`, note());
415
451
  }
416
452
  // A dot-path given as `path`, or folded into `component` ("Navbar.Brand"), or
417
453
  // the part an export documented with this record is ("InputBase").
418
- const wanted = path ??
454
+ const asked = path ??
419
455
  (component.includes('.') ? component : await wantedPath(component));
420
- if (!wanted) {
456
+ if (!asked) {
421
457
  const body = [
422
- renderPart(record.parts[0], { heading: false }),
423
- ...partLists(record),
458
+ renderPart(named.parts[0], { heading: false }),
459
+ ...partLists(named),
424
460
  ];
425
- if (record.doc)
426
- body.push(referencePointer(record));
427
- return textResult(`# ${record.name}\n\n${body.join('\n\n')}`, note());
461
+ if (named.doc)
462
+ body.push(referencePointer(named));
463
+ return textResult(`# ${named.name}\n\n${body.join('\n\n')}`, note());
428
464
  }
429
- const part = record.parts.find(p => p.path === wanted) ??
430
- record.parts.find(p => p.path.toLowerCase() === wanted.toLowerCase());
465
+ // A path through a static that is a component of its own names a part of
466
+ // that component's record, and the answer says which (#1480).
467
+ const { record, wanted } = await followPath(named, asked);
468
+ const part = findPart(record, wanted);
469
+ const through = wanted === asked ? '' : throughLine(asked, part?.path ?? wanted);
470
+ const lead = through && `${through} `;
431
471
  if (!part) {
432
472
  // `path` reads like it could take a prop ("Button.isLoading"), and the old
433
473
  // answer listed the parts without saying a prop is the wrong thing to pass.
@@ -435,13 +475,13 @@ export async function createServer(options = {}) {
435
475
  const [nearPart] = suggest(wanted, subs, 1);
436
476
  // `Carousel.Item` for `CarouselItem`: no dot-path names a separate export.
437
477
  if (record.parts.find(p => p.path === nearPart)?.standalone) {
438
- return errorResult(`${record.name} has no "${wanted}". Did you mean "${nearPart}"? It is ` +
478
+ return errorResult(`${lead}${record.name} has no "${wanted}". Did you mean "${nearPart}"? It is ` +
439
479
  `a separate export, not a dot-path, so it is written <${nearPart}>, ` +
440
480
  `and its props are in get_props({ component: "${nearPart}" }).`);
441
481
  }
442
482
  const tail = wanted.split('.').pop() ?? wanted;
443
483
  const [prop] = suggest(tail, [...new Set(record.parts.flatMap(p => p.props.map(r => r.name)))], 1);
444
- return errorResult(`"${wanted}" is not a part of ${record.name}. ` +
484
+ return errorResult(`${lead}"${wanted}" is not a part of ${record.name}. ` +
445
485
  (nearPart ? `Did you mean "${nearPart}"? ` : '') +
446
486
  `\`path\` names a subcomponent, such as "Navbar.Brand", not a prop. ` +
447
487
  (subs.length
@@ -452,7 +492,8 @@ export async function createServer(options = {}) {
452
492
  `get_props({ component: "${record.name}" }).`
453
493
  : `Its props are in get_props({ component: "${record.name}" }).`));
454
494
  }
455
- return textResult(renderPart(part, { owner: record.name, hasEntry }), note());
495
+ return textResult((through && `${through}\n\n`) +
496
+ renderPart(part, { owner: record.name, hasEntry }), note());
456
497
  });
457
498
  server.registerTool('get_examples', {
458
499
  title: 'Get usage examples',
@@ -543,7 +584,13 @@ export async function createServer(options = {}) {
543
584
  const resolved = await resolveName(component);
544
585
  if (!resolved)
545
586
  return notFound(component);
546
- const record = await loadComponent(resolved);
587
+ const named = await loadComponent(resolved);
588
+ // A part that is a component of its own has that component's variables,
589
+ // not its family's: `Buttons.Button` is `Button`, and `Stats.Stat.Label`
590
+ // is a part of `Stat` (#1480).
591
+ const { record: owner, focus } = await focusOn(named, component);
592
+ const own = focus?.part?.component;
593
+ const record = own && hasEntry(own) ? await loadComponent(own) : owner;
547
594
  const vars = query
548
595
  ? record.cssVars.filter(v => v.css.toLowerCase().includes(query.toLowerCase()))
549
596
  : record.cssVars;
@@ -564,10 +611,21 @@ export async function createServer(options = {}) {
564
611
  `component.`, note());
565
612
  }
566
613
  const documented = await documentedExport(component);
567
- return textResult((documented
568
- ? `\`${documented.name}\` is documented with \`${record.name}\`, ` +
569
- `whose variables these are.\n\n`
570
- : '') + renderCssVarsAnswer(record, vars, query), note());
614
+ const lead = [
615
+ documented &&
616
+ `\`${documented.name}\` is documented with \`${record.name}\`, ` +
617
+ `whose variables these are.`,
618
+ focus?.part && record !== owner
619
+ ? `\`${focus.asked ?? focus.part.path}\` is \`${record.name}\`.`
620
+ : focus?.asked &&
621
+ throughLine(focus.asked, focus.part?.path ?? focus.wanted),
622
+ record !== named &&
623
+ named.cssVars.length > 0 &&
624
+ `\`${named.name}\`'s own variables are in ` +
625
+ `\`get_css_variables({ component: "${named.name}" })\`.`,
626
+ ].filter(Boolean);
627
+ return textResult((lead.length ? `${lead.join(' ')}\n\n` : '') +
628
+ renderCssVarsAnswer(record, vars, query), note());
571
629
  }
572
630
  if (!query) {
573
631
  return errorResult("Pass `component` for one component's variables, or `query` to " +
@@ -721,13 +779,15 @@ export async function createServer(options = {}) {
721
779
  ? ` Did you mean ${near.map(n => `"${n}"`).join(', ')}?`
722
780
  : ''));
723
781
  }
724
- const record = await loadComponent(resolved);
782
+ const { record, focus } = await focusOn(await loadComponent(resolved), String(name));
725
783
  return {
726
784
  contents: [
727
785
  {
728
786
  uri: uri.href,
729
787
  mimeType: 'text/markdown',
730
- text: renderComponent(record, RESOURCE_INCLUDES, (await partFocus(record, String(name))) ?? undefined, { hasEntry }),
788
+ text: renderComponent(record, RESOURCE_INCLUDES, focus, {
789
+ hasEntry,
790
+ }),
731
791
  },
732
792
  ],
733
793
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bestax-mcp",
3
- "version": "1.18.37",
3
+ "version": "1.18.38",
4
4
  "mcpName": "io.github.allxsmith/bestax-mcp",
5
5
  "description": "MCP server for @allxsmith/bestax-bulma — component props, examples, CSS variables and agent skills, served offline from a version-pinned index",
6
6
  "type": "module",