@arabold/docs-mcp-server 2.4.5 → 2.5.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
|
@@ -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-IwoXB6_B.js"), import("./utils-LjYa0nIu.js")]);
|
|
9
9
|
ensurePlaywrightBrowsersInstalled();
|
|
10
10
|
runCli().catch((error) => {
|
|
11
11
|
logger.error(`🔥 Fatal error in main execution: ${error}`);
|
|
@@ -38,7 +38,7 @@ import mime from "mime";
|
|
|
38
38
|
import { HeaderGenerator } from "header-generator";
|
|
39
39
|
import https from "node:https";
|
|
40
40
|
import axios from "axios";
|
|
41
|
-
import {
|
|
41
|
+
import { ExtractInputKind, OutputFormat, extract } from "@xberg-io/xberg";
|
|
42
42
|
import { JSDOM, VirtualConsole } from "jsdom";
|
|
43
43
|
import psl from "psl";
|
|
44
44
|
import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters";
|
|
@@ -2348,6 +2348,17 @@ var ARCHIVE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
2348
2348
|
".tgz"
|
|
2349
2349
|
]);
|
|
2350
2350
|
/**
|
|
2351
|
+
* Where users go to change file access decisions.
|
|
2352
|
+
*
|
|
2353
|
+
* Rejections state which rule blocked the path and point here, rather than
|
|
2354
|
+
* naming individual settings and environment variables. Every setting named in
|
|
2355
|
+
* an error is one more thing a rename can silently invalidate, and the docs
|
|
2356
|
+
* carry the full picture — config file, env vars, and tokens — in one place
|
|
2357
|
+
* that is already maintained. Deep-linked without an anchor on purpose: a stale
|
|
2358
|
+
* anchor fails quietly.
|
|
2359
|
+
*/
|
|
2360
|
+
var FILE_ACCESS_DOCS = "https://github.com/arabold/docs-mcp-server/blob/main/docs/setup/configuration.md";
|
|
2361
|
+
/**
|
|
2351
2362
|
* Shared access policy for outbound network and local file access.
|
|
2352
2363
|
*/
|
|
2353
2364
|
var ScraperAccessPolicy = class {
|
|
@@ -2355,6 +2366,10 @@ var ScraperAccessPolicy = class {
|
|
|
2355
2366
|
allowedCidrs = new net.BlockList();
|
|
2356
2367
|
specialUseCidrs = new net.BlockList();
|
|
2357
2368
|
allowedHosts;
|
|
2369
|
+
/** Roots already reported as unresolvable, so each is warned about once. */
|
|
2370
|
+
warnedUnresolvedRoots = /* @__PURE__ */ new Set();
|
|
2371
|
+
hasWarnedUnavailableAllowlist = false;
|
|
2372
|
+
hasLoggedConfiguredRoots = false;
|
|
2358
2373
|
constructor(security) {
|
|
2359
2374
|
this.security = security;
|
|
2360
2375
|
this.allowedHosts = security.network.allowedHosts;
|
|
@@ -2407,6 +2422,15 @@ var ScraperAccessPolicy = class {
|
|
|
2407
2422
|
}
|
|
2408
2423
|
/**
|
|
2409
2424
|
* Resolves and validates a file URL against the configured file access policy.
|
|
2425
|
+
*
|
|
2426
|
+
* Rejections name the specific policy rule that blocked the path and link to
|
|
2427
|
+
* the configuration documentation rather than naming individual settings.
|
|
2428
|
+
* Filesystem paths — configured or resolved — stay out of the thrown message
|
|
2429
|
+
* because it reaches MCP clients and the web UI; they are logged instead,
|
|
2430
|
+
* where only the operator sees them. Root tokens such as `$DOCUMENTS` are
|
|
2431
|
+
* named in the message: they are runtime state rather than host detail, and
|
|
2432
|
+
* warn-level logs are suppressed on the non-interactive runs where an
|
|
2433
|
+
* unresolvable token is most likely.
|
|
2410
2434
|
*/
|
|
2411
2435
|
async resolveFileAccess(url, additionalAllowedRoots = []) {
|
|
2412
2436
|
const filePath = fileUrlToPathLoose(url);
|
|
@@ -2415,19 +2439,25 @@ var ScraperAccessPolicy = class {
|
|
|
2415
2439
|
const bypassRoots = await this.expandRoots(additionalAllowedRoots);
|
|
2416
2440
|
const matchedBypassRoot = await this.findContainingRoot(accessPath, bypassRoots, false);
|
|
2417
2441
|
let matchedRoot = matchedBypassRoot;
|
|
2418
|
-
if (this.security.fileAccess.mode === "disabled" && !matchedBypassRoot) throw new AccessPolicyError(`
|
|
2442
|
+
if (this.security.fileAccess.mode === "disabled" && !matchedBypassRoot) throw new AccessPolicyError(`Local file access is disabled by the scraper security policy, so ${url} cannot be indexed. See ${FILE_ACCESS_DOCS} to configure local file access.`);
|
|
2419
2443
|
if (this.security.fileAccess.mode === "allowedRoots" && !matchedBypassRoot) {
|
|
2420
|
-
const configuredRoots = await this.expandRoots(this.security.fileAccess.allowedRoots);
|
|
2421
|
-
if (configuredRoots.length === 0)
|
|
2444
|
+
const configuredRoots = await this.expandRoots(this.security.fileAccess.allowedRoots, true);
|
|
2445
|
+
if (configuredRoots.length === 0) {
|
|
2446
|
+
this.warnUnavailableAllowlist();
|
|
2447
|
+
throw new AccessPolicyError(`Local file access is limited to configured roots, but ${describeUnavailableRoots(this.security.fileAccess.allowedRoots)}, so ${url} cannot be indexed. See ${FILE_ACCESS_DOCS} to configure the allowed roots.`);
|
|
2448
|
+
}
|
|
2422
2449
|
matchedRoot = await this.findContainingRoot(accessPath, configuredRoots, this.security.fileAccess.followSymlinks);
|
|
2423
|
-
if (!matchedRoot)
|
|
2450
|
+
if (!matchedRoot) {
|
|
2451
|
+
this.logConfiguredRoots(configuredRoots);
|
|
2452
|
+
throw new AccessPolicyError(`${url} is outside the configured allowed roots, so it cannot be indexed. See ${FILE_ACCESS_DOCS} to allow this folder.`);
|
|
2453
|
+
}
|
|
2424
2454
|
}
|
|
2425
2455
|
if (!this.security.fileAccess.followSymlinks && !matchedBypassRoot) {
|
|
2426
|
-
if (await findSymlinkInPath(accessPath)) throw new AccessPolicyError(
|
|
2456
|
+
if (await findSymlinkInPath(accessPath)) throw new AccessPolicyError(`${url} resolves through a symlink, which the security policy blocks by default, so it cannot be indexed. See ${FILE_ACCESS_DOCS} to allow symlinked paths.`);
|
|
2427
2457
|
}
|
|
2428
2458
|
if (!this.security.fileAccess.includeHidden) {
|
|
2429
|
-
if (hasHiddenSegmentBelowRoot(filePath, matchedRoot)) throw new AccessPolicyError(
|
|
2430
|
-
if (resolved.virtualArchivePath && hasHiddenArchiveSegment(resolved.virtualArchivePath)) throw new AccessPolicyError(`
|
|
2459
|
+
if (hasHiddenSegmentBelowRoot(filePath, matchedRoot)) throw new AccessPolicyError(`${url} contains a hidden path segment (a name starting with "."), which the security policy blocks by default, so it cannot be indexed. See ${FILE_ACCESS_DOCS} to allow hidden files and folders.`);
|
|
2460
|
+
if (resolved.virtualArchivePath && hasHiddenArchiveSegment(resolved.virtualArchivePath)) throw new AccessPolicyError(`The archive entry requested by ${url} is hidden (a name starting with "."), which the security policy blocks by default. See ${FILE_ACCESS_DOCS} to allow hidden archive entries.`);
|
|
2431
2461
|
}
|
|
2432
2462
|
return {
|
|
2433
2463
|
filePath,
|
|
@@ -2455,14 +2485,47 @@ var ScraperAccessPolicy = class {
|
|
|
2455
2485
|
if (family === 0 || prefix === void 0) return;
|
|
2456
2486
|
blockList.addSubnet(network, Number.parseInt(prefix, 10), family === 6 ? "ipv6" : "ipv4");
|
|
2457
2487
|
}
|
|
2458
|
-
|
|
2488
|
+
/**
|
|
2489
|
+
* Expands configured root entries into concrete paths, dropping those that do
|
|
2490
|
+
* not resolve on this system. With `warnOnUnresolved`, every dropped entry is
|
|
2491
|
+
* reported once — silently discarding them makes `allowedRoots` look active
|
|
2492
|
+
* when it grants nothing.
|
|
2493
|
+
*/
|
|
2494
|
+
async expandRoots(roots, warnOnUnresolved = false) {
|
|
2459
2495
|
const expanded = [];
|
|
2460
2496
|
for (const root of roots) {
|
|
2461
2497
|
const value = await expandConfiguredRoot(root);
|
|
2462
|
-
if (value)
|
|
2498
|
+
if (value) {
|
|
2499
|
+
expanded.push(value);
|
|
2500
|
+
continue;
|
|
2501
|
+
}
|
|
2502
|
+
if (warnOnUnresolved && !this.warnedUnresolvedRoots.has(root)) {
|
|
2503
|
+
this.warnedUnresolvedRoots.add(root);
|
|
2504
|
+
logger.warn(`⚠️ Ignoring allowed file root "${root}": it does not resolve to an existing directory on this system.`);
|
|
2505
|
+
}
|
|
2463
2506
|
}
|
|
2464
2507
|
return expanded;
|
|
2465
2508
|
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Warns that `allowedRoots` mode is active but grants nothing, which blocks
|
|
2511
|
+
* all local file access. Emitted once per policy instance.
|
|
2512
|
+
*/
|
|
2513
|
+
warnUnavailableAllowlist() {
|
|
2514
|
+
if (this.hasWarnedUnavailableAllowlist) return;
|
|
2515
|
+
this.hasWarnedUnavailableAllowlist = true;
|
|
2516
|
+
const configured = this.security.fileAccess.allowedRoots;
|
|
2517
|
+
const cause = configured.length === 0 ? "no roots are configured" : `none of the configured roots (${configured.join(", ")}) exist on this system`;
|
|
2518
|
+
logger.warn(`⚠️ Local file access is limited to configured roots, but ${cause}, so all file:// indexing is blocked. See ${FILE_ACCESS_DOCS} to configure the allowed roots.`);
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* Logs the roots that local file access is limited to. Emitted once per policy
|
|
2522
|
+
* instance, alongside the first out-of-root rejection.
|
|
2523
|
+
*/
|
|
2524
|
+
logConfiguredRoots(roots) {
|
|
2525
|
+
if (this.hasLoggedConfiguredRoots) return;
|
|
2526
|
+
this.hasLoggedConfiguredRoots = true;
|
|
2527
|
+
logger.warn(`⚠️ Local file access is limited to: ${roots.join(", ")}`);
|
|
2528
|
+
}
|
|
2466
2529
|
async findContainingRoot(accessPath, roots, followSymlinks) {
|
|
2467
2530
|
const resolvedAccessPath = await resolveContainmentPath(accessPath, followSymlinks);
|
|
2468
2531
|
for (const root of roots) {
|
|
@@ -2514,6 +2577,33 @@ var USER_DIR_TOKENS = {
|
|
|
2514
2577
|
$DOWNLOADS: "Downloads",
|
|
2515
2578
|
$DESKTOP: "Desktop"
|
|
2516
2579
|
};
|
|
2580
|
+
var ROOT_TOKENS = /* @__PURE__ */ new Set([
|
|
2581
|
+
"$HOME",
|
|
2582
|
+
"$CWD",
|
|
2583
|
+
...Object.keys(USER_DIR_TOKENS)
|
|
2584
|
+
]);
|
|
2585
|
+
/**
|
|
2586
|
+
* Describes why an `allowedRoots` allowlist grants no access, for an error that
|
|
2587
|
+
* also reaches MCP clients and the web UI.
|
|
2588
|
+
*
|
|
2589
|
+
* Configured tokens are named because they are fixed vocabulary that says
|
|
2590
|
+
* nothing about the host. Literal paths are only counted: even a path that does
|
|
2591
|
+
* not exist reveals the layout an operator intended, so `/mnt/acme-secrets/docs`
|
|
2592
|
+
* must not travel back to a caller.
|
|
2593
|
+
*
|
|
2594
|
+
* Today `expandConfiguredRoot` resolves literal paths unconditionally, so only
|
|
2595
|
+
* tokens reach this function and the count stays at zero. The branch guards the
|
|
2596
|
+
* day that changes — validating literal roots must not start leaking them.
|
|
2597
|
+
*/
|
|
2598
|
+
function describeUnavailableRoots(configured) {
|
|
2599
|
+
if (configured.length === 0) return "no roots are configured";
|
|
2600
|
+
const tokens = configured.filter((root) => ROOT_TOKENS.has(root));
|
|
2601
|
+
const literalCount = configured.length - tokens.length;
|
|
2602
|
+
const parts = [];
|
|
2603
|
+
if (tokens.length > 0) parts.push(`${tokens.join(", ")} did not resolve`);
|
|
2604
|
+
if (literalCount > 0) parts.push(`${literalCount} configured path(s) do not exist`);
|
|
2605
|
+
return `none of its entries are available on this system (${parts.join("; ")})`;
|
|
2606
|
+
}
|
|
2517
2607
|
/**
|
|
2518
2608
|
* Expands user-facing configured root tokens into concrete filesystem paths.
|
|
2519
2609
|
*
|
|
@@ -4619,7 +4709,7 @@ var BasePipeline = class {
|
|
|
4619
4709
|
//#endregion
|
|
4620
4710
|
//#region src/scraper/pipelines/DocumentPipeline.ts
|
|
4621
4711
|
/**
|
|
4622
|
-
* DocumentPipeline - Processes binary document formats using
|
|
4712
|
+
* DocumentPipeline - Processes binary document formats using Xberg for text extraction,
|
|
4623
4713
|
* then splits semantically.
|
|
4624
4714
|
*
|
|
4625
4715
|
* Supported formats:
|
|
@@ -4631,11 +4721,12 @@ var BasePipeline = class {
|
|
|
4631
4721
|
* - eBooks: EPUB (.epub), FictionBook (.fb2)
|
|
4632
4722
|
* - Jupyter Notebook (.ipynb)
|
|
4633
4723
|
*
|
|
4634
|
-
* The pipeline requests Markdown output from
|
|
4635
|
-
* `outputFormat:
|
|
4636
|
-
* pipeline.
|
|
4637
|
-
*
|
|
4638
|
-
*
|
|
4724
|
+
* The pipeline requests Markdown output from Xberg (`@xberg-io/xberg`) via
|
|
4725
|
+
* `outputFormat: OutputFormat.Markdown`, aligning with the project's Markdown-first
|
|
4726
|
+
* processing pipeline. Xberg's Markdown renderer emits fully structured output for
|
|
4727
|
+
* every format — including spreadsheets, where each sheet appears as a heading
|
|
4728
|
+
* followed by a Markdown table — so `content` is the preferred representation and
|
|
4729
|
+
* `tables[].markdown` only serves as a fallback when `content` comes back empty.
|
|
4639
4730
|
*
|
|
4640
4731
|
* Documents exceeding the configured maximum size are skipped with a warning.
|
|
4641
4732
|
*/
|
|
@@ -4677,8 +4768,17 @@ var DocumentPipeline = class extends BasePipeline {
|
|
|
4677
4768
|
};
|
|
4678
4769
|
}
|
|
4679
4770
|
try {
|
|
4680
|
-
const result = await
|
|
4681
|
-
|
|
4771
|
+
const result = await extract({
|
|
4772
|
+
kind: ExtractInputKind.Bytes,
|
|
4773
|
+
bytes: buffer,
|
|
4774
|
+
mimeType
|
|
4775
|
+
}, { outputFormat: OutputFormat.Markdown });
|
|
4776
|
+
const document = result.results?.[0];
|
|
4777
|
+
if (!document) {
|
|
4778
|
+
const reason = result.errors?.[0]?.message;
|
|
4779
|
+
throw new Error(reason ? `Extraction produced no result: ${reason}` : "Extraction produced no result");
|
|
4780
|
+
}
|
|
4781
|
+
const content = this.extractContent(document);
|
|
4682
4782
|
if (!content) {
|
|
4683
4783
|
logger.warn(`No content extracted from document: ${rawContent.source}`);
|
|
4684
4784
|
return {
|
|
@@ -4691,7 +4791,7 @@ var DocumentPipeline = class extends BasePipeline {
|
|
|
4691
4791
|
};
|
|
4692
4792
|
}
|
|
4693
4793
|
return {
|
|
4694
|
-
title:
|
|
4794
|
+
title: document.metadata?.title || this.extractFilename(rawContent.source),
|
|
4695
4795
|
contentType: "text/markdown",
|
|
4696
4796
|
textContent: content,
|
|
4697
4797
|
links: [],
|
|
@@ -4715,29 +4815,18 @@ var DocumentPipeline = class extends BasePipeline {
|
|
|
4715
4815
|
}
|
|
4716
4816
|
}
|
|
4717
4817
|
/**
|
|
4718
|
-
* Selects the best content representation from
|
|
4719
|
-
*
|
|
4720
|
-
*
|
|
4818
|
+
* Selects the best content representation from an Xberg extraction result.
|
|
4819
|
+
*
|
|
4820
|
+
* `content` is preferred for every format: Xberg's Markdown renderer emits the
|
|
4821
|
+
* full document structure there, including sheet headings and Markdown tables
|
|
4822
|
+
* for spreadsheets, so it is always a superset of `tables[].markdown`. The
|
|
4823
|
+
* concatenated table Markdown is only used when `content` comes back empty.
|
|
4721
4824
|
*/
|
|
4722
|
-
extractContent(
|
|
4723
|
-
const
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
}).join("\n\n");
|
|
4728
|
-
const hasTableContent = tableContent.trim().length > 0;
|
|
4729
|
-
const content = result.content ?? "";
|
|
4730
|
-
const hasContent = content.trim().length > 0;
|
|
4731
|
-
if (this.isSpreadsheetMimeType(mimeType)) {
|
|
4732
|
-
if (hasTableContent) return tableContent;
|
|
4733
|
-
return hasContent ? content : null;
|
|
4734
|
-
}
|
|
4735
|
-
if (hasContent) return content;
|
|
4736
|
-
if (hasTableContent) return tableContent;
|
|
4737
|
-
return null;
|
|
4738
|
-
}
|
|
4739
|
-
isSpreadsheetMimeType(mimeType) {
|
|
4740
|
-
return mimeType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || mimeType === "application/vnd.ms-excel" || mimeType === "application/vnd.oasis.opendocument.spreadsheet";
|
|
4825
|
+
extractContent(document) {
|
|
4826
|
+
const content = document.content ?? "";
|
|
4827
|
+
if (content.trim().length > 0) return content;
|
|
4828
|
+
const tableContent = (document.tables ?? []).map((t) => t.markdown ?? "").filter((markdown) => markdown.trim().length > 0).join("\n\n");
|
|
4829
|
+
return tableContent.length > 0 ? tableContent : null;
|
|
4741
4830
|
}
|
|
4742
4831
|
/**
|
|
4743
4832
|
* Resolves the effective MIME type for document processing.
|
|
@@ -4764,7 +4853,7 @@ var DocumentPipeline = class extends BasePipeline {
|
|
|
4764
4853
|
};
|
|
4765
4854
|
/**
|
|
4766
4855
|
* Maximum length (in characters) of any single error message included in
|
|
4767
|
-
* extraction failure logs.
|
|
4856
|
+
* extraction failure logs. Xberg errors may embed parts of the input
|
|
4768
4857
|
* document; truncating defends the logs against accidental binary dumps
|
|
4769
4858
|
* while still surfacing enough text to diagnose the root cause.
|
|
4770
4859
|
*/
|
|
@@ -4772,7 +4861,7 @@ var MAX_ERROR_DETAIL_LENGTH = 500;
|
|
|
4772
4861
|
/**
|
|
4773
4862
|
* Walks an `Error.cause` chain and returns a deduplicated, truncated list
|
|
4774
4863
|
* of each link's `message`. Used to surface the underlying cause of a
|
|
4775
|
-
*
|
|
4864
|
+
* Xberg extraction failure (e.g. "GLIBC_2.38 not found") rather than
|
|
4776
4865
|
* just the wrapper's generic name.
|
|
4777
4866
|
*/
|
|
4778
4867
|
function collectErrorReasons(error) {
|
|
@@ -10775,7 +10864,7 @@ var DocumentStore = class {
|
|
|
10775
10864
|
AND dv.k = ?
|
|
10776
10865
|
ORDER BY dv.distance
|
|
10777
10866
|
),
|
|
10778
|
-
fts_scores AS (
|
|
10867
|
+
fts_scores AS MATERIALIZED (
|
|
10779
10868
|
SELECT
|
|
10780
10869
|
f.rowid as id,
|
|
10781
10870
|
bm25(documents_fts, 10.0, 1.0, 5.0, 1.0) as fts_score
|
|
@@ -10786,6 +10875,20 @@ var DocumentStore = class {
|
|
|
10786
10875
|
AND documents_fts MATCH ?
|
|
10787
10876
|
ORDER BY fts_score
|
|
10788
10877
|
LIMIT ?
|
|
10878
|
+
),
|
|
10879
|
+
candidates AS (
|
|
10880
|
+
-- Union of vector and full-text candidate ids so the final query is
|
|
10881
|
+
-- driven by the small match set instead of scanning the entire
|
|
10882
|
+
-- documents table. Keeps search cost proportional to matches, not
|
|
10883
|
+
-- total database size.
|
|
10884
|
+
--
|
|
10885
|
+
-- Both source CTEs are referenced twice (here and in the LEFT JOINs
|
|
10886
|
+
-- below) and are pinned with MATERIALIZED so they are evaluated
|
|
10887
|
+
-- exactly once. Leaving this to the query planner is what caused
|
|
10888
|
+
-- the search regression in #454.
|
|
10889
|
+
SELECT id FROM vec_distances
|
|
10890
|
+
UNION
|
|
10891
|
+
SELECT id FROM fts_scores
|
|
10789
10892
|
)
|
|
10790
10893
|
SELECT
|
|
10791
10894
|
d.id,
|
|
@@ -10797,15 +10900,15 @@ var DocumentStore = class {
|
|
|
10797
10900
|
p.content_type as content_type,
|
|
10798
10901
|
COALESCE(1 / (1 + v.vec_distance), 0) as vec_score,
|
|
10799
10902
|
COALESCE(-MIN(f.fts_score, 0), 0) as fts_score
|
|
10800
|
-
FROM
|
|
10903
|
+
FROM candidates c
|
|
10904
|
+
JOIN documents d ON d.id = c.id
|
|
10801
10905
|
JOIN pages p ON d.page_id = p.id
|
|
10802
10906
|
LEFT JOIN vec_distances v ON d.id = v.id
|
|
10803
10907
|
LEFT JOIN fts_scores f ON d.id = f.id
|
|
10804
|
-
WHERE
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
)
|
|
10908
|
+
WHERE NOT EXISTS (
|
|
10909
|
+
SELECT 1 FROM json_each(json_extract(d.metadata, '$.types')) je
|
|
10910
|
+
WHERE je.value = 'structural'
|
|
10911
|
+
)
|
|
10809
10912
|
`).all(libraryId, versionId, JSON.stringify(embedding), vectorSearchK, versionId, ftsQuery, overfetchLimit);
|
|
10810
10913
|
return this.assignRanks(rawResults).sort((a, b) => b.rrf_score - a.rrf_score).slice(0, limit).map((row) => {
|
|
10811
10914
|
const result = {
|
|
@@ -12021,10 +12124,10 @@ var Toast = () => {
|
|
|
12021
12124
|
/**
|
|
12022
12125
|
* Base HTML layout component for all pages.
|
|
12023
12126
|
* Includes common head elements, header, and scripts.
|
|
12024
|
-
* @param props - Component props including title, version,
|
|
12127
|
+
* @param props - Component props including title, version, and children.
|
|
12025
12128
|
*/
|
|
12026
|
-
var Layout = ({ title, version, children
|
|
12027
|
-
const versionString = version || "2.
|
|
12129
|
+
var Layout = ({ title, version, children }) => {
|
|
12130
|
+
const versionString = version || "2.5.0";
|
|
12028
12131
|
const versionInitializer = `versionUpdate({ currentVersion: ${versionString ? `'${versionString}'` : "null"} })`;
|
|
12029
12132
|
return /* @__PURE__ */ jsxs("html", {
|
|
12030
12133
|
lang: "en",
|
|
@@ -12296,7 +12399,6 @@ var Layout = ({ title, version, children, eventClientConfig }) => {
|
|
|
12296
12399
|
class: "container max-w-2xl mx-auto px-4 py-6",
|
|
12297
12400
|
children: /* @__PURE__ */ jsx("main", { children })
|
|
12298
12401
|
}),
|
|
12299
|
-
/* @__PURE__ */ jsx("script", { children: `window.__EVENT_CLIENT_CONFIG__ = ${JSON.stringify(eventClientConfig)};` }),
|
|
12300
12402
|
/* @__PURE__ */ jsx("script", {
|
|
12301
12403
|
type: "module",
|
|
12302
12404
|
src: "/assets/main.js"
|
|
@@ -12310,17 +12412,12 @@ var Layout = ({ title, version, children, eventClientConfig }) => {
|
|
|
12310
12412
|
/**
|
|
12311
12413
|
* Registers the root route that serves the main HTML page.
|
|
12312
12414
|
* @param server - The Fastify instance.
|
|
12313
|
-
* @param externalWorkerUrl - Optional URL for external worker service.
|
|
12314
12415
|
*/
|
|
12315
|
-
function registerIndexRoute(server
|
|
12416
|
+
function registerIndexRoute(server) {
|
|
12316
12417
|
server.get("/", async (_, reply) => {
|
|
12317
12418
|
reply.type("text/html");
|
|
12318
12419
|
return "<!DOCTYPE html>" + /* @__PURE__ */ jsxs(Layout, {
|
|
12319
12420
|
title: "MCP Docs",
|
|
12320
|
-
eventClientConfig: {
|
|
12321
|
-
useRemoteWorker: Boolean(externalWorkerUrl),
|
|
12322
|
-
trpcUrl: externalWorkerUrl ? `${externalWorkerUrl}/api` : void 0
|
|
12323
|
-
},
|
|
12324
12421
|
children: [
|
|
12325
12422
|
/* @__PURE__ */ jsx("div", {
|
|
12326
12423
|
id: "analytics-stats",
|
|
@@ -14235,7 +14332,7 @@ function registerStatsRoute(server, docService) {
|
|
|
14235
14332
|
* This includes all human-facing UI routes.
|
|
14236
14333
|
* Note: Static file serving and form body parsing are handled by AppServer.
|
|
14237
14334
|
*/
|
|
14238
|
-
async function registerWebService(server, docService, pipeline, eventBus, appConfig
|
|
14335
|
+
async function registerWebService(server, docService, pipeline, eventBus, appConfig) {
|
|
14239
14336
|
const listLibrariesTool = new ListLibrariesTool(docService);
|
|
14240
14337
|
const listJobsTool = new ListJobsTool(pipeline);
|
|
14241
14338
|
const scrapeTool = new ScrapeTool(pipeline, appConfig.scraper);
|
|
@@ -14244,7 +14341,7 @@ async function registerWebService(server, docService, pipeline, eventBus, appCon
|
|
|
14244
14341
|
const searchTool = new SearchTool(docService);
|
|
14245
14342
|
const cancelJobTool = new CancelJobTool(pipeline);
|
|
14246
14343
|
const clearCompletedJobsTool = new ClearCompletedJobsTool(pipeline);
|
|
14247
|
-
registerIndexRoute(server
|
|
14344
|
+
registerIndexRoute(server);
|
|
14248
14345
|
registerLibrariesRoutes(server, listLibrariesTool, removeTool, refreshVersionTool);
|
|
14249
14346
|
registerLibraryDetailRoutes(server, listLibrariesTool, searchTool, scrapeTool, docService);
|
|
14250
14347
|
registerJobListRoutes(server, listJobsTool);
|
|
@@ -14340,7 +14437,7 @@ var AppServer = class AppServer {
|
|
|
14340
14437
|
if (this.appConfig.app.telemetryEnabled && shouldEnableTelemetry()) try {
|
|
14341
14438
|
if (telemetry.isEnabled()) {
|
|
14342
14439
|
telemetry.setGlobalContext({
|
|
14343
|
-
appVersion: "2.
|
|
14440
|
+
appVersion: "2.5.0",
|
|
14344
14441
|
appPlatform: process.platform,
|
|
14345
14442
|
appNodeVersion: process.version,
|
|
14346
14443
|
appServicesEnabled: this.getActiveServicesList(),
|
|
@@ -14503,7 +14600,7 @@ var AppServer = class AppServer {
|
|
|
14503
14600
|
* Enable web interface service.
|
|
14504
14601
|
*/
|
|
14505
14602
|
async enableWebInterface() {
|
|
14506
|
-
await registerWebService(this.server, this.docService, this.pipeline, this.eventBus, this.appConfig
|
|
14603
|
+
await registerWebService(this.server, this.docService, this.pipeline, this.eventBus, this.appConfig);
|
|
14507
14604
|
logger.debug("Web interface service enabled");
|
|
14508
14605
|
}
|
|
14509
14606
|
/**
|
|
@@ -18453,7 +18550,7 @@ function createCli(argv) {
|
|
|
18453
18550
|
let globalEventBus = null;
|
|
18454
18551
|
let globalTelemetryService = null;
|
|
18455
18552
|
const commandStartTimes = /* @__PURE__ */ new Map();
|
|
18456
|
-
const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("2.
|
|
18553
|
+
const cli = registerGlobalOutputOptions(yargs(hideBin(argv))).scriptName("docs-mcp-server").strict().usage("Usage: $0 <command> [options]").version("2.5.0").option("verbose", {
|
|
18457
18554
|
type: "boolean",
|
|
18458
18555
|
description: "Enable verbose (debug) logging",
|
|
18459
18556
|
default: false
|
|
@@ -18503,7 +18600,7 @@ function createCli(argv) {
|
|
|
18503
18600
|
if (shouldEnableTelemetry() && telemetry.isEnabled()) {
|
|
18504
18601
|
const commandName = argv._[0]?.toString() || "default";
|
|
18505
18602
|
telemetry.setGlobalContext({
|
|
18506
|
-
appVersion: "2.
|
|
18603
|
+
appVersion: "2.5.0",
|
|
18507
18604
|
appPlatform: process.platform,
|
|
18508
18605
|
appNodeVersion: process.version,
|
|
18509
18606
|
appInterface: "cli",
|
|
@@ -18643,4 +18740,4 @@ async function runCli() {
|
|
|
18643
18740
|
//#endregion
|
|
18644
18741
|
export { cleanupCliCommand, runCli };
|
|
18645
18742
|
|
|
18646
|
-
//# sourceMappingURL=main-
|
|
18743
|
+
//# sourceMappingURL=main-IwoXB6_B.js.map
|