@farming-labs/docs 0.2.123 → 0.2.125
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/mcp.d.mts +4 -1
- package/dist/mcp.mjs +148 -87
- package/dist/types.d.mts +2 -0
- package/package.json +2 -2
package/dist/mcp.d.mts
CHANGED
|
@@ -254,6 +254,8 @@ interface DocsMcpResolvedSecurityConfig {
|
|
|
254
254
|
authenticate?: DocsMcpAuthenticate;
|
|
255
255
|
protectedResource?: DocsMcpResolvedProtectedResourceConfig;
|
|
256
256
|
maxBodyBytes: number;
|
|
257
|
+
/** Optional for manually constructed resolved configs from older releases. */
|
|
258
|
+
maxToolInputElements?: number;
|
|
257
259
|
cors: DocsMcpResolvedCorsConfig;
|
|
258
260
|
}
|
|
259
261
|
interface DocsMcpResolvedProtectedResourceConfig {
|
|
@@ -364,6 +366,7 @@ declare const DOCS_MCP_CONTENT_CHANGES_CURRENT_URI = "docs://changes/current";
|
|
|
364
366
|
declare const DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE = "docs://changes/{generation}";
|
|
365
367
|
declare const DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS = 30000;
|
|
366
368
|
declare const DEFAULT_DOCS_MCP_MAX_BODY_BYTES: number;
|
|
369
|
+
declare const DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS = 10000;
|
|
367
370
|
declare const DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS = 600;
|
|
368
371
|
declare const DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS: readonly string[];
|
|
369
372
|
declare const DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS: readonly string[];
|
|
@@ -385,4 +388,4 @@ declare function getDocsConfigSchema(filters?: {
|
|
|
385
388
|
}): DocsMcpConfigSchema;
|
|
386
389
|
declare function buildDocsMcpContext(options: DocsMcpContextOptions): Promise<DocsMcpContextResult>;
|
|
387
390
|
//#endregion
|
|
388
|
-
export { CreateDocsMcpServerOptions, DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DOCS_CONFIG_SCHEMA_OPTIONS, DOCS_CONTENT_CHANGE_HYDRATION_FORMAT, DOCS_MCP_CONTENT_CHANGES_CURRENT_URI, DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE, type DocsContentChangeHydrationBudget, type DocsContentChangeHydrationContent, type DocsContentChangeHydrationResponse, type DocsContentChangeHydrationSection, type DocsContentChangeHydrationTombstone, DocsMcpAgentContractSummary, DocsMcpApiReferenceSource, DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpContextOptions, DocsMcpContextResult, DocsMcpContextSource, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpPageSectionIndex, DocsMcpPageSectionList, DocsMcpPaginatedDocsList, DocsMcpPagination, DocsMcpRequestContext, DocsMcpResolvedConfig, DocsMcpResolvedCorsConfig, DocsMcpResolvedPromptsConfig, DocsMcpResolvedProtectedResourceConfig, DocsMcpResolvedSecurityConfig, DocsMcpSource, DocsMcpTaskSummary, type HydrateDocsContentChangesOptions, MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, hydrateDocsContentChanges, normalizeDocsMcpRoute, resolveDocsMcpConfig, resolveDocsMcpPromptsConfig, runDocsMcpStdio };
|
|
391
|
+
export { CreateDocsMcpServerOptions, DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS, DOCS_CONFIG_SCHEMA_OPTIONS, DOCS_CONTENT_CHANGE_HYDRATION_FORMAT, DOCS_MCP_CONTENT_CHANGES_CURRENT_URI, DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE, type DocsContentChangeHydrationBudget, type DocsContentChangeHydrationContent, type DocsContentChangeHydrationResponse, type DocsContentChangeHydrationSection, type DocsContentChangeHydrationTombstone, DocsMcpAgentContractSummary, DocsMcpApiReferenceSource, DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpContextOptions, DocsMcpContextResult, DocsMcpContextSource, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpPageSectionIndex, DocsMcpPageSectionList, DocsMcpPaginatedDocsList, DocsMcpPagination, DocsMcpRequestContext, DocsMcpResolvedConfig, DocsMcpResolvedCorsConfig, DocsMcpResolvedPromptsConfig, DocsMcpResolvedProtectedResourceConfig, DocsMcpResolvedSecurityConfig, DocsMcpSource, DocsMcpTaskSummary, type HydrateDocsContentChangesOptions, MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, hydrateDocsContentChanges, normalizeDocsMcpRoute, resolveDocsMcpConfig, resolveDocsMcpPromptsConfig, runDocsMcpStdio };
|
package/dist/mcp.mjs
CHANGED
|
@@ -62,6 +62,7 @@ const DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE = "docs://changes/{generation}";
|
|
|
62
62
|
const DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS = 3e4;
|
|
63
63
|
const UTF8_ENCODER = new TextEncoder();
|
|
64
64
|
const DEFAULT_DOCS_MCP_MAX_BODY_BYTES = 1024 * 1024;
|
|
65
|
+
const DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS = 1e4;
|
|
65
66
|
const DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS = 600;
|
|
66
67
|
const DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS = Object.freeze([
|
|
67
68
|
"Accept",
|
|
@@ -1767,6 +1768,13 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
1767
1768
|
default: DEFAULT_DOCS_MCP_MAX_BODY_BYTES,
|
|
1768
1769
|
description: "Maximum accepted Streamable HTTP POST body size in bytes."
|
|
1769
1770
|
},
|
|
1771
|
+
{
|
|
1772
|
+
path: "mcp.security.maxToolInputElements",
|
|
1773
|
+
name: "maxToolInputElements",
|
|
1774
|
+
type: "number",
|
|
1775
|
+
default: DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS,
|
|
1776
|
+
description: "Maximum total array items and object keys in Streamable HTTP tool arguments, checked before schema validation. Does not affect stdio."
|
|
1777
|
+
},
|
|
1770
1778
|
{
|
|
1771
1779
|
path: "mcp.security.cors",
|
|
1772
1780
|
name: "cors",
|
|
@@ -2962,11 +2970,14 @@ function normalizeDocsMcpPromptSelectorList(value, configPath) {
|
|
|
2962
2970
|
function resolveDocsMcpSecurityConfig(security) {
|
|
2963
2971
|
const configuredMaxBodyBytes = security?.maxBodyBytes;
|
|
2964
2972
|
const maxBodyBytes = typeof configuredMaxBodyBytes === "number" && Number.isFinite(configuredMaxBodyBytes) && configuredMaxBodyBytes > 0 ? Math.floor(configuredMaxBodyBytes) : DEFAULT_DOCS_MCP_MAX_BODY_BYTES;
|
|
2973
|
+
const configuredMaxToolInputElements = security?.maxToolInputElements;
|
|
2974
|
+
const maxToolInputElements = typeof configuredMaxToolInputElements === "number" && Number.isSafeInteger(Math.floor(configuredMaxToolInputElements)) && configuredMaxToolInputElements >= 1 ? Math.floor(configuredMaxToolInputElements) : DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS;
|
|
2965
2975
|
return {
|
|
2966
2976
|
allowedOrigins: security?.allowedOrigins ?? "same-origin",
|
|
2967
2977
|
authenticate: security?.authenticate,
|
|
2968
2978
|
protectedResource: resolveDocsMcpProtectedResourceConfig(security?.protectedResource),
|
|
2969
2979
|
maxBodyBytes,
|
|
2980
|
+
maxToolInputElements,
|
|
2970
2981
|
cors: resolveDocsMcpCorsConfig(security?.cors)
|
|
2971
2982
|
};
|
|
2972
2983
|
}
|
|
@@ -3387,32 +3398,35 @@ async function createDocsMcpServer(options) {
|
|
|
3387
3398
|
const server = new McpServer({
|
|
3388
3399
|
name: resolved.name,
|
|
3389
3400
|
version: resolved.version
|
|
3390
|
-
}, {
|
|
3391
|
-
"
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3401
|
+
}, {
|
|
3402
|
+
...options.requestContext?.transport === "http" ? { maxToolInputElements: resolved.security?.maxToolInputElements ?? DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS } : {},
|
|
3403
|
+
cacheHints: {
|
|
3404
|
+
"server/discover": {
|
|
3405
|
+
ttlMs: DOCS_MCP_DISCOVERY_CACHE_TTL_MS,
|
|
3406
|
+
cacheScope
|
|
3407
|
+
},
|
|
3408
|
+
"tools/list": {
|
|
3409
|
+
ttlMs: DOCS_MCP_LIST_CACHE_TTL_MS,
|
|
3410
|
+
cacheScope
|
|
3411
|
+
},
|
|
3412
|
+
"prompts/list": {
|
|
3413
|
+
ttlMs: DOCS_MCP_LIST_CACHE_TTL_MS,
|
|
3414
|
+
cacheScope
|
|
3415
|
+
},
|
|
3416
|
+
"resources/list": {
|
|
3417
|
+
ttlMs: DOCS_MCP_LIST_CACHE_TTL_MS,
|
|
3418
|
+
cacheScope
|
|
3419
|
+
},
|
|
3420
|
+
"resources/templates/list": {
|
|
3421
|
+
ttlMs: DOCS_MCP_LIST_CACHE_TTL_MS,
|
|
3422
|
+
cacheScope
|
|
3423
|
+
},
|
|
3424
|
+
"resources/read": {
|
|
3425
|
+
ttlMs: DOCS_MCP_RESOURCE_CACHE_TTL_MS,
|
|
3426
|
+
cacheScope
|
|
3427
|
+
}
|
|
3414
3428
|
}
|
|
3415
|
-
}
|
|
3429
|
+
});
|
|
3416
3430
|
installDocsMcpSdkRegistrationPagination(server, protocolScope);
|
|
3417
3431
|
if (contentChangesEnabled) server.server.registerCapabilities({ resources: { subscribe: true } });
|
|
3418
3432
|
const registerResource = (name, uri, metadata, callback) => {
|
|
@@ -5953,82 +5967,107 @@ function resolveFilesystemDocsPageSource(dir) {
|
|
|
5953
5967
|
candidate
|
|
5954
5968
|
));
|
|
5955
5969
|
}
|
|
5956
|
-
function
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5970
|
+
function normalizeFrontmatterLastmod(value) {
|
|
5971
|
+
if (typeof value === "string") return value;
|
|
5972
|
+
return value instanceof Date && Number.isFinite(value.getTime()) ? value.toISOString() : void 0;
|
|
5973
|
+
}
|
|
5974
|
+
function scanFilesystemDocsPages(contentDirAbs, entry, rootDir) {
|
|
5975
|
+
const pages = [];
|
|
5976
|
+
const directoryEntries = /* @__PURE__ */ new Map();
|
|
5977
|
+
const fileStats = /* @__PURE__ */ new Map();
|
|
5978
|
+
const documents = /* @__PURE__ */ new Map();
|
|
5979
|
+
const visibleDescendants = /* @__PURE__ */ new Map();
|
|
5980
|
+
function readDirectory(dir) {
|
|
5981
|
+
const cached = directoryEntries.get(dir);
|
|
5982
|
+
if (cached) return cached;
|
|
5983
|
+
const entries = fs.readdirSync(
|
|
5960
5984
|
/* turbopackIgnore: true */
|
|
5961
5985
|
dir
|
|
5962
|
-
);
|
|
5963
|
-
|
|
5964
|
-
return
|
|
5986
|
+
).sort();
|
|
5987
|
+
directoryEntries.set(dir, entries);
|
|
5988
|
+
return entries;
|
|
5965
5989
|
}
|
|
5966
|
-
|
|
5967
|
-
const
|
|
5990
|
+
function readStat(file) {
|
|
5991
|
+
const cached = fileStats.get(file);
|
|
5992
|
+
if (cached) return cached;
|
|
5993
|
+
const stat = fs.statSync(
|
|
5968
5994
|
/* turbopackIgnore: true */
|
|
5969
|
-
|
|
5970
|
-
name
|
|
5995
|
+
file
|
|
5971
5996
|
);
|
|
5997
|
+
fileStats.set(file, stat);
|
|
5998
|
+
return stat;
|
|
5999
|
+
}
|
|
6000
|
+
function readDocument(file) {
|
|
6001
|
+
const cached = documents.get(file);
|
|
6002
|
+
if (cached) return cached;
|
|
6003
|
+
const { data, content } = matter(fs.readFileSync(
|
|
6004
|
+
/* turbopackIgnore: true */
|
|
6005
|
+
file,
|
|
6006
|
+
"utf-8"
|
|
6007
|
+
));
|
|
6008
|
+
const document = {
|
|
6009
|
+
data,
|
|
6010
|
+
content
|
|
6011
|
+
};
|
|
6012
|
+
documents.set(file, document);
|
|
6013
|
+
return document;
|
|
6014
|
+
}
|
|
6015
|
+
function hasVisibleDescendantFilesystemDocsPage(dir) {
|
|
6016
|
+
const cached = visibleDescendants.get(dir);
|
|
6017
|
+
if (cached !== void 0) return cached;
|
|
6018
|
+
const remember = (visible) => {
|
|
6019
|
+
visibleDescendants.set(dir, visible);
|
|
6020
|
+
return visible;
|
|
6021
|
+
};
|
|
6022
|
+
let entries;
|
|
5972
6023
|
try {
|
|
5973
|
-
|
|
5974
|
-
/* turbopackIgnore: true */
|
|
5975
|
-
full
|
|
5976
|
-
).isDirectory()) continue;
|
|
6024
|
+
entries = readDirectory(dir);
|
|
5977
6025
|
} catch {
|
|
5978
|
-
|
|
6026
|
+
return false;
|
|
5979
6027
|
}
|
|
5980
|
-
const
|
|
5981
|
-
|
|
5982
|
-
const data = matter(fs.readFileSync(
|
|
6028
|
+
for (const name of entries) {
|
|
6029
|
+
const full = path.join(
|
|
5983
6030
|
/* turbopackIgnore: true */
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
)
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6031
|
+
dir,
|
|
6032
|
+
name
|
|
6033
|
+
);
|
|
6034
|
+
try {
|
|
6035
|
+
if (!readStat(full).isDirectory()) continue;
|
|
6036
|
+
} catch {
|
|
6037
|
+
continue;
|
|
6038
|
+
}
|
|
6039
|
+
const pageSource = resolveFilesystemDocsPageSource(full);
|
|
6040
|
+
if (pageSource) try {
|
|
6041
|
+
const data = readDocument(pageSource).data;
|
|
6042
|
+
const hiddenFolderIndex = resolvePageSidebarFolderIndexBehavior(data.sidebar) === "hidden";
|
|
6043
|
+
if (data.hidden !== true && !hiddenFolderIndex) return remember(true);
|
|
6044
|
+
} catch {
|
|
6045
|
+
return remember(true);
|
|
6046
|
+
}
|
|
6047
|
+
if (hasVisibleDescendantFilesystemDocsPage(full)) return remember(true);
|
|
5991
6048
|
}
|
|
5992
|
-
|
|
6049
|
+
return remember(false);
|
|
5993
6050
|
}
|
|
5994
|
-
return false;
|
|
5995
|
-
}
|
|
5996
|
-
function normalizeFrontmatterLastmod(value) {
|
|
5997
|
-
if (typeof value === "string") return value;
|
|
5998
|
-
return value instanceof Date && Number.isFinite(value.getTime()) ? value.toISOString() : void 0;
|
|
5999
|
-
}
|
|
6000
|
-
function scanFilesystemDocsPages(contentDirAbs, entry, rootDir) {
|
|
6001
|
-
const pages = [];
|
|
6002
6051
|
function scan(dir, slugParts) {
|
|
6003
6052
|
if (!fs.existsSync(
|
|
6004
6053
|
/* turbopackIgnore: true */
|
|
6005
6054
|
dir
|
|
6006
6055
|
)) return;
|
|
6007
|
-
const entries =
|
|
6008
|
-
/* turbopackIgnore: true */
|
|
6009
|
-
dir
|
|
6010
|
-
).sort();
|
|
6056
|
+
const entries = readDirectory(dir);
|
|
6011
6057
|
for (const name of entries) {
|
|
6012
6058
|
const full = path.join(
|
|
6013
6059
|
/* turbopackIgnore: true */
|
|
6014
6060
|
dir,
|
|
6015
6061
|
name
|
|
6016
6062
|
);
|
|
6017
|
-
const stat =
|
|
6018
|
-
/* turbopackIgnore: true */
|
|
6019
|
-
full
|
|
6020
|
-
);
|
|
6063
|
+
const stat = readStat(full);
|
|
6021
6064
|
if (stat.isDirectory()) {
|
|
6022
6065
|
scan(full, [...slugParts, name]);
|
|
6023
6066
|
continue;
|
|
6024
6067
|
}
|
|
6025
6068
|
if (name === "agent.md") continue;
|
|
6026
6069
|
if (!name.endsWith(".md") && !name.endsWith(".mdx") && !name.endsWith(".svx")) continue;
|
|
6027
|
-
const { data, content } =
|
|
6028
|
-
/* turbopackIgnore: true */
|
|
6029
|
-
full,
|
|
6030
|
-
"utf-8"
|
|
6031
|
-
));
|
|
6070
|
+
const { data, content } = readDocument(full);
|
|
6032
6071
|
const baseName = name.replace(/\.(md|mdx|svx)$/, "");
|
|
6033
6072
|
const isIndex = baseName === "index" || baseName === "page" || baseName === "+page";
|
|
6034
6073
|
if (isIndex && resolvePageSidebarFolderIndexBehavior(data.sidebar) === "hidden" && hasVisibleDescendantFilesystemDocsPage(dir)) continue;
|
|
@@ -6104,12 +6143,42 @@ function resolveRelatedForMcpPages(pages) {
|
|
|
6104
6143
|
function buildNavigationTreeFromPages(pages, siteTitle, ordering) {
|
|
6105
6144
|
const bySlug = new Map(pages.map((page) => [page.slug, page]));
|
|
6106
6145
|
const rootPage = bySlug.get("");
|
|
6146
|
+
const childrenBySlug = /* @__PURE__ */ new Map();
|
|
6147
|
+
const orderingIndexes = /* @__PURE__ */ new Map();
|
|
6148
|
+
function childrenOf(slug) {
|
|
6149
|
+
let children = childrenBySlug.get(slug);
|
|
6150
|
+
if (!children) {
|
|
6151
|
+
children = /* @__PURE__ */ new Set();
|
|
6152
|
+
childrenBySlug.set(slug, children);
|
|
6153
|
+
}
|
|
6154
|
+
return children;
|
|
6155
|
+
}
|
|
6156
|
+
for (const page of pages) {
|
|
6157
|
+
const slug = page.slug;
|
|
6158
|
+
let parent = "";
|
|
6159
|
+
let start = 0;
|
|
6160
|
+
while (start < slug.length) {
|
|
6161
|
+
const separator = slug.indexOf("/", start);
|
|
6162
|
+
const child = separator === -1 ? slug : slug.slice(0, separator);
|
|
6163
|
+
childrenOf(parent).add(child);
|
|
6164
|
+
if (separator === -1) break;
|
|
6165
|
+
childrenOf(child);
|
|
6166
|
+
parent = child;
|
|
6167
|
+
start = separator + 1;
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6107
6170
|
function childOrderFor(parentSlug) {
|
|
6108
6171
|
if (!Array.isArray(ordering)) return void 0;
|
|
6109
6172
|
if (!parentSlug) return ordering;
|
|
6110
6173
|
let items = ordering;
|
|
6111
6174
|
for (const segment of parentSlug.split("/")) {
|
|
6112
|
-
|
|
6175
|
+
let index = orderingIndexes.get(items);
|
|
6176
|
+
if (!index) {
|
|
6177
|
+
index = /* @__PURE__ */ new Map();
|
|
6178
|
+
for (const item of items) if (!index.has(item.slug)) index.set(item.slug, item);
|
|
6179
|
+
orderingIndexes.set(items, index);
|
|
6180
|
+
}
|
|
6181
|
+
items = index.get(segment)?.children;
|
|
6113
6182
|
if (!items) return void 0;
|
|
6114
6183
|
}
|
|
6115
6184
|
return items;
|
|
@@ -6118,10 +6187,11 @@ function buildNavigationTreeFromPages(pages, siteTitle, ordering) {
|
|
|
6118
6187
|
const explicitOrder = childOrderFor(parentSlug);
|
|
6119
6188
|
if (explicitOrder) {
|
|
6120
6189
|
const explicit = new Set(explicitOrder.map((item) => item.slug));
|
|
6190
|
+
const available = new Set(childSlugs);
|
|
6121
6191
|
const ordered = [];
|
|
6122
6192
|
for (const item of explicitOrder) {
|
|
6123
6193
|
const childSlug = parentSlug ? `${parentSlug}/${item.slug}` : item.slug;
|
|
6124
|
-
if (
|
|
6194
|
+
if (available.has(childSlug)) ordered.push(childSlug);
|
|
6125
6195
|
}
|
|
6126
6196
|
for (const childSlug of childSlugs) {
|
|
6127
6197
|
const segment = childSlug.split("/").pop() ?? childSlug;
|
|
@@ -6140,20 +6210,11 @@ function buildNavigationTreeFromPages(pages, siteTitle, ordering) {
|
|
|
6140
6210
|
return [...childSlugs].sort((left, right) => left.localeCompare(right));
|
|
6141
6211
|
}
|
|
6142
6212
|
function buildLevel(parentSlug) {
|
|
6143
|
-
const
|
|
6144
|
-
const childSet = /* @__PURE__ */ new Set();
|
|
6145
|
-
for (const page of pages) {
|
|
6146
|
-
if (!page.slug.startsWith(prefix) || page.slug === parentSlug) continue;
|
|
6147
|
-
const remainder = page.slug.slice(prefix.length);
|
|
6148
|
-
if (!remainder) continue;
|
|
6149
|
-
const [firstSegment] = remainder.split("/");
|
|
6150
|
-
childSet.add(parentSlug ? `${parentSlug}/${firstSegment}` : firstSegment);
|
|
6151
|
-
}
|
|
6152
|
-
const childSlugs = sortChildSlugs([...childSet], parentSlug);
|
|
6213
|
+
const childSlugs = sortChildSlugs([...childrenBySlug.get(parentSlug) ?? []], parentSlug);
|
|
6153
6214
|
const nodes = [];
|
|
6154
6215
|
for (const childSlug of childSlugs) {
|
|
6155
6216
|
const page = bySlug.get(childSlug);
|
|
6156
|
-
const hasChildren =
|
|
6217
|
+
const hasChildren = childrenBySlug.has(childSlug);
|
|
6157
6218
|
const segment = childSlug.split("/").pop() ?? childSlug;
|
|
6158
6219
|
const name = page?.title ?? titleize(segment);
|
|
6159
6220
|
const icon = page?.icon;
|
|
@@ -7102,4 +7163,4 @@ function toPageResourceUri(url) {
|
|
|
7102
7163
|
}
|
|
7103
7164
|
|
|
7104
7165
|
//#endregion
|
|
7105
|
-
export { DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DOCS_CONFIG_SCHEMA_OPTIONS, DOCS_CONTENT_CHANGE_HYDRATION_FORMAT, DOCS_MCP_CONTENT_CHANGES_CURRENT_URI, DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE, MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, hydrateDocsContentChanges, normalizeDocsMcpRoute, resolveDocsMcpConfig, resolveDocsMcpPromptsConfig, runDocsMcpStdio };
|
|
7166
|
+
export { DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, DEFAULT_DOCS_MCP_CONTENT_CHANGE_POLL_INTERVAL_MS, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DEFAULT_DOCS_MCP_MAX_TOOL_INPUT_ELEMENTS, DOCS_CONFIG_SCHEMA_OPTIONS, DOCS_CONTENT_CHANGE_HYDRATION_FORMAT, DOCS_MCP_CONTENT_CHANGES_CURRENT_URI, DOCS_MCP_CONTENT_CHANGES_URI_TEMPLATE, MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, hydrateDocsContentChanges, normalizeDocsMcpRoute, resolveDocsMcpConfig, resolveDocsMcpPromptsConfig, runDocsMcpStdio };
|
package/dist/types.d.mts
CHANGED
|
@@ -1403,6 +1403,8 @@ interface DocsMcpSecurityConfig {
|
|
|
1403
1403
|
protectedResource?: DocsMcpProtectedResourceConfig;
|
|
1404
1404
|
/** Maximum POST body size in bytes. Defaults to 1 MiB. */
|
|
1405
1405
|
maxBodyBytes?: number;
|
|
1406
|
+
/** Maximum total array items and object keys in HTTP tool arguments. Defaults to 10,000. */
|
|
1407
|
+
maxToolInputElements?: number;
|
|
1406
1408
|
/**
|
|
1407
1409
|
* CORS responses for accepted browser Origins. Defaults to enabled with exact-Origin responses;
|
|
1408
1410
|
* set `false` to suppress CORS headers or use an object for credential/header controls.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/docs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.125",
|
|
4
4
|
"description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@clack/prompts": "^1.7.0",
|
|
100
|
-
"@modelcontextprotocol/server": "2.
|
|
100
|
+
"@modelcontextprotocol/server": "2.3.0",
|
|
101
101
|
"@scalar/core": "^0.4.3",
|
|
102
102
|
"github-slugger": "^2.0.0",
|
|
103
103
|
"gray-matter": "^4.0.3",
|