@react-spectrum/mcp 1.0.0 → 1.1.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.
@@ -10,6 +10,10 @@
10
10
  "MusicNote",
11
11
  "StickyNote"
12
12
  ],
13
+ "approve": [
14
+ "BadgeVerified",
15
+ "CheckmarkCircle"
16
+ ],
13
17
  "arrow": [
14
18
  "ChevronDoubleLeft",
15
19
  "ChevronDoubleRight",
@@ -107,6 +111,9 @@
107
111
  "TextAdd",
108
112
  "UserAdd"
109
113
  ],
114
+ "crown": [
115
+ "PremiumIcon"
116
+ ],
110
117
  "date": [
111
118
  "Calendar",
112
119
  "CalendarAdd",
@@ -468,6 +475,9 @@
468
475
  "program": [
469
476
  "Code"
470
477
  ],
478
+ "pro": [
479
+ "PremiumIcon"
480
+ ],
471
481
  "raise": [
472
482
  "ChevronUp",
473
483
  "OrderOneUp",
@@ -489,7 +499,9 @@
489
499
  "Undo"
490
500
  ],
491
501
  "save": [
492
- "Download"
502
+ "Download",
503
+ "Bookmark",
504
+ "BookmarkSingleFilled"
493
505
  ],
494
506
  "schedule": [
495
507
  "Calendar",
@@ -573,6 +585,9 @@
573
585
  "up": [
574
586
  "TextIncrease"
575
587
  ],
588
+ "verified": [
589
+ "CheckmarkCircle"
590
+ ],
576
591
  "versus": [
577
592
  "Compare"
578
593
  ],
@@ -21,7 +21,9 @@
21
21
  "Apps",
22
22
  "AppsAll",
23
23
  "Archive",
24
+ "ArrowCurved",
24
25
  "ArrowHeadTool",
26
+ "ArrowUpSend",
25
27
  "Artboard",
26
28
  "AspectRatio",
27
29
  "Asset",
@@ -36,6 +38,7 @@
36
38
  "Binoculars",
37
39
  "Blur",
38
40
  "Bookmark",
41
+ "BookmarkSingleFilled",
39
42
  "Brand",
40
43
  "Briefcase",
41
44
  "BrightnessContrast",
@@ -259,6 +262,7 @@
259
262
  "Polygon4",
260
263
  "Polygon5",
261
264
  "Polygon6",
265
+ "PremiumIcon",
262
266
  "Preview",
263
267
  "Print",
264
268
  "Project",
@@ -318,6 +322,7 @@
318
322
  "StepBackward",
319
323
  "StepForward",
320
324
  "StickyNote",
325
+ "StopProcessing",
321
326
  "StrokeDotted",
322
327
  "StrokeSolid",
323
328
  "StrokeWidth",
@@ -399,6 +404,9 @@
399
404
  "Wallet",
400
405
  "WebNavBar",
401
406
  "WebPage",
407
+ "ZoomFitToHeight",
408
+ "ZoomFitToScreen",
409
+ "ZoomFitToWidth",
402
410
  "ZoomIn",
403
411
  "ZoomOut"
404
412
  ]
@@ -1,13 +1,10 @@
1
- import { DEFAULT_CDN_BASE, fetchText } from './utils.js';
2
1
  import { extractNameAndDescription, parseSectionsFromMarkdown } from './parser.js';
2
+ import { fetchText, getLibraryBaseUrl } from './utils.js';
3
3
  import path from 'path';
4
4
  // Cache of parsed pages
5
5
  const pageCache = new Map();
6
6
  // Whether we've loaded the page index for a library yet.
7
7
  const pageIndexLoaded = new Set();
8
- function libBaseUrl(library) {
9
- return `${DEFAULT_CDN_BASE}/${library}`;
10
- }
11
8
  // Build an index of pages for the given library from the CDN's llms.txt.
12
9
  export async function buildPageIndex(library) {
13
10
  if (pageIndexLoaded.has(library)) {
@@ -15,7 +12,8 @@ export async function buildPageIndex(library) {
15
12
  }
16
13
  const pages = [];
17
14
  // Read llms.txt to enumerate available pages without downloading them all.
18
- const llmsUrl = `${libBaseUrl(library)}/llms.txt`;
15
+ const baseUrl = getLibraryBaseUrl(library);
16
+ const llmsUrl = `${baseUrl}/llms.txt`;
19
17
  const txt = await fetchText(llmsUrl);
20
18
  const re = /^\s*-\s*\[([^\]]+)\]\(([^)]+)\)(?:\s*:\s*(.*))?\s*$/;
21
19
  for (const line of txt.split(/\r?\n/)) {
@@ -29,9 +27,10 @@ export async function buildPageIndex(library) {
29
27
  if (!href || !/\.md$/i.test(href)) {
30
28
  continue;
31
29
  }
32
- const key = href.replace(/\.md$/i, '').replace(/\\/g, '/');
33
- const name = display || path.basename(key);
34
- const filePath = `${DEFAULT_CDN_BASE}/${key}.md`;
30
+ const hrefWithoutExt = href.replace(/\.md$/i, '').replace(/\\/g, '/');
31
+ const key = `${library}/${hrefWithoutExt}`;
32
+ const name = display || path.basename(hrefWithoutExt);
33
+ const filePath = `${baseUrl}/${hrefWithoutExt}.md`;
35
34
  const info = { key, name, description, filePath, sections: [] };
36
35
  pages.push(info);
37
36
  pageCache.set(info.key, info);
@@ -56,6 +55,7 @@ export async function resolvePageRef(library, pageName) {
56
55
  if (pageCache.has(pageName)) {
57
56
  return pageCache.get(pageName);
58
57
  }
58
+ const baseUrl = getLibraryBaseUrl(library);
59
59
  if (pageName.includes('/')) {
60
60
  const normalized = pageName.replace(/\\/g, '/');
61
61
  const prefix = normalized.split('/', 1)[0];
@@ -66,7 +66,7 @@ export async function resolvePageRef(library, pageName) {
66
66
  if (maybe) {
67
67
  return maybe;
68
68
  }
69
- const filePath = `${DEFAULT_CDN_BASE}/${normalized}.md`;
69
+ const filePath = `${baseUrl}/${normalized}.md`;
70
70
  const stub = { key: normalized, name: path.basename(normalized), description: undefined, filePath, sections: [] };
71
71
  pageCache.set(stub.key, stub);
72
72
  return stub;
@@ -76,7 +76,7 @@ export async function resolvePageRef(library, pageName) {
76
76
  if (maybe) {
77
77
  return maybe;
78
78
  }
79
- const filePath = `${DEFAULT_CDN_BASE}/${key}.md`;
79
+ const filePath = `${baseUrl}/${key}.md`;
80
80
  const stub = { key, name: pageName, description: undefined, filePath, sections: [] };
81
81
  pageCache.set(stub.key, stub);
82
82
  return stub;
@@ -12,8 +12,15 @@ export function errorToString(err) {
12
12
  return String(err);
13
13
  }
14
14
  }
15
- // CDN base for docs. Can be overridden via env variable.
16
- export const DEFAULT_CDN_BASE = process.env.DOCS_CDN_BASE ?? 'https://react-spectrum.adobe.com/beta';
15
+ // Default base URLs for each library
16
+ const DEFAULT_S2_BASE = 'https://react-spectrum.adobe.com';
17
+ const DEFAULT_REACT_ARIA_BASE = 'https://react-aria.adobe.com';
18
+ export function getLibraryBaseUrl(library) {
19
+ if (process.env.DOCS_CDN_BASE) {
20
+ return process.env.DOCS_CDN_BASE;
21
+ }
22
+ return library === 's2' ? DEFAULT_S2_BASE : DEFAULT_REACT_ARIA_BASE;
23
+ }
17
24
  export async function fetchText(url, timeoutMs = 15000) {
18
25
  const ctrl = new AbortController();
19
26
  const id = setTimeout(() => ctrl.abort(), timeoutMs).unref?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/mcp",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "MCP server for React Spectrum (S2) documentation",
5
5
  "type": "module",
6
6
  "bin": "dist/s2/src/index.js",
@@ -41,5 +41,5 @@
41
41
  "module": "dist/module.js",
42
42
  "types": "dist/types.d.ts",
43
43
  "source": "src/index.ts",
44
- "gitHead": "4d838da5bfe36abb35aed166995a9ef63825370f"
44
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
45
45
  }