react-docs-mcp 1.0.3 → 1.0.4
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/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +6 -6
- package/dist/summarizer.js.map +1 -1
- package/package.json +13 -3
package/dist/summarizer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizer.d.ts","sourceRoot":"","sources":["../src/summarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"summarizer.d.ts","sourceRoot":"","sources":["../src/summarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAa,GAAG,MAAM,CAuClF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA8BxD"}
|
package/dist/summarizer.js
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export function summarizeContent(content, maxLength = 1500) {
|
|
12
12
|
// Remove code blocks (can be very long)
|
|
13
|
-
let summary = content.replace(/```[\s\S]*?```/g, '
|
|
13
|
+
let summary = content.replace(/```[\s\S]*?```/g, '');
|
|
14
14
|
// Remove frontmatter if present
|
|
15
15
|
summary = summary.replace(/^---[\s\S]*?---\n/, '');
|
|
16
16
|
// Extract first few meaningful paragraphs
|
|
17
17
|
const paragraphs = summary
|
|
18
18
|
.split(/\n\n+/)
|
|
19
19
|
.map(p => p.trim())
|
|
20
|
-
.filter(p => p.length >
|
|
20
|
+
.filter(p => p.length > 0 && !p.startsWith('#'));
|
|
21
21
|
// Take first few paragraphs up to maxLength
|
|
22
22
|
let result = '';
|
|
23
23
|
let headings = [];
|
|
@@ -28,9 +28,6 @@ export function summarizeContent(content, maxLength = 1500) {
|
|
|
28
28
|
}
|
|
29
29
|
// Build summary
|
|
30
30
|
for (const para of paragraphs.slice(0, 3)) {
|
|
31
|
-
if (result.length + para.length > maxLength) {
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
31
|
result += para + '\n\n';
|
|
35
32
|
}
|
|
36
33
|
// Add structure if we have headings
|
|
@@ -54,17 +51,20 @@ export function extractStructure(content) {
|
|
|
54
51
|
let currentHeading = '';
|
|
55
52
|
let capturedFirstLine = false;
|
|
56
53
|
for (const line of lines) {
|
|
57
|
-
// Match headings
|
|
54
|
+
// Match headings (h1-h3 only)
|
|
58
55
|
const headingMatch = line.match(/^(#{1,3})\s+(.+)$/);
|
|
59
56
|
if (headingMatch) {
|
|
60
57
|
currentHeading = headingMatch[2];
|
|
58
|
+
// Don't use ** in the heading itself, since we're not displaying markdown
|
|
61
59
|
structure.push(`\n**${currentHeading}**`);
|
|
62
60
|
capturedFirstLine = false;
|
|
63
61
|
continue;
|
|
64
62
|
}
|
|
65
63
|
// Capture first meaningful line after heading
|
|
66
64
|
if (currentHeading && !capturedFirstLine && line.trim().length > 20) {
|
|
65
|
+
// Clean markdown formatting: *, _, `
|
|
67
66
|
const cleaned = line.replace(/[*_`]/g, '').trim();
|
|
67
|
+
// Skip HTML tags and markdown links
|
|
68
68
|
if (!cleaned.startsWith('<') && !cleaned.startsWith('[')) {
|
|
69
69
|
structure.push(cleaned.slice(0, 100));
|
|
70
70
|
capturedFirstLine = true;
|
package/dist/summarizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../src/summarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,YAAoB,IAAI;IACxE,wCAAwC;IACxC,IAAI,OAAO,GAAG,OAA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ACpC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;gBACtC,iBAAiB,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-docs-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "MCP server providing AI agents with semantic search over React documentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"dev": "tsx src/index.ts",
|
|
13
13
|
"start": "node dist/index.js",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"test:ui": "vitest --ui",
|
|
17
|
+
"test:coverage": "vitest run --coverage",
|
|
14
18
|
"prepublishOnly": "npm run build",
|
|
15
19
|
"postinstall": "node dist/index.js --version || echo 'Run: npx react-docs-mcp'"
|
|
16
20
|
},
|
|
@@ -41,7 +45,11 @@
|
|
|
41
45
|
"node": ">=18.0.0"
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
|
-
"dist",
|
|
48
|
+
"dist/**/*.js",
|
|
49
|
+
"dist/**/*.d.ts",
|
|
50
|
+
"dist/**/*.js.map",
|
|
51
|
+
"dist/**/*.d.ts.map",
|
|
52
|
+
"!dist/__tests__",
|
|
45
53
|
"README.md",
|
|
46
54
|
"LICENSE",
|
|
47
55
|
"poster.png"
|
|
@@ -58,7 +66,9 @@
|
|
|
58
66
|
},
|
|
59
67
|
"devDependencies": {
|
|
60
68
|
"@types/node": "^24.7.2",
|
|
69
|
+
"@vitest/ui": "^3.2.4",
|
|
61
70
|
"tsx": "^4.20.6",
|
|
62
|
-
"typescript": "^5.9.3"
|
|
71
|
+
"typescript": "^5.9.3",
|
|
72
|
+
"vitest": "^3.2.4"
|
|
63
73
|
}
|
|
64
74
|
}
|