@arabold/docs-mcp-server 3.0.1 → 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/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-vmw9lu8_.js"></script>
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-CfCiPjcn.js"), import("./utils-DizElQoU.js")]);
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}`);
@@ -1711,6 +1711,58 @@ function createError(errorOrText) {
1711
1711
  //#endregion
1712
1712
  //#region src/mcp/mcpServer.ts
1713
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
+ /**
1714
1766
  * Creates and configures an instance of the MCP server with registered tools and resources.
1715
1767
  * @param tools The shared tool instances to use for server operations.
1716
1768
  * @param config The application configuration.
@@ -1738,12 +1790,14 @@ function createMcpServerInstance(tools, config) {
1738
1790
  "domain"
1739
1791
  ]).optional().default("subpages").describe("Crawling boundary: 'subpages', 'hostname', or 'domain'."),
1740
1792
  followRedirects: z$1.boolean().optional().default(true).describe("Follow HTTP redirects (3xx responses)."),
1741
- 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/.")
1742
1796
  }, {
1743
1797
  title: "Scrape New Library Documentation",
1744
1798
  destructiveHint: true,
1745
1799
  openWorldHint: true
1746
- }, async ({ url, library, version, maxPages, maxDepth, scope, followRedirects, preserveHashes }) => {
1800
+ }, async ({ url, library, version, maxPages, maxDepth, scope, followRedirects, preserveHashes, includePatterns, excludePatterns }) => {
1747
1801
  telemetry.track(TelemetryEvent.TOOL_USED, {
1748
1802
  tool: "scrape_docs",
1749
1803
  context: "mcp_server",
@@ -1765,7 +1819,9 @@ function createMcpServerInstance(tools, config) {
1765
1819
  maxDepth,
1766
1820
  scope,
1767
1821
  followRedirects,
1768
- preserveHashes
1822
+ preserveHashes,
1823
+ includePatterns,
1824
+ excludePatterns
1769
1825
  }
1770
1826
  });
1771
1827
  if ("jobId" in result) return createResponse(`🚀 Scraping job started with ID: ${result.jobId}.`);
@@ -11889,7 +11945,7 @@ function buildSystemInfo(serverConfig, appConfig) {
11889
11945
  const mcpEnabled = Boolean(serverConfig.enableMcpServer);
11890
11946
  const authEnabled = Boolean(appConfig.auth.enabled);
11891
11947
  return {
11892
- version: "3.0.1",
11948
+ version: "3.1.0",
11893
11949
  readOnly: Boolean(appConfig.app.readOnly),
11894
11950
  telemetryEnabled: Boolean(appConfig.app.telemetryEnabled),
11895
11951
  services: {
@@ -11912,6 +11968,10 @@ function buildSystemInfo(serverConfig, appConfig) {
11912
11968
  auth: {
11913
11969
  enabled: authEnabled,
11914
11970
  issuer: authEnabled && appConfig.auth.issuerUrl ? appConfig.auth.issuerUrl : void 0
11971
+ },
11972
+ scraper: {
11973
+ maxPages: appConfig.scraper.maxPages,
11974
+ maxDepth: appConfig.scraper.maxDepth
11915
11975
  }
11916
11976
  };
11917
11977
  }
@@ -12178,7 +12238,8 @@ getSystemHealth: tt.procedure.query(async ({ ctx }) => {
12178
12238
  worker,
12179
12239
  embeddings,
12180
12240
  mcp: systemInfo.mcp,
12181
- auth: systemInfo.auth
12241
+ auth: systemInfo.auth,
12242
+ scraper: systemInfo.scraper
12182
12243
  };
12183
12244
  }) });
12184
12245
  }
@@ -12383,7 +12444,7 @@ var AppServer = class AppServer {
12383
12444
  if (this.appConfig.app.telemetryEnabled && shouldEnableTelemetry()) try {
12384
12445
  if (telemetry.isEnabled()) {
12385
12446
  telemetry.setGlobalContext({
12386
- appVersion: "3.0.1",
12447
+ appVersion: "3.1.0",
12387
12448
  appPlatform: process.platform,
12388
12449
  appNodeVersion: process.version,
12389
12450
  appServicesEnabled: this.getActiveServicesList(),
@@ -13114,7 +13175,7 @@ var BaseScraperStrategy = class BaseScraperStrategy {
13114
13175
  const isRefreshDeletion = this.isRefreshDeletion(item, result);
13115
13176
  const fallbackQueueItems = result.queueItems ?? [];
13116
13177
  const hasNewFallbackQueueItem = fallbackQueueItems.some((queueItem) => !this.visited.has(normalizeUrl(queueItem.url, this.getUrlNormalizerOptions(options))));
13117
- 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);
13118
13179
  if (!isRefreshDeletion) {
13119
13180
  this.recordChildPageFailure(item);
13120
13181
  ensureFailureRateWithinThreshold();
@@ -16517,7 +16578,7 @@ function createCli(argv) {
16517
16578
  let globalEventBus = null;
16518
16579
  let globalTelemetryService = null;
16519
16580
  const commandStartTimes = /* @__PURE__ */ new Map();
16520
- const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("3.0.1").option("verbose", {
16581
+ const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("3.1.0").option("verbose", {
16521
16582
  type: "boolean",
16522
16583
  description: "Enable verbose (debug) logging",
16523
16584
  default: false
@@ -16567,7 +16628,7 @@ function createCli(argv) {
16567
16628
  if (shouldEnableTelemetry() && telemetry.isEnabled()) {
16568
16629
  const commandName = argv._[0]?.toString() || "default";
16569
16630
  telemetry.setGlobalContext({
16570
- appVersion: "3.0.1",
16631
+ appVersion: "3.1.0",
16571
16632
  appPlatform: process.platform,
16572
16633
  appNodeVersion: process.version,
16573
16634
  appInterface: "cli",
@@ -16707,4 +16768,4 @@ async function runCli() {
16707
16768
  //#endregion
16708
16769
  export { cleanupCliCommand, runCli };
16709
16770
 
16710
- //# sourceMappingURL=main-CfCiPjcn.js.map
16771
+ //# sourceMappingURL=main-BDg2etpq.js.map