@react-spectrum/mcp 3.0.0-nightly-bae717904-251002 → 3.0.0-nightly-d422ecee5-251003
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/data/iconAliases.json +614 -0
- package/dist/data/icons.json +397 -0
- package/dist/data/illustrationAliases.json +601 -0
- package/dist/data/illustrations.json +194 -0
- package/dist/index.js +395 -0
- package/dist/index.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
[
|
|
2
|
+
"3D",
|
|
3
|
+
"3Dasset",
|
|
4
|
+
"Accessibility",
|
|
5
|
+
"Addproject",
|
|
6
|
+
"AIChat",
|
|
7
|
+
"AIGenerate",
|
|
8
|
+
"AIGenerateImage",
|
|
9
|
+
"AlertNotice",
|
|
10
|
+
"Animation",
|
|
11
|
+
"Apps",
|
|
12
|
+
"ArrowDown",
|
|
13
|
+
"ArrowLeft",
|
|
14
|
+
"ArrowRight",
|
|
15
|
+
"ArrowUp",
|
|
16
|
+
"Artboard",
|
|
17
|
+
"Assets",
|
|
18
|
+
"AudioWave",
|
|
19
|
+
"BadgeVerified",
|
|
20
|
+
"Bell",
|
|
21
|
+
"Bolt",
|
|
22
|
+
"Brand",
|
|
23
|
+
"Briefcase",
|
|
24
|
+
"BrightnessContrast",
|
|
25
|
+
"Browser",
|
|
26
|
+
"BrowserError",
|
|
27
|
+
"BrowserNotCompatible",
|
|
28
|
+
"Brush",
|
|
29
|
+
"Bug",
|
|
30
|
+
"Buildings",
|
|
31
|
+
"BuildTable",
|
|
32
|
+
"Calendar",
|
|
33
|
+
"Camera",
|
|
34
|
+
"CardTapPayment",
|
|
35
|
+
"Channel",
|
|
36
|
+
"ChartAreaStack",
|
|
37
|
+
"Chatbubble",
|
|
38
|
+
"Check",
|
|
39
|
+
"Clipboard",
|
|
40
|
+
"Clock",
|
|
41
|
+
"Close",
|
|
42
|
+
"Cloud",
|
|
43
|
+
"CloudStateDisconnected",
|
|
44
|
+
"CloudStateError",
|
|
45
|
+
"CloudUpload",
|
|
46
|
+
"CodeBrackets",
|
|
47
|
+
"Color",
|
|
48
|
+
"CommentText",
|
|
49
|
+
"ConfettiCelebration",
|
|
50
|
+
"Conversationbubbles",
|
|
51
|
+
"Crop",
|
|
52
|
+
"Cursor",
|
|
53
|
+
"Cut",
|
|
54
|
+
"Data",
|
|
55
|
+
"DataAnalytics",
|
|
56
|
+
"Desktop",
|
|
57
|
+
"Diamond",
|
|
58
|
+
"Document",
|
|
59
|
+
"Download",
|
|
60
|
+
"DropToUpload",
|
|
61
|
+
"Education",
|
|
62
|
+
"Effects",
|
|
63
|
+
"Emoji_160",
|
|
64
|
+
"EmptyStateExport",
|
|
65
|
+
"Error",
|
|
66
|
+
"Explosion",
|
|
67
|
+
"ExportTo",
|
|
68
|
+
"Exposure",
|
|
69
|
+
"FileAlert",
|
|
70
|
+
"FileImage",
|
|
71
|
+
"FileText",
|
|
72
|
+
"FileVideo",
|
|
73
|
+
"FileZip",
|
|
74
|
+
"Filmstrip",
|
|
75
|
+
"Filter",
|
|
76
|
+
"Filters",
|
|
77
|
+
"Fireworks",
|
|
78
|
+
"Flag",
|
|
79
|
+
"FlagCheckmark",
|
|
80
|
+
"FlagCross",
|
|
81
|
+
"FolderClose",
|
|
82
|
+
"FolderOpen",
|
|
83
|
+
"FolderShared",
|
|
84
|
+
"GearSetting",
|
|
85
|
+
"Gift",
|
|
86
|
+
"Globe",
|
|
87
|
+
"GlobeGrid",
|
|
88
|
+
"GraphBarChart",
|
|
89
|
+
"Hand",
|
|
90
|
+
"Handshake",
|
|
91
|
+
"Heart",
|
|
92
|
+
"HelpCircle",
|
|
93
|
+
"Home",
|
|
94
|
+
"Illustration",
|
|
95
|
+
"Image",
|
|
96
|
+
"ImageStack",
|
|
97
|
+
"InfiniteLooping",
|
|
98
|
+
"Information",
|
|
99
|
+
"Interaction",
|
|
100
|
+
"Laptop",
|
|
101
|
+
"Layers",
|
|
102
|
+
"Libraries",
|
|
103
|
+
"Lightbulb",
|
|
104
|
+
"LightbulbRays",
|
|
105
|
+
"Lighten",
|
|
106
|
+
"Link",
|
|
107
|
+
"Location",
|
|
108
|
+
"LockClose",
|
|
109
|
+
"LockOpen",
|
|
110
|
+
"Logo",
|
|
111
|
+
"MagicWand",
|
|
112
|
+
"MailClose",
|
|
113
|
+
"MailOpen",
|
|
114
|
+
"Market",
|
|
115
|
+
"MegaphonePromote",
|
|
116
|
+
"MegaphonePromote_Expressive",
|
|
117
|
+
"Mention",
|
|
118
|
+
"Microphone",
|
|
119
|
+
"MicrophoneOff",
|
|
120
|
+
"Minimize",
|
|
121
|
+
"MovieCamera",
|
|
122
|
+
"MusicNote",
|
|
123
|
+
"NoBrands",
|
|
124
|
+
"NoComment",
|
|
125
|
+
"NoComments",
|
|
126
|
+
"NoElements",
|
|
127
|
+
"NoFile",
|
|
128
|
+
"NoFilter",
|
|
129
|
+
"NoImage",
|
|
130
|
+
"NoLibraries",
|
|
131
|
+
"NoLibrariesBrands",
|
|
132
|
+
"NoReviewLinks",
|
|
133
|
+
"NoSearchResults",
|
|
134
|
+
"NoSharedFile",
|
|
135
|
+
"Paperairplane",
|
|
136
|
+
"Paperclip",
|
|
137
|
+
"Pause",
|
|
138
|
+
"Pencil",
|
|
139
|
+
"Phone",
|
|
140
|
+
"PieChart",
|
|
141
|
+
"PiggyBank",
|
|
142
|
+
"Pin",
|
|
143
|
+
"Play",
|
|
144
|
+
"PlayTriangle",
|
|
145
|
+
"Plugin",
|
|
146
|
+
"Prompt",
|
|
147
|
+
"Properties",
|
|
148
|
+
"Redo",
|
|
149
|
+
"Remix",
|
|
150
|
+
"Replace",
|
|
151
|
+
"ReportAbuse",
|
|
152
|
+
"Revert",
|
|
153
|
+
"Ribbon",
|
|
154
|
+
"Rocket",
|
|
155
|
+
"RotateCCW",
|
|
156
|
+
"RotateCW",
|
|
157
|
+
"Ruler",
|
|
158
|
+
"Search",
|
|
159
|
+
"Segmentation",
|
|
160
|
+
"Server",
|
|
161
|
+
"Shapes",
|
|
162
|
+
"ShoppingBag",
|
|
163
|
+
"ShoppingCart",
|
|
164
|
+
"Sparkles",
|
|
165
|
+
"SpeedFast",
|
|
166
|
+
"StampClone",
|
|
167
|
+
"Star",
|
|
168
|
+
"StepForward",
|
|
169
|
+
"Stopwatch",
|
|
170
|
+
"Switch",
|
|
171
|
+
"Tablet",
|
|
172
|
+
"Tag",
|
|
173
|
+
"Targeted",
|
|
174
|
+
"Text",
|
|
175
|
+
"ThreeArrowsCircle",
|
|
176
|
+
"ThumbsDown",
|
|
177
|
+
"ThumbsUp",
|
|
178
|
+
"Transform",
|
|
179
|
+
"Translate",
|
|
180
|
+
"Trash",
|
|
181
|
+
"Trophy",
|
|
182
|
+
"Update",
|
|
183
|
+
"Upload",
|
|
184
|
+
"User",
|
|
185
|
+
"UserAvatar",
|
|
186
|
+
"UserGroup",
|
|
187
|
+
"VectorDraw",
|
|
188
|
+
"Video",
|
|
189
|
+
"Volume",
|
|
190
|
+
"VolumeOff",
|
|
191
|
+
"VolumeOne",
|
|
192
|
+
"Wallet",
|
|
193
|
+
"Warning"
|
|
194
|
+
]
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var _a;
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
function errorToString(err) {
|
|
11
|
+
if (err && typeof err === 'object' && 'stack' in err && typeof err.stack === 'string') {
|
|
12
|
+
return err.stack;
|
|
13
|
+
}
|
|
14
|
+
if (err && typeof err === 'object' && 'message' in err && typeof err.message === 'string') {
|
|
15
|
+
return err.message;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
return JSON.stringify(err);
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
return String(err);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
25
|
+
const __dirname = path.dirname(__filename);
|
|
26
|
+
// CDN base for docs. Can be overridden via env variable.
|
|
27
|
+
const DEFAULT_CDN_BASE = (_a = process.env.DOCS_CDN_BASE) !== null && _a !== void 0 ? _a : 'https://reactspectrum.blob.core.windows.net/reactspectrum/7d2883a56fb1a0554864b21324d405f758deb3ce/s2-docs';
|
|
28
|
+
function libBaseUrl(library) {
|
|
29
|
+
return `${DEFAULT_CDN_BASE}/${library}`;
|
|
30
|
+
}
|
|
31
|
+
async function fetchText(url, timeoutMs = 15000) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const ctrl = new AbortController();
|
|
34
|
+
const id = (_b = (_a = setTimeout(() => ctrl.abort(), timeoutMs)).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
35
|
+
try {
|
|
36
|
+
const res = await fetch(url, { signal: ctrl.signal, cache: 'no-store' });
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
throw new Error(`HTTP ${res.status} for ${url}`);
|
|
39
|
+
}
|
|
40
|
+
return await res.text();
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
clearTimeout(id);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Cache of parsed pages
|
|
47
|
+
const pageCache = new Map();
|
|
48
|
+
let iconIdCache = null;
|
|
49
|
+
let illustrationIdCache = null;
|
|
50
|
+
let iconAliasesCache = null;
|
|
51
|
+
let illustrationAliasesCache = null;
|
|
52
|
+
function readBundledJson(filename) {
|
|
53
|
+
try {
|
|
54
|
+
const p = path.resolve(__dirname, 'data', filename); // dist/data
|
|
55
|
+
if (!fs.existsSync(p)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const txt = fs.readFileSync(p, 'utf8');
|
|
59
|
+
return JSON.parse(txt);
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function listIconNames() {
|
|
66
|
+
if (iconIdCache) {
|
|
67
|
+
return iconIdCache;
|
|
68
|
+
}
|
|
69
|
+
const bundled = readBundledJson('icons.json');
|
|
70
|
+
return (iconIdCache = Array.isArray(bundled) ? bundled.slice().sort((a, b) => a.localeCompare(b)) : []);
|
|
71
|
+
}
|
|
72
|
+
function listIllustrationNames() {
|
|
73
|
+
if (illustrationIdCache) {
|
|
74
|
+
return illustrationIdCache;
|
|
75
|
+
}
|
|
76
|
+
const bundled = readBundledJson('illustrations.json');
|
|
77
|
+
return (illustrationIdCache = Array.isArray(bundled) ? bundled.slice().sort((a, b) => a.localeCompare(b)) : []);
|
|
78
|
+
}
|
|
79
|
+
async function loadIconAliases() {
|
|
80
|
+
if (iconAliasesCache) {
|
|
81
|
+
return iconAliasesCache;
|
|
82
|
+
}
|
|
83
|
+
const bundled = readBundledJson('iconAliases.json');
|
|
84
|
+
return (iconAliasesCache = (bundled && typeof bundled === 'object') ? bundled : {});
|
|
85
|
+
}
|
|
86
|
+
async function loadIllustrationAliases() {
|
|
87
|
+
if (illustrationAliasesCache) {
|
|
88
|
+
return illustrationAliasesCache;
|
|
89
|
+
}
|
|
90
|
+
const bundled = readBundledJson('illustrationAliases.json');
|
|
91
|
+
return (illustrationAliasesCache = (bundled && typeof bundled === 'object') ? bundled : {});
|
|
92
|
+
}
|
|
93
|
+
// Whether we've loaded the page index for a library yet.
|
|
94
|
+
const pageIndexLoaded = new Set();
|
|
95
|
+
// Build a lightweight index of pages for the given library from the CDN's llms.txt.
|
|
96
|
+
// Populates pageCache with stubs (title from filename; description/sections omitted).
|
|
97
|
+
async function buildPageIndex(library) {
|
|
98
|
+
if (pageIndexLoaded.has(library)) {
|
|
99
|
+
return Array.from(pageCache.values()).filter(p => p.key.startsWith(`${library}/`));
|
|
100
|
+
}
|
|
101
|
+
const pages = [];
|
|
102
|
+
// Read llms.txt to enumerate available pages without downloading them all.
|
|
103
|
+
const llmsUrl = `${libBaseUrl(library)}/llms.txt`;
|
|
104
|
+
const txt = await fetchText(llmsUrl);
|
|
105
|
+
const re = /^\s*-\s*\[([^\]]+)\]\(([^)]+)\)\s*$/;
|
|
106
|
+
for (const line of txt.split(/\r?\n/)) {
|
|
107
|
+
const m = line.match(re);
|
|
108
|
+
if (!m) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const display = (m[1] || '').trim();
|
|
112
|
+
const href = (m[2] || '').trim();
|
|
113
|
+
if (!href || !/\.md$/i.test(href)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const key = href.replace(/\.md$/i, '').replace(/\\/g, '/');
|
|
117
|
+
const title = display || path.basename(key);
|
|
118
|
+
const url = `${DEFAULT_CDN_BASE}/${key}.md`;
|
|
119
|
+
const info = { key, title, description: undefined, filePath: url, sections: [] };
|
|
120
|
+
pages.push(info);
|
|
121
|
+
pageCache.set(info.key, info);
|
|
122
|
+
}
|
|
123
|
+
pageIndexLoaded.add(library);
|
|
124
|
+
return pages.sort((a, b) => a.key.localeCompare(b.key));
|
|
125
|
+
}
|
|
126
|
+
function parseSectionsFromMarkdown(lines) {
|
|
127
|
+
const sections = [];
|
|
128
|
+
let inCode = false;
|
|
129
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
130
|
+
const line = lines[idx];
|
|
131
|
+
if (/^```/.test(line.trim())) {
|
|
132
|
+
inCode = !inCode;
|
|
133
|
+
}
|
|
134
|
+
if (inCode) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (line.startsWith('## ')) {
|
|
138
|
+
const name = line.replace(/^##\s+/, '').trim();
|
|
139
|
+
sections.push({ name, startLine: idx, endLine: lines.length });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (let s = 0; s < sections.length - 1; s++) {
|
|
143
|
+
sections[s].endLine = sections[s + 1].startLine;
|
|
144
|
+
}
|
|
145
|
+
return sections;
|
|
146
|
+
}
|
|
147
|
+
function extractTitleAndDescription(lines) {
|
|
148
|
+
let title = '';
|
|
149
|
+
let description = undefined;
|
|
150
|
+
let i = 0;
|
|
151
|
+
for (; i < lines.length; i++) {
|
|
152
|
+
const line = lines[i];
|
|
153
|
+
if (line.startsWith('# ')) {
|
|
154
|
+
title = line.replace(/^#\s+/, '').trim();
|
|
155
|
+
i++;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
let descLines = [];
|
|
160
|
+
let inCode = false;
|
|
161
|
+
for (; i < lines.length; i++) {
|
|
162
|
+
const line = lines[i];
|
|
163
|
+
if (/^```/.test(line.trim())) {
|
|
164
|
+
inCode = !inCode;
|
|
165
|
+
}
|
|
166
|
+
if (inCode) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (line.trim() === '') {
|
|
170
|
+
if (descLines.length > 0) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (/^#{1,6}\s/.test(line) || /^</.test(line.trim())) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
descLines.push(line);
|
|
181
|
+
}
|
|
182
|
+
if (descLines.length > 0) {
|
|
183
|
+
description = descLines.join('\n').trim();
|
|
184
|
+
}
|
|
185
|
+
return { title, description };
|
|
186
|
+
}
|
|
187
|
+
async function ensureParsedPage(info) {
|
|
188
|
+
if (info.sections && info.sections.length > 0 && info.description !== undefined) {
|
|
189
|
+
return info;
|
|
190
|
+
}
|
|
191
|
+
const text = await fetchText(info.filePath);
|
|
192
|
+
const lines = text.split(/\r?\n/);
|
|
193
|
+
const { title, description } = extractTitleAndDescription(lines);
|
|
194
|
+
const sections = parseSectionsFromMarkdown(lines);
|
|
195
|
+
const updated = { ...info, title: title || info.title, description, sections };
|
|
196
|
+
pageCache.set(updated.key, updated);
|
|
197
|
+
return updated;
|
|
198
|
+
}
|
|
199
|
+
async function resolvePageRef(library, pageName) {
|
|
200
|
+
// Ensure index is loaded
|
|
201
|
+
await buildPageIndex(library);
|
|
202
|
+
if (pageCache.has(pageName)) {
|
|
203
|
+
return pageCache.get(pageName);
|
|
204
|
+
}
|
|
205
|
+
if (pageName.includes('/')) {
|
|
206
|
+
const normalized = pageName.replace(/\\/g, '/');
|
|
207
|
+
const prefix = normalized.split('/', 1)[0];
|
|
208
|
+
if (prefix !== library) {
|
|
209
|
+
throw new Error(`Page '${pageName}' is not in the '${library}' library.`);
|
|
210
|
+
}
|
|
211
|
+
const maybe = pageCache.get(normalized);
|
|
212
|
+
if (maybe) {
|
|
213
|
+
return maybe;
|
|
214
|
+
}
|
|
215
|
+
const filePath = `${DEFAULT_CDN_BASE}/${normalized}.md`;
|
|
216
|
+
const stub = { key: normalized, title: path.basename(normalized), description: undefined, filePath, sections: [] };
|
|
217
|
+
pageCache.set(stub.key, stub);
|
|
218
|
+
return stub;
|
|
219
|
+
}
|
|
220
|
+
const key = `${library}/${pageName}`;
|
|
221
|
+
const maybe = pageCache.get(key);
|
|
222
|
+
if (maybe) {
|
|
223
|
+
return maybe;
|
|
224
|
+
}
|
|
225
|
+
const filePath = `${DEFAULT_CDN_BASE}/${key}.md`;
|
|
226
|
+
const stub = { key, title: pageName, description: undefined, filePath, sections: [] };
|
|
227
|
+
pageCache.set(stub.key, stub);
|
|
228
|
+
return stub;
|
|
229
|
+
}
|
|
230
|
+
async function startServer(library) {
|
|
231
|
+
const server = new McpServer({
|
|
232
|
+
name: library === 's2' ? 's2-docs-server' : 'react-aria-docs-server',
|
|
233
|
+
version: '0.1.0'
|
|
234
|
+
});
|
|
235
|
+
// Build page index at startup.
|
|
236
|
+
try {
|
|
237
|
+
await buildPageIndex(library);
|
|
238
|
+
}
|
|
239
|
+
catch (e) {
|
|
240
|
+
console.warn(`Warning: failed to load ${library} docs index (${errorToString(e)}).`);
|
|
241
|
+
}
|
|
242
|
+
// list_pages tool
|
|
243
|
+
server.registerTool('list_pages', {
|
|
244
|
+
title: library === 's2' ? 'List React Spectrum (@react-spectrum/s2) docs pages' : 'List React Aria docs pages',
|
|
245
|
+
description: `Returns a list of available pages in the ${library} docs.`,
|
|
246
|
+
inputSchema: { includeDescription: z.boolean().optional() }
|
|
247
|
+
}, async ({ includeDescription }) => {
|
|
248
|
+
const pages = await buildPageIndex(library);
|
|
249
|
+
const items = pages
|
|
250
|
+
.sort((a, b) => a.key.localeCompare(b.key))
|
|
251
|
+
.map(p => { var _a; return includeDescription ? { key: p.key, title: p.title, description: (_a = p.description) !== null && _a !== void 0 ? _a : '' } : { key: p.key, title: p.title }; });
|
|
252
|
+
return {
|
|
253
|
+
content: [{ type: 'text', text: JSON.stringify(items, null, 2) }]
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
// get_page_info tool
|
|
257
|
+
server.registerTool('get_page_info', {
|
|
258
|
+
title: 'Get page info',
|
|
259
|
+
description: 'Returns page description and list of sections for a given page.',
|
|
260
|
+
inputSchema: { page_name: z.string() }
|
|
261
|
+
}, async ({ page_name }) => {
|
|
262
|
+
var _a;
|
|
263
|
+
const ref = await resolvePageRef(library, page_name);
|
|
264
|
+
const info = await ensureParsedPage(ref);
|
|
265
|
+
const out = {
|
|
266
|
+
key: info.key,
|
|
267
|
+
title: info.title,
|
|
268
|
+
description: (_a = info.description) !== null && _a !== void 0 ? _a : '',
|
|
269
|
+
sections: info.sections.map(s => s.name)
|
|
270
|
+
};
|
|
271
|
+
return { content: [{ type: 'text', text: JSON.stringify(out, null, 2) }] };
|
|
272
|
+
});
|
|
273
|
+
// get_page tool
|
|
274
|
+
server.registerTool('get_page', {
|
|
275
|
+
title: 'Get page markdown',
|
|
276
|
+
description: 'Returns the full markdown content for a page, or a specific section if provided.',
|
|
277
|
+
inputSchema: { page_name: z.string(), section_name: z.string().optional() }
|
|
278
|
+
}, async ({ page_name, section_name }) => {
|
|
279
|
+
const ref = await resolvePageRef(library, page_name);
|
|
280
|
+
let text;
|
|
281
|
+
text = await fetchText(ref.filePath);
|
|
282
|
+
if (!section_name) {
|
|
283
|
+
return { content: [{ type: 'text', text }] };
|
|
284
|
+
}
|
|
285
|
+
const lines = text.split(/\r?\n/);
|
|
286
|
+
const sections = parseSectionsFromMarkdown(lines);
|
|
287
|
+
let section = sections.find(s => s.name === section_name);
|
|
288
|
+
if (!section) {
|
|
289
|
+
section = sections.find(s => s.name.toLowerCase() === section_name.toLowerCase());
|
|
290
|
+
}
|
|
291
|
+
if (!section) {
|
|
292
|
+
const available = sections.map(s => s.name).join(', ');
|
|
293
|
+
throw new Error(`Section '${section_name}' not found in ${ref.key}. Available: ${available}`);
|
|
294
|
+
}
|
|
295
|
+
const snippet = lines.slice(section.startLine, section.endLine).join('\n');
|
|
296
|
+
return { content: [{ type: 'text', text: snippet }] };
|
|
297
|
+
});
|
|
298
|
+
if (library === 's2') {
|
|
299
|
+
// search_icons tool
|
|
300
|
+
server.registerTool('search_icons', {
|
|
301
|
+
title: 'Search S2 icons',
|
|
302
|
+
description: 'Searches the S2 workflow icon set by one or more terms; returns matching icon names.',
|
|
303
|
+
inputSchema: { terms: z.union([z.string(), z.array(z.string())]) }
|
|
304
|
+
}, async ({ terms }) => {
|
|
305
|
+
const allNames = listIconNames();
|
|
306
|
+
const nameSet = new Set(allNames);
|
|
307
|
+
const aliases = await loadIconAliases();
|
|
308
|
+
const rawTerms = Array.isArray(terms) ? terms : [terms];
|
|
309
|
+
const normalized = Array.from(new Set(rawTerms.map(t => String(t !== null && t !== void 0 ? t : '').trim().toLowerCase()).filter(Boolean)));
|
|
310
|
+
if (normalized.length === 0) {
|
|
311
|
+
throw new Error('Provide at least one non-empty search term.');
|
|
312
|
+
}
|
|
313
|
+
// direct name matches
|
|
314
|
+
const results = new Set(allNames.filter(name => {
|
|
315
|
+
const nameLower = name.toLowerCase();
|
|
316
|
+
return normalized.some(term => nameLower.includes(term));
|
|
317
|
+
}));
|
|
318
|
+
// alias matches
|
|
319
|
+
for (const [aliasKey, targets] of Object.entries(aliases)) {
|
|
320
|
+
if (!targets || targets.length === 0) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const aliasLower = aliasKey.toLowerCase();
|
|
324
|
+
if (normalized.some(term => aliasLower.includes(term) || term.includes(aliasLower))) {
|
|
325
|
+
for (const t of targets) {
|
|
326
|
+
const n = String(t);
|
|
327
|
+
if (nameSet.has(n)) {
|
|
328
|
+
results.add(n);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return { content: [{ type: 'text', text: JSON.stringify(Array.from(results).sort((a, b) => a.localeCompare(b)), null, 2) }] };
|
|
334
|
+
});
|
|
335
|
+
// search_illustrations tool
|
|
336
|
+
server.registerTool('search_illustrations', {
|
|
337
|
+
title: 'Search S2 illustrations',
|
|
338
|
+
description: 'Searches the S2 illustrations set by one or more terms; returns matching illustration names.',
|
|
339
|
+
inputSchema: { terms: z.union([z.string(), z.array(z.string())]) }
|
|
340
|
+
}, async ({ terms }) => {
|
|
341
|
+
const allNames = listIllustrationNames();
|
|
342
|
+
const nameSet = new Set(allNames);
|
|
343
|
+
const aliases = await loadIllustrationAliases();
|
|
344
|
+
const rawTerms = Array.isArray(terms) ? terms : [terms];
|
|
345
|
+
const normalized = Array.from(new Set(rawTerms.map(t => String(t !== null && t !== void 0 ? t : '').trim().toLowerCase()).filter(Boolean)));
|
|
346
|
+
if (normalized.length === 0) {
|
|
347
|
+
throw new Error('Provide at least one non-empty search term.');
|
|
348
|
+
}
|
|
349
|
+
// direct name matches
|
|
350
|
+
const results = new Set(allNames.filter(name => {
|
|
351
|
+
const nameLower = name.toLowerCase();
|
|
352
|
+
return normalized.some(term => nameLower.includes(term));
|
|
353
|
+
}));
|
|
354
|
+
// alias matches
|
|
355
|
+
for (const [aliasKey, targets] of Object.entries(aliases)) {
|
|
356
|
+
if (!targets || targets.length === 0) {
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const aliasLower = aliasKey.toLowerCase();
|
|
360
|
+
if (normalized.some(term => aliasLower.includes(term) || term.includes(aliasLower))) {
|
|
361
|
+
for (const t of targets) {
|
|
362
|
+
const n = String(t);
|
|
363
|
+
if (nameSet.has(n)) {
|
|
364
|
+
results.add(n);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return { content: [{ type: 'text', text: JSON.stringify(Array.from(results).sort((a, b) => a.localeCompare(b)), null, 2) }] };
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
const transport = new StdioServerTransport();
|
|
373
|
+
await server.connect(transport);
|
|
374
|
+
}
|
|
375
|
+
function printUsage() {
|
|
376
|
+
const usage = 'Usage: mcp <subcommand>\n\nSubcommands:\n s2 Start MCP server for React Spectrum S2 docs\n react-aria Start MCP server for React Aria docs\n\nEnvironment:\n\nExamples:\n npx @react-spectrum/mcp s2\n npx @react-spectrum/mcp react-aria';
|
|
377
|
+
console.log(usage);
|
|
378
|
+
}
|
|
379
|
+
// CLI entry
|
|
380
|
+
(async () => {
|
|
381
|
+
try {
|
|
382
|
+
const arg = (process.argv[2] || '').trim();
|
|
383
|
+
if (arg === '--help' || arg === '-h' || arg === 'help') {
|
|
384
|
+
printUsage();
|
|
385
|
+
process.exit(0);
|
|
386
|
+
}
|
|
387
|
+
const library = arg === 'react-aria' ? 'react-aria' : 's2';
|
|
388
|
+
await startServer(library);
|
|
389
|
+
}
|
|
390
|
+
catch (err) {
|
|
391
|
+
console.error(errorToString(err));
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
394
|
+
})();
|
|
395
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,8B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AC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,OAAO,GAAY,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;QACpE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/mcp",
|
|
3
|
-
"version": "3.0.0-nightly-
|
|
3
|
+
"version": "3.0.0-nightly-d422ecee5-251003",
|
|
4
4
|
"description": "MCP server for React Spectrum (S2) and React Aria documentation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "dist/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"prepublishOnly": "yarn build",
|
|
8
9
|
"build": "node ./scripts/build-data.mjs && tsc -p tsconfig.json",
|
|
9
10
|
"start": "node dist/index.js",
|
|
10
11
|
"dev": "node --enable-source-maps dist/index.js"
|