@arabold/docs-mcp-server 3.0.0 → 3.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.
- package/dist/assets/index-Jf4IQnpW.js +70 -0
- package/dist/assets/index-Jf4IQnpW.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/index.js +1 -1
- package/dist/{main-qq21CGPf.js → main-BDg2etpq.js} +73 -11
- package/dist/main-BDg2etpq.js.map +1 -0
- package/package.json +1 -1
- package/public/assets/index-Jf4IQnpW.js +70 -0
- package/public/assets/index-Jf4IQnpW.js.map +1 -0
- package/public/index.html +1 -1
- package/dist/assets/index-vmw9lu8_.js +0 -70
- package/dist/assets/index-vmw9lu8_.js.map +0 -1
- package/dist/main-qq21CGPf.js.map +0 -1
- package/public/assets/index-vmw9lu8_.js +0 -70
- package/public/assets/index-vmw9lu8_.js.map +0 -1
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Docs MCP Server — Admin Console</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Jf4IQnpW.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BHI6XhAh.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import "dotenv/config";
|
|
|
5
5
|
//#region src/index.ts
|
|
6
6
|
process.setSourceMapsEnabled(true);
|
|
7
7
|
sanitizeEnvironment();
|
|
8
|
-
var [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([import("./main-
|
|
8
|
+
var [{ runCli }, { ensurePlaywrightBrowsersInstalled }] = await Promise.all([import("./main-BDg2etpq.js"), import("./utils-DizElQoU.js")]);
|
|
9
9
|
ensurePlaywrightBrowsersInstalled();
|
|
10
10
|
runCli().catch((error) => {
|
|
11
11
|
logger.error(`🔥 Fatal error in main execution: ${error}`);
|
|
@@ -291,7 +291,8 @@ function createEmbeddingModel(providerAndModel, runtime) {
|
|
|
291
291
|
...baseConfig,
|
|
292
292
|
modelName: model,
|
|
293
293
|
batchSize: 512,
|
|
294
|
-
timeout: requestTimeoutMs
|
|
294
|
+
timeout: requestTimeoutMs,
|
|
295
|
+
encodingFormat: "float"
|
|
295
296
|
};
|
|
296
297
|
const baseURL = process.env.OPENAI_API_BASE;
|
|
297
298
|
config.configuration = baseURL ? {
|
|
@@ -1710,6 +1711,58 @@ function createError(errorOrText) {
|
|
|
1710
1711
|
//#endregion
|
|
1711
1712
|
//#region src/mcp/mcpServer.ts
|
|
1712
1713
|
/**
|
|
1714
|
+
* Splits a comma-separated pattern string into an array of patterns. Commas
|
|
1715
|
+
* inside `{}`, `[]`, or `()` (regex quantifiers, glob brace expansion,
|
|
1716
|
+
* character classes) and escaped commas (`\,`) are preserved so that a single
|
|
1717
|
+
* regex or glob pattern is never torn apart. This keeps the argument
|
|
1718
|
+
* renderable as one string for MCP clients that only display primitive tool
|
|
1719
|
+
* arguments.
|
|
1720
|
+
* @param value The raw pattern string.
|
|
1721
|
+
* @returns An array of trimmed, non-empty patterns.
|
|
1722
|
+
*/
|
|
1723
|
+
function splitPatterns(value) {
|
|
1724
|
+
const patterns = [];
|
|
1725
|
+
let current = "";
|
|
1726
|
+
let braces = 0;
|
|
1727
|
+
let brackets = 0;
|
|
1728
|
+
let parens = 0;
|
|
1729
|
+
for (let i = 0; i < value.length; i++) {
|
|
1730
|
+
const ch = value[i];
|
|
1731
|
+
if (ch === "\\") {
|
|
1732
|
+
if (i + 1 < value.length) {
|
|
1733
|
+
current += ch + value[i + 1];
|
|
1734
|
+
i++;
|
|
1735
|
+
} else current += ch;
|
|
1736
|
+
continue;
|
|
1737
|
+
}
|
|
1738
|
+
if (ch === "{") braces++;
|
|
1739
|
+
else if (ch === "}") braces = Math.max(0, braces - 1);
|
|
1740
|
+
else if (ch === "[") brackets++;
|
|
1741
|
+
else if (ch === "]") brackets = Math.max(0, brackets - 1);
|
|
1742
|
+
else if (ch === "(") parens++;
|
|
1743
|
+
else if (ch === ")") parens = Math.max(0, parens - 1);
|
|
1744
|
+
if (ch === "," && braces === 0 && brackets === 0 && parens === 0) {
|
|
1745
|
+
patterns.push(current.trim());
|
|
1746
|
+
current = "";
|
|
1747
|
+
continue;
|
|
1748
|
+
}
|
|
1749
|
+
current += ch;
|
|
1750
|
+
}
|
|
1751
|
+
patterns.push(current.trim());
|
|
1752
|
+
return patterns.filter(Boolean);
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Schema for URL pattern arguments. Accepts a single pattern as a string or
|
|
1756
|
+
* multiple patterns as an array of strings, and normalizes both to an array
|
|
1757
|
+
* of trimmed, non-empty patterns. A string is split on top-level commas while
|
|
1758
|
+
* commas inside `{}`, `[]`, or `()` are preserved, so regex quantifiers and
|
|
1759
|
+
* glob brace expansion survive.
|
|
1760
|
+
*/
|
|
1761
|
+
var patternsSchema = z$1.union([z$1.string(), z$1.array(z$1.string())]).transform((value) => {
|
|
1762
|
+
if (typeof value === "string") return splitPatterns(value);
|
|
1763
|
+
return value.map((p) => p.trim()).filter(Boolean);
|
|
1764
|
+
});
|
|
1765
|
+
/**
|
|
1713
1766
|
* Creates and configures an instance of the MCP server with registered tools and resources.
|
|
1714
1767
|
* @param tools The shared tool instances to use for server operations.
|
|
1715
1768
|
* @param config The application configuration.
|
|
@@ -1737,12 +1790,14 @@ function createMcpServerInstance(tools, config) {
|
|
|
1737
1790
|
"domain"
|
|
1738
1791
|
]).optional().default("subpages").describe("Crawling boundary: 'subpages', 'hostname', or 'domain'."),
|
|
1739
1792
|
followRedirects: z$1.boolean().optional().default(true).describe("Follow HTTP redirects (3xx responses)."),
|
|
1740
|
-
preserveHashes: z$1.boolean().optional().describe("Preserve hash fragments for hash-routed SPA documentation sites.")
|
|
1793
|
+
preserveHashes: z$1.boolean().optional().describe("Preserve hash fragments for hash-routed SPA documentation sites."),
|
|
1794
|
+
includePatterns: patternsSchema.optional().describe("Patterns for including URLs during scraping. Pass one or more patterns as a comma-separated string or as an array. Commas inside { }, [ ] or ( ) are preserved; escape a literal comma with a backslash. Regex patterns must be wrapped in slashes, e.g. /pattern/. If not set, all are included by default."),
|
|
1795
|
+
excludePatterns: patternsSchema.optional().describe("Patterns for excluding URLs during scraping. Pass one or more patterns as a comma-separated string or as an array. Commas inside { }, [ ] or ( ) are preserved; escape a literal comma with a backslash. Exclude takes precedence over include. Regex patterns must be wrapped in slashes, e.g. /pattern/.")
|
|
1741
1796
|
}, {
|
|
1742
1797
|
title: "Scrape New Library Documentation",
|
|
1743
1798
|
destructiveHint: true,
|
|
1744
1799
|
openWorldHint: true
|
|
1745
|
-
}, async ({ url, library, version, maxPages, maxDepth, scope, followRedirects, preserveHashes }) => {
|
|
1800
|
+
}, async ({ url, library, version, maxPages, maxDepth, scope, followRedirects, preserveHashes, includePatterns, excludePatterns }) => {
|
|
1746
1801
|
telemetry.track(TelemetryEvent.TOOL_USED, {
|
|
1747
1802
|
tool: "scrape_docs",
|
|
1748
1803
|
context: "mcp_server",
|
|
@@ -1764,7 +1819,9 @@ function createMcpServerInstance(tools, config) {
|
|
|
1764
1819
|
maxDepth,
|
|
1765
1820
|
scope,
|
|
1766
1821
|
followRedirects,
|
|
1767
|
-
preserveHashes
|
|
1822
|
+
preserveHashes,
|
|
1823
|
+
includePatterns,
|
|
1824
|
+
excludePatterns
|
|
1768
1825
|
}
|
|
1769
1826
|
});
|
|
1770
1827
|
if ("jobId" in result) return createResponse(`🚀 Scraping job started with ID: ${result.jobId}.`);
|
|
@@ -11888,7 +11945,7 @@ function buildSystemInfo(serverConfig, appConfig) {
|
|
|
11888
11945
|
const mcpEnabled = Boolean(serverConfig.enableMcpServer);
|
|
11889
11946
|
const authEnabled = Boolean(appConfig.auth.enabled);
|
|
11890
11947
|
return {
|
|
11891
|
-
version: "3.
|
|
11948
|
+
version: "3.1.0",
|
|
11892
11949
|
readOnly: Boolean(appConfig.app.readOnly),
|
|
11893
11950
|
telemetryEnabled: Boolean(appConfig.app.telemetryEnabled),
|
|
11894
11951
|
services: {
|
|
@@ -11911,6 +11968,10 @@ function buildSystemInfo(serverConfig, appConfig) {
|
|
|
11911
11968
|
auth: {
|
|
11912
11969
|
enabled: authEnabled,
|
|
11913
11970
|
issuer: authEnabled && appConfig.auth.issuerUrl ? appConfig.auth.issuerUrl : void 0
|
|
11971
|
+
},
|
|
11972
|
+
scraper: {
|
|
11973
|
+
maxPages: appConfig.scraper.maxPages,
|
|
11974
|
+
maxDepth: appConfig.scraper.maxDepth
|
|
11914
11975
|
}
|
|
11915
11976
|
};
|
|
11916
11977
|
}
|
|
@@ -12177,7 +12238,8 @@ getSystemHealth: tt.procedure.query(async ({ ctx }) => {
|
|
|
12177
12238
|
worker,
|
|
12178
12239
|
embeddings,
|
|
12179
12240
|
mcp: systemInfo.mcp,
|
|
12180
|
-
auth: systemInfo.auth
|
|
12241
|
+
auth: systemInfo.auth,
|
|
12242
|
+
scraper: systemInfo.scraper
|
|
12181
12243
|
};
|
|
12182
12244
|
}) });
|
|
12183
12245
|
}
|
|
@@ -12382,7 +12444,7 @@ var AppServer = class AppServer {
|
|
|
12382
12444
|
if (this.appConfig.app.telemetryEnabled && shouldEnableTelemetry()) try {
|
|
12383
12445
|
if (telemetry.isEnabled()) {
|
|
12384
12446
|
telemetry.setGlobalContext({
|
|
12385
|
-
appVersion: "3.
|
|
12447
|
+
appVersion: "3.1.0",
|
|
12386
12448
|
appPlatform: process.platform,
|
|
12387
12449
|
appNodeVersion: process.version,
|
|
12388
12450
|
appServicesEnabled: this.getActiveServicesList(),
|
|
@@ -13113,7 +13175,7 @@ var BaseScraperStrategy = class BaseScraperStrategy {
|
|
|
13113
13175
|
const isRefreshDeletion = this.isRefreshDeletion(item, result);
|
|
13114
13176
|
const fallbackQueueItems = result.queueItems ?? [];
|
|
13115
13177
|
const hasNewFallbackQueueItem = fallbackQueueItems.some((queueItem) => !this.visited.has(normalizeUrl(queueItem.url, this.getUrlNormalizerOptions(options))));
|
|
13116
|
-
if (item.depth === 0 && !isRefreshDeletion && !hasNewFallbackQueueItem) throw new ScraperError(`Root page not found: ${item.url}`, false);
|
|
13178
|
+
if (item.depth === 0 && !item.fromLlmsTxt && !isRefreshDeletion && !hasNewFallbackQueueItem) throw new ScraperError(`Root page not found: ${item.url}`, false);
|
|
13117
13179
|
if (!isRefreshDeletion) {
|
|
13118
13180
|
this.recordChildPageFailure(item);
|
|
13119
13181
|
ensureFailureRateWithinThreshold();
|
|
@@ -16516,7 +16578,7 @@ function createCli(argv) {
|
|
|
16516
16578
|
let globalEventBus = null;
|
|
16517
16579
|
let globalTelemetryService = null;
|
|
16518
16580
|
const commandStartTimes = /* @__PURE__ */ new Map();
|
|
16519
|
-
const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("3.
|
|
16581
|
+
const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("3.1.0").option("verbose", {
|
|
16520
16582
|
type: "boolean",
|
|
16521
16583
|
description: "Enable verbose (debug) logging",
|
|
16522
16584
|
default: false
|
|
@@ -16566,7 +16628,7 @@ function createCli(argv) {
|
|
|
16566
16628
|
if (shouldEnableTelemetry() && telemetry.isEnabled()) {
|
|
16567
16629
|
const commandName = argv._[0]?.toString() || "default";
|
|
16568
16630
|
telemetry.setGlobalContext({
|
|
16569
|
-
appVersion: "3.
|
|
16631
|
+
appVersion: "3.1.0",
|
|
16570
16632
|
appPlatform: process.platform,
|
|
16571
16633
|
appNodeVersion: process.version,
|
|
16572
16634
|
appInterface: "cli",
|
|
@@ -16706,4 +16768,4 @@ async function runCli() {
|
|
|
16706
16768
|
//#endregion
|
|
16707
16769
|
export { cleanupCliCommand, runCli };
|
|
16708
16770
|
|
|
16709
|
-
//# sourceMappingURL=main-
|
|
16771
|
+
//# sourceMappingURL=main-BDg2etpq.js.map
|