react-docs-mcp 1.0.6 → 1.2.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/dist/index.js CHANGED
@@ -1,272 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * index.ts
4
- * MCP server entry point implementing the protocol
4
+ * react-docs-mcp entry point: configures the shared engine for react.dev
5
+ * and starts the MCP server.
5
6
  */
6
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
8
- import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
9
- import { z } from 'zod';
10
- import { DocsManager } from './docsManager.js';
11
- import { SearchEngine } from './searchEngine.js';
12
- import { summarizeContent, extractStructure } from './summarizer.js';
13
- import CONFIG from './config.js';
14
- // Initialize components
15
- const docsManager = new DocsManager();
16
- const searchEngine = new SearchEngine(docsManager);
17
- // Create MCP server
18
- const server = new Server({
19
- name: CONFIG.server.name,
20
- version: CONFIG.server.version,
21
- }, {
22
- capabilities: {
23
- resources: {},
24
- tools: {},
25
- },
26
- });
27
- // Tool input schemas
28
- const searchDocsSchema = z.object({
29
- query: z.string().describe('Search query string'),
30
- section: z.string().optional().describe('Filter by section (learn, reference, blog, community)'),
31
- limit: z.number().min(1).max(CONFIG.search.maxLimit).optional().describe('Maximum number of results'),
32
- });
33
- const getDocSchema = z.object({
34
- path: z.string().describe('Document path (e.g., "learn/hooks/useState")'),
35
- });
36
- // Register list resources handler
37
- server.setRequestHandler(ListResourcesRequestSchema, async () => {
38
- return {
39
- resources: [
40
- {
41
- uri: 'react-docs://learn',
42
- name: 'React Learn Documentation',
43
- description: 'Interactive React tutorial and learning materials',
44
- mimeType: 'text/plain',
45
- },
46
- {
47
- uri: 'react-docs://reference',
48
- name: 'React API Reference',
49
- description: 'Complete React API reference documentation',
50
- mimeType: 'text/plain',
51
- },
52
- {
53
- uri: 'react-docs://blog',
54
- name: 'React Blog',
55
- description: 'React team blog posts and announcements',
56
- mimeType: 'text/plain',
57
- },
58
- ],
59
- };
60
- });
61
- // Register read resource handler
62
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
63
- const uri = request.params.uri.toString();
64
- // Parse URI: react-docs://{section}/{path}
65
- const match = uri.match(/^react-docs:\/\/(.+)$/);
66
- if (!match) {
67
- throw new Error(`Invalid resource URI: ${uri}`);
68
- }
69
- const resourcePath = match[1];
70
- // If requesting just a section, list docs in that section
71
- if (CONFIG.sections.includes(resourcePath)) {
72
- const docs = await searchEngine.getDocsBySection(resourcePath);
73
- const docList = docs
74
- .map(doc => `- ${doc.metadata.title} (${doc.path})`)
75
- .join('\n');
76
- return {
77
- contents: [
78
- {
79
- uri,
80
- mimeType: 'text/plain',
81
- text: `# ${resourcePath} Documentation\n\nAvailable documents:\n\n${docList}`,
82
- },
83
- ],
84
- };
85
- }
86
- // Otherwise, fetch specific document
87
- const doc = await searchEngine.getDocByPath(resourcePath);
88
- if (!doc) {
89
- throw new Error(`Document not found: ${resourcePath}`);
90
- }
91
- return {
92
- contents: [
93
- {
94
- uri,
95
- mimeType: 'text/markdown',
96
- text: `# ${doc.metadata.title}\n\n${doc.content}`,
97
- },
98
- ],
99
- };
100
- });
101
- // Register list tools handler
102
- server.setRequestHandler(ListToolsRequestSchema, async () => {
103
- return {
104
- tools: [
105
- {
106
- name: 'search_react_docs',
107
- description: 'Search across React documentation. Returns relevant documentation pages with snippets.',
108
- inputSchema: {
109
- type: 'object',
110
- properties: {
111
- query: {
112
- type: 'string',
113
- description: 'Search query string',
114
- },
115
- section: {
116
- type: 'string',
117
- description: 'Filter by section (learn, reference, blog, community)',
118
- enum: [...CONFIG.sections],
119
- },
120
- limit: {
121
- type: 'number',
122
- description: 'Maximum number of results',
123
- minimum: 1,
124
- maximum: CONFIG.search.maxLimit,
125
- },
126
- },
127
- required: ['query'],
128
- },
129
- },
130
- {
131
- name: 'list_sections',
132
- description: 'List all available documentation sections',
133
- inputSchema: {
134
- type: 'object',
135
- properties: {},
136
- },
137
- },
138
- {
139
- name: 'get_doc',
140
- description: 'Get a concise summary of a documentation page (~1500 chars). Use search_react_docs first - only call this if you need more detail than the search snippet provides.',
141
- inputSchema: {
142
- type: 'object',
143
- properties: {
144
- path: {
145
- type: 'string',
146
- description: 'Document path (e.g., "learn/hooks/useState")',
147
- },
148
- },
149
- required: ['path'],
150
- },
151
- },
152
- {
153
- name: 'update_docs',
154
- description: 'Pull latest documentation from Git repository',
155
- inputSchema: {
156
- type: 'object',
157
- properties: {},
158
- },
159
- },
160
- ],
161
- };
162
- });
163
- // Register call tool handler
164
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
165
- const { name, arguments: args } = request.params;
166
- try {
167
- switch (name) {
168
- case 'search_react_docs': {
169
- const { query, section, limit } = searchDocsSchema.parse(args);
170
- const results = await searchEngine.search(query, { section, limit });
171
- return {
172
- content: [
173
- {
174
- type: 'text',
175
- text: JSON.stringify(results.map(r => ({
176
- path: r.doc.path,
177
- title: r.doc.metadata.title,
178
- snippet: r.snippet,
179
- score: r.score,
180
- url: `https://react.dev/${r.doc.path}`,
181
- })), null, 2),
182
- },
183
- ],
184
- };
185
- }
186
- case 'list_sections': {
187
- const sections = searchEngine.getSections();
188
- return {
189
- content: [
190
- {
191
- type: 'text',
192
- text: JSON.stringify(sections, null, 2),
193
- },
194
- ],
195
- };
196
- }
197
- case 'get_doc': {
198
- const { path } = getDocSchema.parse(args);
199
- const doc = await searchEngine.getDocByPath(path);
200
- if (!doc) {
201
- throw new Error(`Document not found: ${path}`);
202
- }
203
- // Return concise summary instead of full content
204
- const summary = summarizeContent(doc.content, 1500);
205
- const structure = extractStructure(doc.content);
206
- return {
207
- content: [
208
- {
209
- type: 'text',
210
- text: JSON.stringify({
211
- path: doc.path,
212
- section: doc.section,
213
- title: doc.metadata.title,
214
- description: doc.metadata.description,
215
- summary,
216
- structure,
217
- url: `https://react.dev/${doc.path}`,
218
- note: 'This is a summary. Visit the URL for full documentation.',
219
- }, null, 2),
220
- },
221
- ],
222
- };
223
- }
224
- case 'update_docs': {
225
- const updated = await docsManager.updateRepo();
226
- if (updated) {
227
- // Re-index documents after update
228
- await searchEngine.indexDocuments();
229
- }
230
- return {
231
- content: [
232
- {
233
- type: 'text',
234
- text: JSON.stringify({
235
- updated,
236
- message: updated
237
- ? 'Documentation updated successfully'
238
- : 'Documentation already up to date',
239
- }, null, 2),
240
- },
241
- ],
242
- };
243
- }
244
- default:
245
- throw new Error(`Unknown tool: ${name}`);
246
- }
247
- }
248
- catch (error) {
249
- if (error instanceof z.ZodError) {
250
- throw new Error(`Invalid arguments: ${error.message}`);
251
- }
252
- throw error;
253
- }
254
- });
255
- // Start server
256
- async function main() {
257
- console.error('Initializing React Docs MCP Server...');
258
- try {
259
- // Initialize repository
260
- await docsManager.initialize();
261
- // Start server with stdio transport
262
- const transport = new StdioServerTransport();
263
- await server.connect(transport);
264
- console.error('React Docs MCP Server running');
265
- }
266
- catch (error) {
267
- console.error('Failed to start server:', error);
268
- process.exit(1);
269
- }
7
+ import { configure } from './config.js';
8
+ import { reactDocsPreset } from './presets/reactDocs.js';
9
+ import { createServer } from './server.js';
10
+ // package.json's postinstall runs `node dist/index.js --version`; without this
11
+ // guard that would start the server and clone the docs repo during npm install.
12
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
13
+ console.log(reactDocsPreset.server.version);
14
+ process.exit(0);
270
15
  }
271
- main();
16
+ configure(reactDocsPreset);
17
+ createServer().catch(error => {
18
+ console.error('Failed to start server:', error);
19
+ process.exit(1);
20
+ });
272
21
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAA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+22,13 @@ export declare function markdownToPlainText(markdown: string): Promise<string>;
22
22
  * E.g., "learn/hooks/useState.md" -> "learn"
23
23
  */
24
24
  export declare function extractSection(path: string): string;
25
+ /**
26
+ * Normalize path (forward slashes, no leading slash, no .md extension for display)
27
+ */
28
+ export declare function normalizePath(filePath: string): string;
29
+ /**
30
+ * Convert a kebab-case or snake_case slug to Title Case
31
+ * E.g., "the-new-architecture" -> "The New Architecture"
32
+ */
33
+ export declare function titleCase(slug: string): string;
25
34
  //# sourceMappingURL=markdownParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownParser.d.ts","sourceRoot":"","sources":["../src/markdownParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,SAAS,CAAC,CA2BpB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD"}
1
+ {"version":3,"file":"markdownParser.d.ts","sourceRoot":"","sources":["../src/markdownParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,SAAS,CAAC,CA2BpB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM9C"}
@@ -61,11 +61,22 @@ export function extractSection(path) {
61
61
  /**
62
62
  * Normalize path (forward slashes, no leading slash, no .md extension for display)
63
63
  */
64
- function normalizePath(filePath) {
64
+ export function normalizePath(filePath) {
65
65
  return filePath
66
66
  .replace(/\\/g, '/') // Convert backslashes to forward slashes
67
67
  .replace(/^\/+/, '') // Remove leading slashes
68
- .replace(/\.md$/, ''); // Remove .md extension for cleaner paths
68
+ .replace(/\.mdx?$/, ''); // Remove .md/.mdx extension for cleaner paths
69
+ }
70
+ /**
71
+ * Convert a kebab-case or snake_case slug to Title Case
72
+ * E.g., "the-new-architecture" -> "The New Architecture"
73
+ */
74
+ export function titleCase(slug) {
75
+ return slug
76
+ .replace(/[-_]/g, ' ')
77
+ .split(' ')
78
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
79
+ .join(' ');
69
80
  }
70
81
  /**
71
82
  * Extract title from path if not in frontmatter
@@ -75,11 +86,6 @@ function extractTitleFromPath(filePath) {
75
86
  const normalized = normalizePath(filePath);
76
87
  const parts = normalized.split('/');
77
88
  const filename = parts[parts.length - 1] || 'Untitled';
78
- // Convert kebab-case or snake_case to Title Case
79
- return filename
80
- .replace(/[-_]/g, ' ')
81
- .split(' ')
82
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
83
- .join(' ');
89
+ return titleCase(filename);
84
90
  }
85
91
  //# sourceMappingURL=markdownParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownParser.js","sourceRoot":"","sources":["../src/markdownParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,aAAa,MAAM,gBAAgB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AC,KAAK,EAAE,GAAG,CAAC,CAAC,yCAAyC;SAC7D,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,yBAAyB;SAC7C,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,8CAA8C;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACzD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC;IAEvD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * reactDocs.ts
3
+ * Preset for the default react-docs-mcp package: github.com/reactjs/react.dev.git
4
+ */
5
+ import type { DocsMcpPreset } from '../config.js';
6
+ export declare const reactDocsPreset: DocsMcpPreset;
7
+ //# sourceMappingURL=reactDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactDocs.d.ts","sourceRoot":"","sources":["../../src/presets/reactDocs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,eAAe,EAAE,aAqC7B,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * reactDocs.ts
3
+ * Preset for the default react-docs-mcp package: github.com/reactjs/react.dev.git
4
+ */
5
+ import { DEFAULT_SEARCH } from './searchDefaults.js';
6
+ export const reactDocsPreset = {
7
+ cacheDirName: 'react-docs-mcp',
8
+ repoFolderName: 'react-dev-repo',
9
+ repo: {
10
+ url: 'https://github.com/reactjs/react.dev.git',
11
+ contentPath: 'src/content',
12
+ },
13
+ search: { ...DEFAULT_SEARCH },
14
+ server: {
15
+ name: 'react-docs-mcp',
16
+ version: '1.2.0',
17
+ },
18
+ sections: ['learn', 'reference', 'blog', 'community'],
19
+ resourceUriScheme: 'react-docs',
20
+ docsLabel: 'React',
21
+ searchToolName: 'search_react_docs',
22
+ searchToolDescription: 'Search across React documentation. Returns relevant documentation pages with snippets.',
23
+ pathExample: 'reference/react/useState',
24
+ docUrl: { base: 'https://react.dev', useFrontmatterId: false },
25
+ sectionResourceOverrides: {
26
+ learn: {
27
+ name: 'React Learn Documentation',
28
+ description: 'Interactive React tutorial and learning materials',
29
+ },
30
+ reference: {
31
+ name: 'React API Reference',
32
+ description: 'Complete React API reference documentation',
33
+ },
34
+ blog: {
35
+ name: 'React Blog',
36
+ description: 'React team blog posts and announcements',
37
+ },
38
+ community: {
39
+ name: 'React Community Documentation',
40
+ description: 'Community resources, code of conduct, and translations',
41
+ },
42
+ },
43
+ };
44
+ //# sourceMappingURL=reactDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactDocs.js","sourceRoot":"","sources":["../../src/presets/reactDocs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,YAAY,EAAE,gBAAgB;IAC9B,cAAc,EAAE,gBAAgB;IAChC,IAAI,EAAE;QACJ,GAAG,EAAE,0CAA0C;QAC/C,WAAW,EAAE,aAAa;KAC3B;IACD,MAAM,EAAE,EAAE,GAAG,cAAc,EAAE;IAC7B,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,OAAO;KACjB;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC;IACrD,iBAAiB,EAAE,YAAY;IAC/B,SAAS,EAAE,OAAO;IAClB,cAAc,EAAE,mBAAmB;IACnC,qBAAqB,EAAE,wFAAwF;IAC/G,WAAW,EAAE,0BAA0B;IACvC,MAAM,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE;IAC9D,wBAAwB,EAAE;QACxB,KAAK,EAAE;YACL,IAAI,EAAE,2BAA2B;YACjC,WAAW,EAAE,mDAAmD;SACjE;QACD,SAAS,EAAE;YACT,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EAAE,4CAA4C;SAC1D;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,yCAAyC;SACvD;QACD,SAAS,EAAE;YACT,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,wDAAwD;SACtE;KACF;CACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * reactNativeDocs.ts
3
+ * Preset for react-native-docs-mcp: github.com/facebook/react-native-website.git
4
+ *
5
+ * Structure verified directly against the repo (Docusaurus-based):
6
+ * - Docs live at root `docs/` (not under `website/`), 230 .md + 9 .mdx files.
7
+ * - 213 of 241 files sit flat at `docs/` root with no section; only
8
+ * `the-new-architecture/`, `legacy/`, and `releases/` are real subfolders
9
+ * (older versioned snapshots may lack some — the server filters advertised
10
+ * sections to those that exist on disk at runtime).
11
+ * - "latest" targets the unversioned root `docs/` folder; pinned versions
12
+ * target `website/versioned_docs/version-X.YY/` inside the same clone.
13
+ * - Docusaurus routes by frontmatter `id` when present (in all versions), so
14
+ * the engine resolves ids into canonical doc paths/slugs at index time
15
+ * (docUrl.useFrontmatterId).
16
+ * - website/blog/ is a separate content root and is out of scope for v1.
17
+ */
18
+ import type { DocsMcpPreset } from '../config.js';
19
+ export declare const LATEST_VERSION = "latest";
20
+ export declare function resolveReactNativeDocsPreset(version?: string): DocsMcpPreset;
21
+ //# sourceMappingURL=reactNativeDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactNativeDocs.d.ts","sourceRoot":"","sources":["../../src/presets/reactNativeDocs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,wBAAgB,4BAA4B,CAAC,OAAO,GAAE,MAAuB,GAAG,aAAa,CAkC5F"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * reactNativeDocs.ts
3
+ * Preset for react-native-docs-mcp: github.com/facebook/react-native-website.git
4
+ *
5
+ * Structure verified directly against the repo (Docusaurus-based):
6
+ * - Docs live at root `docs/` (not under `website/`), 230 .md + 9 .mdx files.
7
+ * - 213 of 241 files sit flat at `docs/` root with no section; only
8
+ * `the-new-architecture/`, `legacy/`, and `releases/` are real subfolders
9
+ * (older versioned snapshots may lack some — the server filters advertised
10
+ * sections to those that exist on disk at runtime).
11
+ * - "latest" targets the unversioned root `docs/` folder; pinned versions
12
+ * target `website/versioned_docs/version-X.YY/` inside the same clone.
13
+ * - Docusaurus routes by frontmatter `id` when present (in all versions), so
14
+ * the engine resolves ids into canonical doc paths/slugs at index time
15
+ * (docUrl.useFrontmatterId).
16
+ * - website/blog/ is a separate content root and is out of scope for v1.
17
+ */
18
+ import { DEFAULT_SEARCH } from './searchDefaults.js';
19
+ export const LATEST_VERSION = 'latest';
20
+ export function resolveReactNativeDocsPreset(version = LATEST_VERSION) {
21
+ const isLatest = version === LATEST_VERSION;
22
+ if (!isLatest && !/^\d+\.\d+$/.test(version)) {
23
+ throw new Error(`Invalid React Native docs version "${version}". Expected a release like "0.77" or "${LATEST_VERSION}".`);
24
+ }
25
+ return {
26
+ cacheDirName: 'react-native-docs-mcp',
27
+ repoFolderName: 'react-native-website-repo',
28
+ repo: {
29
+ url: 'https://github.com/facebook/react-native-website.git',
30
+ contentPath: isLatest ? 'docs' : `website/versioned_docs/version-${version}`,
31
+ },
32
+ search: { ...DEFAULT_SEARCH },
33
+ server: {
34
+ name: 'react-native-docs-mcp',
35
+ version: '0.2.0',
36
+ },
37
+ sections: ['the-new-architecture', 'legacy', 'releases'],
38
+ resourceUriScheme: 'react-native-docs',
39
+ docsLabel: 'React Native',
40
+ searchToolName: 'search_react_native_docs',
41
+ searchToolDescription: 'Search across React Native documentation. Returns relevant documentation pages with snippets.',
42
+ pathExample: 'the-new-architecture/using-codegen',
43
+ docUrl: {
44
+ base: isLatest ? 'https://reactnative.dev/docs' : `https://reactnative.dev/docs/${version}`,
45
+ // Frontmatter-id routing is a property of the Docusaurus content format,
46
+ // not of the version — versioned snapshots carry the same id overrides
47
+ useFrontmatterId: true,
48
+ },
49
+ };
50
+ }
51
+ //# sourceMappingURL=reactNativeDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactNativeDocs.js","sourceRoot":"","sources":["../../src/presets/reactNativeDocs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC,MAAM,UAAU,4BAA4B,CAAC,UAAkB,cAAc;IAC3E,MAAM,QAAQ,GAAG,OAAO,KAAK,cAAc,CAAC;IAE5C,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,sCAAsC,OAAO,yCAAyC,cAAc,IAAI,CACzG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,YAAY,EAAE,uBAAuB;QACrC,cAAc,EAAE,2BAA2B;QAC3C,IAAI,EAAE;YACJ,GAAG,EAAE,sDAAsD;YAC3D,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,kCAAkC,OAAO,EAAE;SAC7E;QACD,MAAM,EAAE,EAAE,GAAG,cAAc,EAAE;QAC7B,MAAM,EAAE;YACN,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,OAAO;SACjB;QACD,QAAQ,EAAE,CAAC,sBAAsB,EAAE,QAAQ,EAAE,UAAU,CAAC;QACxD,iBAAiB,EAAE,mBAAmB;QACtC,SAAS,EAAE,cAAc;QACzB,cAAc,EAAE,0BAA0B;QAC1C,qBAAqB,EAAE,+FAA+F;QACtH,WAAW,EAAE,oCAAoC;QACjD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,gCAAgC,OAAO,EAAE;YAC3F,yEAAyE;YACzE,uEAAuE;YACvE,gBAAgB,EAAE,IAAI;SACvB;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * searchDefaults.ts
3
+ * Shared search tuning used by all presets — single source of truth so a
4
+ * ranking change can't silently apply to one published server but not the other.
5
+ * (Type-only import from config.js keeps this module free of runtime cycles.)
6
+ */
7
+ import type { SearchConfig } from '../config.js';
8
+ export declare const DEFAULT_SEARCH: SearchConfig;
9
+ //# sourceMappingURL=searchDefaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchDefaults.d.ts","sourceRoot":"","sources":["../../src/presets/searchDefaults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,eAAO,MAAM,cAAc,EAAE,YAQ5B,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * searchDefaults.ts
3
+ * Shared search tuning used by all presets — single source of truth so a
4
+ * ranking change can't silently apply to one published server but not the other.
5
+ * (Type-only import from config.js keeps this module free of runtime cycles.)
6
+ */
7
+ export const DEFAULT_SEARCH = {
8
+ defaultLimit: 10,
9
+ maxLimit: 50,
10
+ minScore: 0.1,
11
+ semanticSearchEnabled: true,
12
+ semanticMinSimilarity: 0.3,
13
+ hybridKeywordWeight: 0.3,
14
+ hybridSemanticWeight: 0.7,
15
+ };
16
+ //# sourceMappingURL=searchDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchDefaults.js","sourceRoot":"","sources":["../../src/presets/searchDefaults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,GAAG;IACb,qBAAqB,EAAE,IAAI;IAC3B,qBAAqB,EAAE,GAAG;IAC1B,mBAAmB,EAAE,GAAG;IACxB,oBAAoB,EAAE,GAAG;CAC1B,CAAC"}
@@ -4,6 +4,12 @@
4
4
  */
5
5
  import { DocsManager } from './docsManager.js';
6
6
  import type { ParsedDoc, SearchOptions, SearchResult } from './types.js';
7
+ /**
8
+ * Resolve the canonical slug for a doc: Docusaurus-style sites route by
9
+ * frontmatter `id` when present, overriding the file-path-derived slug.
10
+ * Returns the path unchanged for missing/non-string ids.
11
+ */
12
+ export declare function resolveDocSlug(path: string, id: unknown): string;
7
13
  export declare class SearchEngine {
8
14
  private docsManager;
9
15
  private embeddingService;
@@ -54,10 +60,6 @@ export declare class SearchEngine {
54
60
  * @returns Parsed document or null if not found
55
61
  */
56
62
  getDocByPath(path: string): Promise<ParsedDoc | null>;
57
- /**
58
- * List all available sections
59
- */
60
- getSections(): string[];
61
63
  /**
62
64
  * Get all documents in a section
63
65
  */
@@ -1 +1 @@
1
- {"version":3,"file":"searchEngine.d.ts","sourceRoot":"","sources":["../src/searchEngine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE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