@farming-labs/docs 0.1.115 → 0.1.117
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/cli/index.mjs +2 -2
- package/dist/{doctor-CgCcBScE.mjs → doctor-CaDyUn0F.mjs} +3 -1
- package/dist/index.d.mts +4 -2
- package/dist/{mcp-Cv95rruE.mjs → mcp-BUf-9KXn.mjs} +3 -1
- package/dist/mcp.d.mts +47 -2
- package/dist/mcp.mjs +773 -2
- package/dist/{search-DjVbXEmb.d.mts → search-Dlwp88qb.d.mts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/{types-Zk0mIMGI.d.mts → types-D-cNOo-t.d.mts} +4 -0
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -83,7 +83,7 @@ async function main() {
|
|
|
83
83
|
const { dev } = await import("../dev-FC6Fh7nT.mjs");
|
|
84
84
|
await dev(devOptions);
|
|
85
85
|
} else if (parsedCommand.command === "mcp") {
|
|
86
|
-
const { runMcp } = await import("../mcp-
|
|
86
|
+
const { runMcp } = await import("../mcp-BUf-9KXn.mjs");
|
|
87
87
|
await runMcp(mcpOptions);
|
|
88
88
|
} else if (parsedCommand.command === "agent" && subcommand === "compact") {
|
|
89
89
|
const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-D8DpCgt_.mjs");
|
|
@@ -114,7 +114,7 @@ async function main() {
|
|
|
114
114
|
printAgentsGenerateHelp();
|
|
115
115
|
process.exit(1);
|
|
116
116
|
} else if (parsedCommand.command === "doctor") {
|
|
117
|
-
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-
|
|
117
|
+
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-CaDyUn0F.mjs");
|
|
118
118
|
const doctorOptions = parseDoctorArgs(args.slice(1));
|
|
119
119
|
if (doctorOptions.help) {
|
|
120
120
|
printDoctorHelp();
|
|
@@ -955,7 +955,9 @@ async function probeMcpRoute(baseUrl, route) {
|
|
|
955
955
|
"list_pages",
|
|
956
956
|
"get_navigation",
|
|
957
957
|
"search_docs",
|
|
958
|
-
"read_page"
|
|
958
|
+
"read_page",
|
|
959
|
+
"get_code_examples",
|
|
960
|
+
"get_config_schema"
|
|
959
961
|
].filter((tool) => !toolNames.includes(tool));
|
|
960
962
|
if (missingTools.length > 0) return {
|
|
961
963
|
ok: false,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as DocsSearchResultType, A as DocsConfig, At as SidebarFolderNode, B as DocsObservabilityEventInput, C as DocsAskAIActionData, Ct as PageSidebarFrontmatter, D as DocsAskAIFeedbackMessage, Dt as SidebarComponentProps, E as DocsAskAIFeedbackData, Et as ResolvedDocsRelatedLink, F as DocsMcpToolsConfig, Ft as ThemeToggleConfig, G as DocsSearchAdapterContext, H as DocsRobotsConfig, I as DocsMetadata, It as TypesenseDocsSearchConfig, J as DocsSearchConfig, K as DocsSearchAdapterFactory, L as DocsNav, Lt as TypographyConfig, M as DocsFeedbackValue, Mt as SidebarPageNode, N as DocsI18nConfig, Nt as SidebarTree, O as DocsAskAIFeedbackValue, Ot as SidebarConfig, P as DocsMcpConfig, Pt as SimpleDocsSearchConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, Rt as UIConfig, S as DocsAnalyticsSource, St as PageOpenGraph, T as DocsAskAIFeedbackConfig, Tt as ReadingTimeConfig, U as DocsRobotsRule, V as DocsRelatedItem, W as DocsSearchAdapter, X as DocsSearchEmbeddingsConfig, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, _t as OpenDocsTarget, a as ApiReferenceRenderer, at as GithubConfig, b as DocsAnalyticsEventType, bt as PageActionsConfig, c as ChangelogFrontmatter, ct as LlmsTxtMaxCharsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, f as DocsAgentFeedbackContext, ft as OGConfig, g as DocsAgentTraceStatus, gt as OpenDocsProviderId, h as DocsAgentTraceEventType, ht as OpenDocsProviderConfig, i as ApiReferenceConfig, it as FontStyle, j as DocsFeedbackData, jt as SidebarNode, k as DocsAskAIMcpConfig, kt as SidebarFolderIndexBehavior, l as CodeBlockCopyData, lt as LlmsTxtMaxCharsMode, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, n as AgentFeedbackConfig, nt as DocsTheme, o as BreadcrumbConfig, ot as LastUpdatedConfig, p as DocsAgentFeedbackData, pt as OpenDocsConfig, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, rt as FeedbackConfig, s as ChangelogConfig, st as LlmsTxtConfig, t as AIConfig, tt as DocsSitemapConfig, u as CopyMarkdownConfig, ut as LlmsTxtSectionConfig, v as DocsAnalyticsEvent, vt as OpenGraphImage, w as DocsAskAIActionType, wt as PageTwitter, x as DocsAnalyticsInput, xt as PageFrontmatter, y as DocsAnalyticsEventInput, yt as OrderingItem, z as DocsObservabilityEvent } from "./types-
|
|
2
|
-
import { $ as emitDocsAgentTraceEvent, A as toDocsSitemapMarkdownUrl, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as PromptAction, I as PromptProviderChoice, J as DocsAgentTraceContext, L as SerializeOpenDocsProviderOptions, O as resolveDocsSitemapPageLastmod, Q as createDocsAgentTraceId, R as SerializedOpenDocsProvider, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, X as ResolvedDocsObservabilityConfig, Y as ResolvedDocsAnalyticsConfig, Z as createDocsAgentTraceContext, _ as DocsSitemapFormat, a as createMcpSearchAdapter, at as createDocsCloudAnalytics, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAnalyticsEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, it as DocsCloudAnalyticsOptions, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, nt as resolveDocsAnalyticsConfig, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, rt as resolveDocsObservabilityConfig, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsObservabilityEvent, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage } from "./search-
|
|
1
|
+
import { $ as DocsSearchResultType, A as DocsConfig, At as SidebarFolderNode, B as DocsObservabilityEventInput, C as DocsAskAIActionData, Ct as PageSidebarFrontmatter, D as DocsAskAIFeedbackMessage, Dt as SidebarComponentProps, E as DocsAskAIFeedbackData, Et as ResolvedDocsRelatedLink, F as DocsMcpToolsConfig, Ft as ThemeToggleConfig, G as DocsSearchAdapterContext, H as DocsRobotsConfig, I as DocsMetadata, It as TypesenseDocsSearchConfig, J as DocsSearchConfig, K as DocsSearchAdapterFactory, L as DocsNav, Lt as TypographyConfig, M as DocsFeedbackValue, Mt as SidebarPageNode, N as DocsI18nConfig, Nt as SidebarTree, O as DocsAskAIFeedbackValue, Ot as SidebarConfig, P as DocsMcpConfig, Pt as SimpleDocsSearchConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, Rt as UIConfig, S as DocsAnalyticsSource, St as PageOpenGraph, T as DocsAskAIFeedbackConfig, Tt as ReadingTimeConfig, U as DocsRobotsRule, V as DocsRelatedItem, W as DocsSearchAdapter, X as DocsSearchEmbeddingsConfig, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, _t as OpenDocsTarget, a as ApiReferenceRenderer, at as GithubConfig, b as DocsAnalyticsEventType, bt as PageActionsConfig, c as ChangelogFrontmatter, ct as LlmsTxtMaxCharsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, f as DocsAgentFeedbackContext, ft as OGConfig, g as DocsAgentTraceStatus, gt as OpenDocsProviderId, h as DocsAgentTraceEventType, ht as OpenDocsProviderConfig, i as ApiReferenceConfig, it as FontStyle, j as DocsFeedbackData, jt as SidebarNode, k as DocsAskAIMcpConfig, kt as SidebarFolderIndexBehavior, l as CodeBlockCopyData, lt as LlmsTxtMaxCharsMode, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, n as AgentFeedbackConfig, nt as DocsTheme, o as BreadcrumbConfig, ot as LastUpdatedConfig, p as DocsAgentFeedbackData, pt as OpenDocsConfig, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, rt as FeedbackConfig, s as ChangelogConfig, st as LlmsTxtConfig, t as AIConfig, tt as DocsSitemapConfig, u as CopyMarkdownConfig, ut as LlmsTxtSectionConfig, v as DocsAnalyticsEvent, vt as OpenGraphImage, w as DocsAskAIActionType, wt as PageTwitter, x as DocsAnalyticsInput, xt as PageFrontmatter, y as DocsAnalyticsEventInput, yt as OrderingItem, z as DocsObservabilityEvent } from "./types-D-cNOo-t.mjs";
|
|
2
|
+
import { $ as emitDocsAgentTraceEvent, A as toDocsSitemapMarkdownUrl, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as PromptAction, I as PromptProviderChoice, J as DocsAgentTraceContext, L as SerializeOpenDocsProviderOptions, O as resolveDocsSitemapPageLastmod, Q as createDocsAgentTraceId, R as SerializedOpenDocsProvider, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, X as ResolvedDocsObservabilityConfig, Y as ResolvedDocsAnalyticsConfig, Z as createDocsAgentTraceContext, _ as DocsSitemapFormat, a as createMcpSearchAdapter, at as createDocsCloudAnalytics, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAnalyticsEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, it as DocsCloudAnalyticsOptions, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, nt as resolveDocsAnalyticsConfig, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, rt as resolveDocsObservabilityConfig, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsObservabilityEvent, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage } from "./search-Dlwp88qb.mjs";
|
|
3
3
|
import { DocsMcpPage, DocsMcpResolvedConfig } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/define-docs.d.ts
|
|
@@ -601,6 +601,8 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
601
601
|
readPage: boolean;
|
|
602
602
|
searchDocs: boolean;
|
|
603
603
|
getNavigation: boolean;
|
|
604
|
+
getCodeExamples: boolean;
|
|
605
|
+
getConfigSchema: boolean;
|
|
604
606
|
};
|
|
605
607
|
};
|
|
606
608
|
feedback: {
|
|
@@ -38,7 +38,9 @@ function readMcpConfig(content) {
|
|
|
38
38
|
listPages: readBooleanProperty(block, "listPages"),
|
|
39
39
|
readPage: readBooleanProperty(block, "readPage"),
|
|
40
40
|
searchDocs: readBooleanProperty(block, "searchDocs"),
|
|
41
|
-
getNavigation: readBooleanProperty(block, "getNavigation")
|
|
41
|
+
getNavigation: readBooleanProperty(block, "getNavigation"),
|
|
42
|
+
getCodeExamples: readBooleanProperty(block, "getCodeExamples"),
|
|
43
|
+
getConfigSchema: readBooleanProperty(block, "getConfigSchema")
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
46
|
}
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as DocsSearchConfig, P as DocsMcpConfig, R as DocsObservabilityConfig, _ as DocsAnalyticsConfig, et as DocsSearchSourcePage, yt as OrderingItem } from "./types-
|
|
1
|
+
import { J as DocsSearchConfig, P as DocsMcpConfig, R as DocsObservabilityConfig, _ as DocsAnalyticsConfig, et as DocsSearchSourcePage, yt as OrderingItem } from "./types-D-cNOo-t.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
@@ -18,6 +18,49 @@ interface DocsMcpPage {
|
|
|
18
18
|
agentFallbackContent?: string;
|
|
19
19
|
agentFallbackRawContent?: string;
|
|
20
20
|
}
|
|
21
|
+
interface DocsMcpCodeExample {
|
|
22
|
+
id: string;
|
|
23
|
+
page: {
|
|
24
|
+
slug: string;
|
|
25
|
+
url: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
sourcePath?: string;
|
|
29
|
+
lastModified?: string;
|
|
30
|
+
};
|
|
31
|
+
language?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
framework?: string;
|
|
34
|
+
packageManager?: string;
|
|
35
|
+
runnable: boolean;
|
|
36
|
+
meta: Record<string, string | boolean>;
|
|
37
|
+
code: string;
|
|
38
|
+
}
|
|
39
|
+
interface DocsMcpConfigSchemaOption {
|
|
40
|
+
path: string;
|
|
41
|
+
name: string;
|
|
42
|
+
type: string;
|
|
43
|
+
default?: string | boolean | number | null;
|
|
44
|
+
description: string;
|
|
45
|
+
docs?: string;
|
|
46
|
+
values?: string[];
|
|
47
|
+
children?: DocsMcpConfigSchemaOption[];
|
|
48
|
+
}
|
|
49
|
+
interface DocsMcpConfigSchema {
|
|
50
|
+
schemaVersion: 1;
|
|
51
|
+
configFile: "docs.config.ts";
|
|
52
|
+
description: string;
|
|
53
|
+
filters?: {
|
|
54
|
+
option?: string;
|
|
55
|
+
query?: string;
|
|
56
|
+
};
|
|
57
|
+
resultCount: number;
|
|
58
|
+
options: DocsMcpConfigSchemaOption[];
|
|
59
|
+
examples: Array<{
|
|
60
|
+
title: string;
|
|
61
|
+
code: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
21
64
|
interface DocsMcpPageNode {
|
|
22
65
|
type: "page";
|
|
23
66
|
name: string;
|
|
@@ -53,6 +96,8 @@ interface DocsMcpResolvedConfig {
|
|
|
53
96
|
readPage: boolean;
|
|
54
97
|
searchDocs: boolean;
|
|
55
98
|
getNavigation: boolean;
|
|
99
|
+
getCodeExamples: boolean;
|
|
100
|
+
getConfigSchema: boolean;
|
|
56
101
|
};
|
|
57
102
|
}
|
|
58
103
|
interface DocsMcpHttpHandlers {
|
|
@@ -93,4 +138,4 @@ declare function createDocsMcpServer(options: CreateDocsMcpServerOptions): Promi
|
|
|
93
138
|
declare function createDocsMcpHttpHandler(options: CreateDocsMcpServerOptions): DocsMcpHttpHandlers;
|
|
94
139
|
declare function runDocsMcpStdio(options: CreateDocsMcpServerOptions): Promise<void>;
|
|
95
140
|
//#endregion
|
|
96
|
-
export { DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio };
|
|
141
|
+
export { DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio };
|
package/dist/mcp.mjs
CHANGED
|
@@ -13,6 +13,404 @@ import * as z from "zod/v4";
|
|
|
13
13
|
const DEFAULT_MCP_ROUTE = "/api/docs/mcp";
|
|
14
14
|
const DEFAULT_MCP_VERSION = "0.0.0";
|
|
15
15
|
const DEFAULT_MCP_NAME = "@farming-labs/docs";
|
|
16
|
+
const DOCS_CONFIG_SCHEMA_OPTIONS = [
|
|
17
|
+
{
|
|
18
|
+
path: "entry",
|
|
19
|
+
name: "entry",
|
|
20
|
+
type: "string",
|
|
21
|
+
default: "docs",
|
|
22
|
+
description: "URL path prefix for documentation routes, for example \"docs\" creates /docs.",
|
|
23
|
+
docs: "/docs/overview"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: "contentDir",
|
|
27
|
+
name: "contentDir",
|
|
28
|
+
type: "string",
|
|
29
|
+
default: "same as entry",
|
|
30
|
+
description: "Path to markdown content files. Adapters outside Next.js usually need this when content does not live under the route prefix.",
|
|
31
|
+
docs: "/docs/overview"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: "staticExport",
|
|
35
|
+
name: "staticExport",
|
|
36
|
+
type: "boolean",
|
|
37
|
+
default: false,
|
|
38
|
+
description: "Enable full static builds. Search, AI, and runtime API routes are hidden.",
|
|
39
|
+
docs: "/docs/overview"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: "theme",
|
|
43
|
+
name: "theme",
|
|
44
|
+
type: "DocsTheme",
|
|
45
|
+
description: "Theme instance from a theme factory such as fumadocs() or pixelBorder().",
|
|
46
|
+
docs: "/docs/customization/themes"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
path: "nav",
|
|
50
|
+
name: "nav",
|
|
51
|
+
type: "{ title?: string; url?: string }",
|
|
52
|
+
description: "Sidebar and discovery metadata for the docs site. Non-Next.js adapters usually require it.",
|
|
53
|
+
children: [{
|
|
54
|
+
path: "nav.title",
|
|
55
|
+
name: "title",
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Human-readable docs site title."
|
|
58
|
+
}, {
|
|
59
|
+
path: "nav.url",
|
|
60
|
+
name: "url",
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Public base URL for generated absolute links and metadata."
|
|
63
|
+
}]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
path: "github",
|
|
67
|
+
name: "github",
|
|
68
|
+
type: "string | GithubConfig",
|
|
69
|
+
description: "GitHub repository metadata for \"Edit on GitHub\" links and page action prompt templates.",
|
|
70
|
+
docs: "/docs/customization/page-actions"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
path: "themeToggle",
|
|
74
|
+
name: "themeToggle",
|
|
75
|
+
type: "boolean | ThemeToggleConfig",
|
|
76
|
+
default: true,
|
|
77
|
+
description: "Enable or customize the light/dark mode toggle."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
path: "breadcrumb",
|
|
81
|
+
name: "breadcrumb",
|
|
82
|
+
type: "boolean | BreadcrumbConfig",
|
|
83
|
+
default: true,
|
|
84
|
+
description: "Enable or customize breadcrumb navigation."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
path: "sidebar",
|
|
88
|
+
name: "sidebar",
|
|
89
|
+
type: "boolean | SidebarConfig",
|
|
90
|
+
default: true,
|
|
91
|
+
description: "Enable or customize the docs sidebar.",
|
|
92
|
+
children: [{
|
|
93
|
+
path: "sidebar.style",
|
|
94
|
+
name: "style",
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Theme-specific sidebar style variant when supported."
|
|
97
|
+
}, {
|
|
98
|
+
path: "sidebar.defaultOpen",
|
|
99
|
+
name: "defaultOpen",
|
|
100
|
+
type: "boolean",
|
|
101
|
+
description: "Whether collapsible sidebar groups start open by default."
|
|
102
|
+
}]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
path: "icons",
|
|
106
|
+
name: "icons",
|
|
107
|
+
type: "Record<string, Component>",
|
|
108
|
+
description: "Shared icon registry for frontmatter icon fields and built-in MDX components."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
path: "components",
|
|
112
|
+
name: "components",
|
|
113
|
+
type: "Record<string, Component>",
|
|
114
|
+
description: "Custom MDX component registry and built-in component overrides."
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
path: "onCopyClick",
|
|
118
|
+
name: "onCopyClick",
|
|
119
|
+
type: "(data: CodeBlockCopyData) => void",
|
|
120
|
+
description: "Callback fired when a visitor copies a code block, including title, content, url, and language."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
path: "feedback",
|
|
124
|
+
name: "feedback",
|
|
125
|
+
type: "boolean | FeedbackConfig",
|
|
126
|
+
default: false,
|
|
127
|
+
description: "Human page feedback UI. Agent feedback endpoints remain default-on unless opted out.",
|
|
128
|
+
docs: "/docs/customization/feedback"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
path: "readingTime",
|
|
132
|
+
name: "readingTime",
|
|
133
|
+
type: "boolean | ReadingTimeConfig",
|
|
134
|
+
default: false,
|
|
135
|
+
description: "Opt-in estimated reading time label with per-page overrides."
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
path: "agent",
|
|
139
|
+
name: "agent",
|
|
140
|
+
type: "DocsAgentConfig",
|
|
141
|
+
description: "Defaults for docs agent compact and generated agent-facing files.",
|
|
142
|
+
docs: "/docs/getting-started/agent-ready-docs"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
path: "pageActions",
|
|
146
|
+
name: "pageActions",
|
|
147
|
+
type: "PageActionsConfig",
|
|
148
|
+
description: "Copy Markdown and Open in LLM actions for docs pages.",
|
|
149
|
+
docs: "/docs/customization/page-actions",
|
|
150
|
+
children: [{
|
|
151
|
+
path: "pageActions.copyMarkdown",
|
|
152
|
+
name: "copyMarkdown",
|
|
153
|
+
type: "boolean | PageActionConfig",
|
|
154
|
+
description: "Show a Copy Markdown action for the current page."
|
|
155
|
+
}, {
|
|
156
|
+
path: "pageActions.openDocs",
|
|
157
|
+
name: "openDocs",
|
|
158
|
+
type: "boolean | OpenDocsActionConfig",
|
|
159
|
+
description: "Show provider actions that open the current docs page in an LLM.",
|
|
160
|
+
children: [
|
|
161
|
+
{
|
|
162
|
+
path: "pageActions.openDocs.target",
|
|
163
|
+
name: "target",
|
|
164
|
+
type: "\"page\" | \"markdown\"",
|
|
165
|
+
default: "page",
|
|
166
|
+
description: "Whether provider URLs receive the rendered page URL or the .md markdown route."
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
path: "pageActions.openDocs.providers",
|
|
170
|
+
name: "providers",
|
|
171
|
+
type: "Array<string | PromptProviderConfig>",
|
|
172
|
+
description: "Provider IDs or provider objects. Built-ins include chatgpt, claude, cursor, and t3."
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
path: "pageActions.openDocs.prompt",
|
|
176
|
+
name: "prompt",
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Prompt text prepended to the provider URL when opening docs."
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
path: "ai",
|
|
185
|
+
name: "ai",
|
|
186
|
+
type: "AIConfig",
|
|
187
|
+
description: "RAG-powered Ask AI configuration.",
|
|
188
|
+
docs: "/docs/customization/ask-ai",
|
|
189
|
+
children: [
|
|
190
|
+
{
|
|
191
|
+
path: "ai.enabled",
|
|
192
|
+
name: "enabled",
|
|
193
|
+
type: "boolean",
|
|
194
|
+
description: "Enable or disable Ask AI."
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
path: "ai.model",
|
|
198
|
+
name: "model",
|
|
199
|
+
type: "string | AIModelConfig",
|
|
200
|
+
description: "Model ID or model routing config."
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
path: "ai.providers",
|
|
204
|
+
name: "providers",
|
|
205
|
+
type: "Record<string, AIProviderConfig>",
|
|
206
|
+
description: "Provider base URLs and optional API keys."
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
path: "ai.systemPrompt",
|
|
210
|
+
name: "systemPrompt",
|
|
211
|
+
type: "string",
|
|
212
|
+
description: "Additional instruction text for generated answers."
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
path: "ai.useMcp",
|
|
216
|
+
name: "useMcp",
|
|
217
|
+
type: "boolean | DocsAskAIMcpConfig",
|
|
218
|
+
description: "Use the built-in MCP search tool as Ask AI's retrieval provider."
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
path: "search",
|
|
224
|
+
name: "search",
|
|
225
|
+
type: "boolean | DocsSearchConfig",
|
|
226
|
+
default: true,
|
|
227
|
+
description: "Built-in simple search, Typesense, Algolia, MCP, or a custom adapter.",
|
|
228
|
+
docs: "/docs/customization/search",
|
|
229
|
+
children: [{
|
|
230
|
+
path: "search.provider",
|
|
231
|
+
name: "provider",
|
|
232
|
+
type: "\"simple\" | \"typesense\" | \"algolia\" | \"mcp\" | \"custom\"",
|
|
233
|
+
default: "simple",
|
|
234
|
+
description: "Search backend used by the docs UI and MCP search tool."
|
|
235
|
+
}, {
|
|
236
|
+
path: "search.maxResults",
|
|
237
|
+
name: "maxResults",
|
|
238
|
+
type: "number",
|
|
239
|
+
description: "Maximum result count returned by search requests."
|
|
240
|
+
}]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
path: "llmsTxt",
|
|
244
|
+
name: "llmsTxt",
|
|
245
|
+
type: "boolean | LlmsTxtConfig",
|
|
246
|
+
default: true,
|
|
247
|
+
description: "Generated /llms.txt, /llms-full.txt, optional section files, and basePath-aware aliases.",
|
|
248
|
+
docs: "/docs/getting-started/agent-ready-docs"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
path: "changelog",
|
|
252
|
+
name: "changelog",
|
|
253
|
+
type: "boolean | ChangelogConfig",
|
|
254
|
+
default: false,
|
|
255
|
+
description: "Generate changelog feed and entry pages from dated MDX entries.",
|
|
256
|
+
docs: "/docs/customization/changelog"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
path: "mcp",
|
|
260
|
+
name: "mcp",
|
|
261
|
+
type: "boolean | DocsMcpConfig",
|
|
262
|
+
default: true,
|
|
263
|
+
description: "Built-in MCP server over stdio plus HTTP routes at /mcp and /.well-known/mcp, backed by /api/docs/mcp.",
|
|
264
|
+
docs: "/docs/customization/mcp",
|
|
265
|
+
children: [
|
|
266
|
+
{
|
|
267
|
+
path: "mcp.enabled",
|
|
268
|
+
name: "enabled",
|
|
269
|
+
type: "boolean",
|
|
270
|
+
default: true,
|
|
271
|
+
description: "Enable the built-in MCP server."
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
path: "mcp.route",
|
|
275
|
+
name: "route",
|
|
276
|
+
type: "string",
|
|
277
|
+
default: "/api/docs/mcp",
|
|
278
|
+
description: "Canonical Streamable HTTP route used by the MCP endpoint."
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
path: "mcp.name",
|
|
282
|
+
name: "name",
|
|
283
|
+
type: "string",
|
|
284
|
+
default: "nav.title or @farming-labs/docs",
|
|
285
|
+
description: "Human-readable MCP server name reported to clients."
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
path: "mcp.version",
|
|
289
|
+
name: "version",
|
|
290
|
+
type: "string",
|
|
291
|
+
default: "0.0.0",
|
|
292
|
+
description: "Version string reported to MCP clients."
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
path: "mcp.tools",
|
|
296
|
+
name: "tools",
|
|
297
|
+
type: "DocsMcpToolsConfig",
|
|
298
|
+
default: "all enabled",
|
|
299
|
+
description: "Fine-grained built-in MCP tool toggles.",
|
|
300
|
+
children: [
|
|
301
|
+
{
|
|
302
|
+
path: "mcp.tools.listPages",
|
|
303
|
+
name: "listPages",
|
|
304
|
+
type: "boolean",
|
|
305
|
+
default: true,
|
|
306
|
+
description: "Expose the list_pages tool."
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
path: "mcp.tools.getNavigation",
|
|
310
|
+
name: "getNavigation",
|
|
311
|
+
type: "boolean",
|
|
312
|
+
default: true,
|
|
313
|
+
description: "Expose the get_navigation tool."
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
path: "mcp.tools.searchDocs",
|
|
317
|
+
name: "searchDocs",
|
|
318
|
+
type: "boolean",
|
|
319
|
+
default: true,
|
|
320
|
+
description: "Expose the search_docs tool."
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
path: "mcp.tools.readPage",
|
|
324
|
+
name: "readPage",
|
|
325
|
+
type: "boolean",
|
|
326
|
+
default: true,
|
|
327
|
+
description: "Expose the read_page tool."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
path: "mcp.tools.getCodeExamples",
|
|
331
|
+
name: "getCodeExamples",
|
|
332
|
+
type: "boolean",
|
|
333
|
+
default: true,
|
|
334
|
+
description: "Expose the get_code_examples tool."
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
path: "mcp.tools.getConfigSchema",
|
|
338
|
+
name: "getConfigSchema",
|
|
339
|
+
type: "boolean",
|
|
340
|
+
default: true,
|
|
341
|
+
description: "Expose the get_config_schema tool."
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
path: "apiReference",
|
|
349
|
+
name: "apiReference",
|
|
350
|
+
type: "boolean | ApiReferenceConfig",
|
|
351
|
+
default: false,
|
|
352
|
+
description: "Generated API reference pages from framework route conventions or a hosted OpenAPI document.",
|
|
353
|
+
docs: "/docs/customization/api-reference",
|
|
354
|
+
children: [{
|
|
355
|
+
path: "apiReference.specUrl",
|
|
356
|
+
name: "specUrl",
|
|
357
|
+
type: "string",
|
|
358
|
+
description: "Remote OpenAPI JSON URL when the backend owns the schema."
|
|
359
|
+
}, {
|
|
360
|
+
path: "apiReference.path",
|
|
361
|
+
name: "path",
|
|
362
|
+
type: "string",
|
|
363
|
+
description: "Docs route where the API reference is rendered."
|
|
364
|
+
}]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
path: "sitemap",
|
|
368
|
+
name: "sitemap",
|
|
369
|
+
type: "boolean | DocsSitemapConfig",
|
|
370
|
+
default: true,
|
|
371
|
+
description: "Generated sitemap.xml, sitemap.md, and /.well-known/sitemap.md."
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
path: "robots",
|
|
375
|
+
name: "robots",
|
|
376
|
+
type: "boolean | DocsRobotsConfig",
|
|
377
|
+
default: true,
|
|
378
|
+
description: "Runtime or generated robots.txt policy for docs routes, agent-readable files, and AI crawler user agents."
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
path: "metadata",
|
|
382
|
+
name: "metadata",
|
|
383
|
+
type: "DocsMetadata",
|
|
384
|
+
description: "SEO and JSON-LD inputs such as titleTemplate and description."
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
path: "og",
|
|
388
|
+
name: "og",
|
|
389
|
+
type: "OGConfig",
|
|
390
|
+
description: "Dynamic Open Graph image configuration."
|
|
391
|
+
}
|
|
392
|
+
];
|
|
393
|
+
const DOCS_CONFIG_SCHEMA_EXAMPLES = [{
|
|
394
|
+
title: "Minimal config",
|
|
395
|
+
code: `import { defineDocs } from "@farming-labs/docs";
|
|
396
|
+
import { fumadocs } from "@farming-labs/theme";
|
|
397
|
+
|
|
398
|
+
export default defineDocs({
|
|
399
|
+
entry: "docs",
|
|
400
|
+
theme: fumadocs(),
|
|
401
|
+
});`
|
|
402
|
+
}, {
|
|
403
|
+
title: "MCP tool toggles",
|
|
404
|
+
code: `export default defineDocs({
|
|
405
|
+
entry: "docs",
|
|
406
|
+
mcp: {
|
|
407
|
+
tools: {
|
|
408
|
+
getConfigSchema: true,
|
|
409
|
+
getCodeExamples: true,
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
});`
|
|
413
|
+
}];
|
|
16
414
|
const searchDocsInputSchema = z.object({
|
|
17
415
|
query: z.string().trim().min(1),
|
|
18
416
|
limit: z.number().int().min(1).max(25).optional(),
|
|
@@ -24,6 +422,20 @@ const readPageInputSchema = z.object({
|
|
|
24
422
|
});
|
|
25
423
|
const listPagesInputSchema = z.object({ locale: z.string().min(1).optional() });
|
|
26
424
|
const getNavigationInputSchema = z.object({ locale: z.string().min(1).optional() });
|
|
425
|
+
const getConfigSchemaInputSchema = z.object({
|
|
426
|
+
option: z.string().trim().min(1).optional(),
|
|
427
|
+
query: z.string().trim().min(1).optional()
|
|
428
|
+
});
|
|
429
|
+
const getCodeExamplesInputSchema = z.object({
|
|
430
|
+
query: z.string().trim().min(1).optional(),
|
|
431
|
+
path: z.string().min(1).optional(),
|
|
432
|
+
framework: z.string().trim().min(1).optional(),
|
|
433
|
+
packageManager: z.string().trim().min(1).optional(),
|
|
434
|
+
language: z.string().trim().min(1).optional(),
|
|
435
|
+
runnable: z.boolean().optional(),
|
|
436
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
437
|
+
locale: z.string().min(1).optional()
|
|
438
|
+
});
|
|
27
439
|
function normalizeDocsMcpRoute(route) {
|
|
28
440
|
if (!route || route.trim().length === 0) return DEFAULT_MCP_ROUTE;
|
|
29
441
|
const normalized = `/${route}`.replace(/\/+/g, "/");
|
|
@@ -39,7 +451,9 @@ function resolveDocsMcpConfig(mcp, defaults = {}) {
|
|
|
39
451
|
listPages: true,
|
|
40
452
|
readPage: true,
|
|
41
453
|
searchDocs: true,
|
|
42
|
-
getNavigation: true
|
|
454
|
+
getNavigation: true,
|
|
455
|
+
getCodeExamples: true,
|
|
456
|
+
getConfigSchema: true
|
|
43
457
|
}
|
|
44
458
|
};
|
|
45
459
|
const config = mcp && typeof mcp === "object" ? mcp : {};
|
|
@@ -52,7 +466,9 @@ function resolveDocsMcpConfig(mcp, defaults = {}) {
|
|
|
52
466
|
listPages: config.tools?.listPages ?? true,
|
|
53
467
|
readPage: config.tools?.readPage ?? true,
|
|
54
468
|
searchDocs: config.tools?.searchDocs ?? true,
|
|
55
|
-
getNavigation: config.tools?.getNavigation ?? true
|
|
469
|
+
getNavigation: config.tools?.getNavigation ?? true,
|
|
470
|
+
getCodeExamples: config.tools?.getCodeExamples ?? true,
|
|
471
|
+
getConfigSchema: config.tools?.getConfigSchema ?? true
|
|
56
472
|
}
|
|
57
473
|
};
|
|
58
474
|
}
|
|
@@ -264,6 +680,82 @@ async function createDocsMcpServer(options) {
|
|
|
264
680
|
throw error;
|
|
265
681
|
}
|
|
266
682
|
});
|
|
683
|
+
if (resolved.tools.getConfigSchema) server.registerTool("get_config_schema", {
|
|
684
|
+
title: "Get docs config schema",
|
|
685
|
+
description: "Return structured docs.config.ts option metadata, optionally filtered by option path or query.",
|
|
686
|
+
inputSchema: getConfigSchemaInputSchema,
|
|
687
|
+
annotations: { readOnlyHint: true }
|
|
688
|
+
}, async ({ option, query }) => {
|
|
689
|
+
const startedAt = nowMs();
|
|
690
|
+
const trace = createDocsAgentTraceContext("mcp.tool.get_config_schema");
|
|
691
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
692
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
693
|
+
type: "tool.call",
|
|
694
|
+
source: "mcp",
|
|
695
|
+
traceId: trace.traceId,
|
|
696
|
+
spanId: callSpanId,
|
|
697
|
+
name: "get_config_schema",
|
|
698
|
+
startedAt: trace.startedAt,
|
|
699
|
+
status: "started",
|
|
700
|
+
inputPreview: {
|
|
701
|
+
option,
|
|
702
|
+
queryLength: query?.length
|
|
703
|
+
},
|
|
704
|
+
metadata: { tool: "get_config_schema" }
|
|
705
|
+
});
|
|
706
|
+
try {
|
|
707
|
+
const schema = getDocsConfigSchema({
|
|
708
|
+
option,
|
|
709
|
+
query
|
|
710
|
+
});
|
|
711
|
+
const elapsed = durationMs(startedAt);
|
|
712
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
713
|
+
type: "mcp_tool",
|
|
714
|
+
source: "mcp",
|
|
715
|
+
input: query ? { query } : void 0,
|
|
716
|
+
properties: {
|
|
717
|
+
tool: "get_config_schema",
|
|
718
|
+
option,
|
|
719
|
+
queryLength: query?.length,
|
|
720
|
+
resultCount: schema.resultCount,
|
|
721
|
+
durationMs: elapsed
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
725
|
+
type: "tool.result",
|
|
726
|
+
source: "mcp",
|
|
727
|
+
traceId: trace.traceId,
|
|
728
|
+
parentSpanId: callSpanId,
|
|
729
|
+
name: "get_config_schema",
|
|
730
|
+
startedAt: trace.startedAt,
|
|
731
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
732
|
+
durationMs: elapsed,
|
|
733
|
+
status: "success",
|
|
734
|
+
outputPreview: { resultCount: schema.resultCount },
|
|
735
|
+
metadata: { tool: "get_config_schema" }
|
|
736
|
+
});
|
|
737
|
+
return { content: [{
|
|
738
|
+
type: "text",
|
|
739
|
+
text: JSON.stringify(schema, null, 2)
|
|
740
|
+
}] };
|
|
741
|
+
} catch (error) {
|
|
742
|
+
const elapsed = durationMs(startedAt);
|
|
743
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
744
|
+
type: "tool.error",
|
|
745
|
+
source: "mcp",
|
|
746
|
+
traceId: trace.traceId,
|
|
747
|
+
parentSpanId: callSpanId,
|
|
748
|
+
name: "get_config_schema",
|
|
749
|
+
startedAt: trace.startedAt,
|
|
750
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
751
|
+
durationMs: elapsed,
|
|
752
|
+
status: "error",
|
|
753
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
754
|
+
metadata: { tool: "get_config_schema" }
|
|
755
|
+
});
|
|
756
|
+
throw error;
|
|
757
|
+
}
|
|
758
|
+
});
|
|
267
759
|
if (resolved.tools.searchDocs) server.registerTool("search_docs", {
|
|
268
760
|
title: "Search documentation",
|
|
269
761
|
description: "Search the docs by keyword across titles, descriptions, and page content.",
|
|
@@ -350,6 +842,103 @@ async function createDocsMcpServer(options) {
|
|
|
350
842
|
throw error;
|
|
351
843
|
}
|
|
352
844
|
});
|
|
845
|
+
if (resolved.tools.getCodeExamples) server.registerTool("get_code_examples", {
|
|
846
|
+
title: "Get docs code examples",
|
|
847
|
+
description: "Return fenced code examples from the docs with parsed metadata such as title, framework, packageManager, and runnable.",
|
|
848
|
+
inputSchema: getCodeExamplesInputSchema,
|
|
849
|
+
annotations: { readOnlyHint: true }
|
|
850
|
+
}, async ({ query, path: requestedPath, framework, packageManager, language, runnable, limit, locale }) => {
|
|
851
|
+
const startedAt = nowMs();
|
|
852
|
+
const resolvedLimit = limit ?? 25;
|
|
853
|
+
const trace = createDocsAgentTraceContext("mcp.tool.get_code_examples");
|
|
854
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
855
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
856
|
+
type: "tool.call",
|
|
857
|
+
source: "mcp",
|
|
858
|
+
traceId: trace.traceId,
|
|
859
|
+
spanId: callSpanId,
|
|
860
|
+
name: "get_code_examples",
|
|
861
|
+
startedAt: trace.startedAt,
|
|
862
|
+
status: "started",
|
|
863
|
+
locale,
|
|
864
|
+
inputPreview: {
|
|
865
|
+
queryLength: query?.length,
|
|
866
|
+
path: requestedPath,
|
|
867
|
+
framework,
|
|
868
|
+
packageManager,
|
|
869
|
+
language,
|
|
870
|
+
runnable,
|
|
871
|
+
limit: resolvedLimit
|
|
872
|
+
},
|
|
873
|
+
metadata: { tool: "get_code_examples" }
|
|
874
|
+
});
|
|
875
|
+
try {
|
|
876
|
+
const pages = dedupePages(await options.source.getPages(locale));
|
|
877
|
+
const matchedPage = requestedPath ? findDocsPage(pages, requestedPath, options.source.entry) : null;
|
|
878
|
+
const examples = filterDocsCodeExamples((requestedPath ? matchedPage ? [matchedPage] : [] : pages).flatMap((page) => extractDocsMcpCodeExamples(page)), {
|
|
879
|
+
query,
|
|
880
|
+
framework,
|
|
881
|
+
packageManager,
|
|
882
|
+
language,
|
|
883
|
+
runnable,
|
|
884
|
+
limit: resolvedLimit
|
|
885
|
+
});
|
|
886
|
+
const elapsed = durationMs(startedAt);
|
|
887
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
888
|
+
type: "mcp_tool",
|
|
889
|
+
source: "mcp",
|
|
890
|
+
locale,
|
|
891
|
+
input: query ? { query } : void 0,
|
|
892
|
+
properties: {
|
|
893
|
+
tool: "get_code_examples",
|
|
894
|
+
queryLength: query?.length,
|
|
895
|
+
path: requestedPath,
|
|
896
|
+
framework,
|
|
897
|
+
packageManager,
|
|
898
|
+
language,
|
|
899
|
+
runnable,
|
|
900
|
+
limit: resolvedLimit,
|
|
901
|
+
resultCount: examples.length,
|
|
902
|
+
durationMs: elapsed
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
906
|
+
type: "tool.result",
|
|
907
|
+
source: "mcp",
|
|
908
|
+
traceId: trace.traceId,
|
|
909
|
+
parentSpanId: callSpanId,
|
|
910
|
+
name: "get_code_examples",
|
|
911
|
+
startedAt: trace.startedAt,
|
|
912
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
913
|
+
durationMs: elapsed,
|
|
914
|
+
status: "success",
|
|
915
|
+
locale,
|
|
916
|
+
outputPreview: { resultCount: examples.length },
|
|
917
|
+
metadata: { tool: "get_code_examples" }
|
|
918
|
+
});
|
|
919
|
+
return { content: [{
|
|
920
|
+
type: "text",
|
|
921
|
+
text: JSON.stringify({ examples }, null, 2)
|
|
922
|
+
}] };
|
|
923
|
+
} catch (error) {
|
|
924
|
+
const elapsed = durationMs(startedAt);
|
|
925
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
926
|
+
type: "tool.error",
|
|
927
|
+
source: "mcp",
|
|
928
|
+
traceId: trace.traceId,
|
|
929
|
+
parentSpanId: callSpanId,
|
|
930
|
+
name: "get_code_examples",
|
|
931
|
+
startedAt: trace.startedAt,
|
|
932
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
933
|
+
durationMs: elapsed,
|
|
934
|
+
status: "error",
|
|
935
|
+
locale,
|
|
936
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
937
|
+
metadata: { tool: "get_code_examples" }
|
|
938
|
+
});
|
|
939
|
+
throw error;
|
|
940
|
+
}
|
|
941
|
+
});
|
|
353
942
|
if (resolved.tools.readPage) server.registerTool("read_page", {
|
|
354
943
|
title: "Read a docs page",
|
|
355
944
|
description: "Read a documentation page by slug or URL path.",
|
|
@@ -880,6 +1469,71 @@ function toSearchSourcePages(pages) {
|
|
|
880
1469
|
related: page.related
|
|
881
1470
|
}));
|
|
882
1471
|
}
|
|
1472
|
+
function getDocsConfigSchema(filters) {
|
|
1473
|
+
const option = filters.option?.trim();
|
|
1474
|
+
const query = filters.query?.trim();
|
|
1475
|
+
let options = DOCS_CONFIG_SCHEMA_OPTIONS.map(cloneConfigSchemaOption);
|
|
1476
|
+
if (option) options = selectConfigSchemaOptions(option);
|
|
1477
|
+
if (query) options = filterConfigSchemaOptionsByQuery(options, query);
|
|
1478
|
+
return {
|
|
1479
|
+
schemaVersion: 1,
|
|
1480
|
+
configFile: "docs.config.ts",
|
|
1481
|
+
description: "Configuration schema for @farming-labs/docs defineDocs(). Use option for an exact top-level or nested path, or query for keyword filtering.",
|
|
1482
|
+
filters: option || query ? {
|
|
1483
|
+
...option ? { option } : {},
|
|
1484
|
+
...query ? { query } : {}
|
|
1485
|
+
} : void 0,
|
|
1486
|
+
resultCount: countConfigSchemaOptions(options),
|
|
1487
|
+
options,
|
|
1488
|
+
examples: DOCS_CONFIG_SCHEMA_EXAMPLES
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
function cloneConfigSchemaOption(option) {
|
|
1492
|
+
return {
|
|
1493
|
+
...option,
|
|
1494
|
+
children: option.children?.map(cloneConfigSchemaOption)
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
function selectConfigSchemaOptions(optionPath) {
|
|
1498
|
+
const needle = normalizeConfigSchemaToken(optionPath);
|
|
1499
|
+
return flattenConfigSchemaOptions(DOCS_CONFIG_SCHEMA_OPTIONS).filter((option) => {
|
|
1500
|
+
return normalizeConfigSchemaToken(option.path) === needle;
|
|
1501
|
+
}).map(cloneConfigSchemaOption);
|
|
1502
|
+
}
|
|
1503
|
+
function filterConfigSchemaOptionsByQuery(options, query) {
|
|
1504
|
+
return options.flatMap((option) => {
|
|
1505
|
+
if (configSchemaOptionMatchesQuery(option, query)) return [cloneConfigSchemaOption(option)];
|
|
1506
|
+
const children = option.children ? filterConfigSchemaOptionsByQuery(option.children, query) : [];
|
|
1507
|
+
if (children.length === 0) return [];
|
|
1508
|
+
return [{
|
|
1509
|
+
...cloneConfigSchemaOption(option),
|
|
1510
|
+
children
|
|
1511
|
+
}];
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
function configSchemaOptionMatchesQuery(option, query) {
|
|
1515
|
+
const searchText = [
|
|
1516
|
+
option.path,
|
|
1517
|
+
option.name,
|
|
1518
|
+
option.type,
|
|
1519
|
+
option.default,
|
|
1520
|
+
option.description,
|
|
1521
|
+
option.docs,
|
|
1522
|
+
option.values?.join(" ")
|
|
1523
|
+
].filter((value) => value !== void 0 && value !== null).join(" ");
|
|
1524
|
+
const lowerSearchText = searchText.toLowerCase();
|
|
1525
|
+
const lowerQuery = query.toLowerCase();
|
|
1526
|
+
return lowerSearchText.includes(lowerQuery) || normalizeConfigSchemaToken(searchText).includes(normalizeConfigSchemaToken(query));
|
|
1527
|
+
}
|
|
1528
|
+
function flattenConfigSchemaOptions(options) {
|
|
1529
|
+
return options.flatMap((option) => [option, ...option.children ? flattenConfigSchemaOptions(option.children) : []]);
|
|
1530
|
+
}
|
|
1531
|
+
function countConfigSchemaOptions(options) {
|
|
1532
|
+
return flattenConfigSchemaOptions(options).length;
|
|
1533
|
+
}
|
|
1534
|
+
function normalizeConfigSchemaToken(value) {
|
|
1535
|
+
return value.trim().toLowerCase().replace(/^docs\.config\.?/, "").replace(/[`'"]/g, "").replace(/[_\-\s]+/g, "");
|
|
1536
|
+
}
|
|
883
1537
|
function isSelfMcpSearchEndpoint(search, route) {
|
|
884
1538
|
if (!search || search === true || typeof search !== "object" || search.provider !== "mcp") return false;
|
|
885
1539
|
const endpoint = search.endpoint.trim();
|
|
@@ -905,6 +1559,123 @@ function toPageSummaries(pages) {
|
|
|
905
1559
|
icon: page.icon
|
|
906
1560
|
}));
|
|
907
1561
|
}
|
|
1562
|
+
function extractDocsMcpCodeExamples(page) {
|
|
1563
|
+
const source = page.agentRawContent ?? page.agentFallbackRawContent ?? page.rawContent;
|
|
1564
|
+
if (!source) return [];
|
|
1565
|
+
const examples = [];
|
|
1566
|
+
const lines = source.split("\n");
|
|
1567
|
+
let index = 0;
|
|
1568
|
+
let openFence = null;
|
|
1569
|
+
for (const line of lines) {
|
|
1570
|
+
const trimmed = line.trim();
|
|
1571
|
+
if (!openFence) {
|
|
1572
|
+
const openMatch = trimmed.match(/^(`{3,}|~{3,})(.*)$/);
|
|
1573
|
+
if (!openMatch) continue;
|
|
1574
|
+
openFence = {
|
|
1575
|
+
marker: openMatch[1],
|
|
1576
|
+
info: openMatch[2]?.trim() ?? "",
|
|
1577
|
+
code: []
|
|
1578
|
+
};
|
|
1579
|
+
continue;
|
|
1580
|
+
}
|
|
1581
|
+
if (isClosingFence(trimmed, openFence.marker)) {
|
|
1582
|
+
const parsed = parseCodeFenceInfo(openFence.info);
|
|
1583
|
+
const meta = parsed.meta;
|
|
1584
|
+
const title = readStringMeta(meta, "title");
|
|
1585
|
+
const framework = readStringMeta(meta, "framework");
|
|
1586
|
+
const packageManager = readStringMeta(meta, "packageManager");
|
|
1587
|
+
const runnable = readBooleanMeta(meta, "runnable") ?? false;
|
|
1588
|
+
index += 1;
|
|
1589
|
+
examples.push({
|
|
1590
|
+
id: `${page.url}#code-${index}`,
|
|
1591
|
+
page: {
|
|
1592
|
+
slug: page.slug,
|
|
1593
|
+
url: page.url,
|
|
1594
|
+
title: page.title,
|
|
1595
|
+
description: page.description,
|
|
1596
|
+
sourcePath: page.sourcePath,
|
|
1597
|
+
lastModified: page.lastModified
|
|
1598
|
+
},
|
|
1599
|
+
language: parsed.language,
|
|
1600
|
+
title,
|
|
1601
|
+
framework,
|
|
1602
|
+
packageManager,
|
|
1603
|
+
runnable,
|
|
1604
|
+
meta,
|
|
1605
|
+
code: openFence.code.join("\n")
|
|
1606
|
+
});
|
|
1607
|
+
openFence = null;
|
|
1608
|
+
continue;
|
|
1609
|
+
}
|
|
1610
|
+
openFence.code.push(line);
|
|
1611
|
+
}
|
|
1612
|
+
return examples;
|
|
1613
|
+
}
|
|
1614
|
+
function filterDocsCodeExamples(examples, filters) {
|
|
1615
|
+
const query = filters.query?.toLowerCase();
|
|
1616
|
+
const framework = filters.framework?.toLowerCase();
|
|
1617
|
+
const packageManager = filters.packageManager?.toLowerCase();
|
|
1618
|
+
const language = filters.language?.toLowerCase();
|
|
1619
|
+
return examples.filter((example) => {
|
|
1620
|
+
if (framework && example.framework?.toLowerCase() !== framework) return false;
|
|
1621
|
+
if (packageManager && example.packageManager?.toLowerCase() !== packageManager) return false;
|
|
1622
|
+
if (language && example.language?.toLowerCase() !== language) return false;
|
|
1623
|
+
if (filters.runnable !== void 0 && example.runnable !== filters.runnable) return false;
|
|
1624
|
+
if (!query) return true;
|
|
1625
|
+
return getCodeExampleSearchText(example).toLowerCase().includes(query);
|
|
1626
|
+
}).slice(0, filters.limit);
|
|
1627
|
+
}
|
|
1628
|
+
function isClosingFence(trimmedLine, marker) {
|
|
1629
|
+
if (!trimmedLine.startsWith(marker)) return false;
|
|
1630
|
+
return trimmedLine.slice(marker.length).trim().length === 0;
|
|
1631
|
+
}
|
|
1632
|
+
function parseCodeFenceInfo(info) {
|
|
1633
|
+
const trimmed = info.trim();
|
|
1634
|
+
if (!trimmed) return { meta: {} };
|
|
1635
|
+
const firstToken = trimmed.match(/^(\S+)/)?.[1] ?? "";
|
|
1636
|
+
const language = firstToken && !firstToken.includes("=") ? firstToken : void 0;
|
|
1637
|
+
const attributeSource = language ? trimmed.slice(firstToken.length).trim() : trimmed;
|
|
1638
|
+
const meta = {};
|
|
1639
|
+
const attributePattern = /([A-Za-z_:][\w:.-]*)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"']+)))?/g;
|
|
1640
|
+
let match;
|
|
1641
|
+
while (match = attributePattern.exec(attributeSource)) {
|
|
1642
|
+
const key = match[1];
|
|
1643
|
+
meta[key] = match[2] ?? match[3] ?? match[4] ?? true;
|
|
1644
|
+
}
|
|
1645
|
+
return {
|
|
1646
|
+
language,
|
|
1647
|
+
meta
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
function readStringMeta(meta, key) {
|
|
1651
|
+
const value = meta[key];
|
|
1652
|
+
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
1653
|
+
}
|
|
1654
|
+
function readBooleanMeta(meta, key) {
|
|
1655
|
+
const value = meta[key];
|
|
1656
|
+
if (typeof value === "boolean") return value;
|
|
1657
|
+
if (typeof value !== "string") return void 0;
|
|
1658
|
+
const normalized = value.trim().toLowerCase();
|
|
1659
|
+
if (!normalized || normalized === "true" || normalized === "1" || normalized === "yes") return true;
|
|
1660
|
+
if (normalized === "false" || normalized === "0" || normalized === "no") return false;
|
|
1661
|
+
return true;
|
|
1662
|
+
}
|
|
1663
|
+
function getCodeExampleSearchText(example) {
|
|
1664
|
+
return [
|
|
1665
|
+
example.id,
|
|
1666
|
+
example.page.slug,
|
|
1667
|
+
example.page.url,
|
|
1668
|
+
example.page.title,
|
|
1669
|
+
example.page.description,
|
|
1670
|
+
example.page.sourcePath,
|
|
1671
|
+
example.language,
|
|
1672
|
+
example.title,
|
|
1673
|
+
example.framework,
|
|
1674
|
+
example.packageManager,
|
|
1675
|
+
...Object.entries(example.meta).map(([key, value]) => `${key} ${String(value)}`),
|
|
1676
|
+
example.code
|
|
1677
|
+
].filter((value) => typeof value === "string").join("\n");
|
|
1678
|
+
}
|
|
908
1679
|
function findDocsPage(pages, requestedPath, entry) {
|
|
909
1680
|
const normalizedRequest = normalizeRequestedPath(requestedPath, entry);
|
|
910
1681
|
for (const page of pages) if (normalizeUrlPath(page.url) === normalizedRequest) return page;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as DocsObservabilityEventInput, Et as ResolvedDocsRelatedLink, It as TypesenseDocsSearchConfig, J as DocsSearchConfig, K as DocsSearchAdapterFactory, Q as DocsSearchResult, R as DocsObservabilityConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, _ as DocsAnalyticsConfig, _t as OpenDocsTarget, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-
|
|
1
|
+
import { B as DocsObservabilityEventInput, Et as ResolvedDocsRelatedLink, It as TypesenseDocsSearchConfig, J as DocsSearchConfig, K as DocsSearchAdapterFactory, Q as DocsSearchResult, R as DocsObservabilityConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, _ as DocsAnalyticsConfig, _t as OpenDocsTarget, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-D-cNOo-t.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cloud-analytics.d.ts
|
|
4
4
|
interface DocsCloudAnalyticsOptions {
|
package/dist/server.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as DocsConfig, B as DocsObservabilityEventInput, D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, G as DocsSearchAdapterContext, J as DocsSearchConfig, K as DocsSearchAdapterFactory, O as DocsAskAIFeedbackValue, Q as DocsSearchResult, R as DocsObservabilityConfig, T as DocsAskAIFeedbackConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-
|
|
2
|
-
import { $ as emitDocsAgentTraceEvent, A as toDocsSitemapMarkdownUrl, B as parsePromptStringArray, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as PromptAction, G as serializeOpenDocsProvider, H as sanitizePromptText, I as PromptProviderChoice, J as DocsAgentTraceContext, K as serializeOpenDocsProviders, L as SerializeOpenDocsProviderOptions, M as DEFAULT_OPEN_DOCS_PROVIDER_IDS, N as DEFAULT_OPEN_DOCS_TARGET, O as resolveDocsSitemapPageLastmod, P as DEFAULT_PROMPT_PROVIDER_TEMPLATES, Q as createDocsAgentTraceId, R as SerializedOpenDocsProvider, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as serializeDocsIcon, V as resolvePromptProviderChoices, W as serializeDocsIconRegistry, X as ResolvedDocsObservabilityConfig, Y as ResolvedDocsAnalyticsConfig, Z as createDocsAgentTraceContext, _ as DocsSitemapFormat, a as createMcpSearchAdapter, at as createDocsCloudAnalytics, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAnalyticsEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, it as DocsCloudAnalyticsOptions, j as DEFAULT_OPEN_DOCS_PROMPT, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, nt as resolveDocsAnalyticsConfig, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, rt as resolveDocsObservabilityConfig, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsObservabilityEvent, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as normalizePromptProviderName } from "./search-
|
|
3
|
-
import { DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
1
|
+
import { A as DocsConfig, B as DocsObservabilityEventInput, D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, G as DocsSearchAdapterContext, J as DocsSearchConfig, K as DocsSearchAdapterFactory, O as DocsAskAIFeedbackValue, Q as DocsSearchResult, R as DocsObservabilityConfig, T as DocsAskAIFeedbackConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-D-cNOo-t.mjs";
|
|
2
|
+
import { $ as emitDocsAgentTraceEvent, A as toDocsSitemapMarkdownUrl, B as parsePromptStringArray, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as PromptAction, G as serializeOpenDocsProvider, H as sanitizePromptText, I as PromptProviderChoice, J as DocsAgentTraceContext, K as serializeOpenDocsProviders, L as SerializeOpenDocsProviderOptions, M as DEFAULT_OPEN_DOCS_PROVIDER_IDS, N as DEFAULT_OPEN_DOCS_TARGET, O as resolveDocsSitemapPageLastmod, P as DEFAULT_PROMPT_PROVIDER_TEMPLATES, Q as createDocsAgentTraceId, R as SerializedOpenDocsProvider, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as serializeDocsIcon, V as resolvePromptProviderChoices, W as serializeDocsIconRegistry, X as ResolvedDocsObservabilityConfig, Y as ResolvedDocsAnalyticsConfig, Z as createDocsAgentTraceContext, _ as DocsSitemapFormat, a as createMcpSearchAdapter, at as createDocsCloudAnalytics, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAnalyticsEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, it as DocsCloudAnalyticsOptions, j as DEFAULT_OPEN_DOCS_PROMPT, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, nt as resolveDocsAnalyticsConfig, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, rt as resolveDocsObservabilityConfig, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsObservabilityEvent, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as normalizePromptProviderName } from "./search-Dlwp88qb.mjs";
|
|
3
|
+
import { DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/api-reference.d.ts
|
|
6
6
|
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
|
|
@@ -55,4 +55,4 @@ declare function buildApiReferenceHtmlDocumentAsync(config: DocsConfig, options:
|
|
|
55
55
|
//#region src/sitemap-server.d.ts
|
|
56
56
|
declare function readDocsSitemapManifest(rootDir: string, sitemap?: boolean | DocsSitemapConfig): DocsSitemapManifest | null;
|
|
57
57
|
//#endregion
|
|
58
|
-
export { type ApiReferenceFramework, type ApiReferenceOpenApiDiscovery, type ApiReferenceRenderer, type ApiReferenceRoute, DEFAULT_API_REFERENCE_OPENAPI_ROUTE, DEFAULT_OPEN_DOCS_PROMPT, DEFAULT_OPEN_DOCS_PROVIDER_IDS, DEFAULT_OPEN_DOCS_TARGET, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DEFAULT_SITEMAP_MANIFEST_PATH, DEFAULT_SITEMAP_MD_ROUTE, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, DEFAULT_SITEMAP_XML_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAskAIFeedbackConfig, type DocsAskAIFeedbackData, type DocsAskAIFeedbackMessage, type DocsAskAIFeedbackValue, type DocsAskAIMcpConfig, type DocsCloudAnalyticsOptions, type DocsMcpHttpHandlers, type DocsMcpNavigationNode, type DocsMcpNavigationTree, type DocsMcpPage, type DocsMcpResolvedConfig, type DocsMcpSource, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchQuery, type DocsSearchResult, type DocsSearchSourcePage, type DocsSitemapFormat, type DocsSitemapManifest, type DocsSitemapManifestPage, type DocsSitemapPageInput, type DocsSitemapResolvedConfig, type McpDocsSearchConfig, type PromptAction, type PromptProviderChoice, type ResolvedApiReferenceConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsObservabilityConfig, type SerializeOpenDocsProviderOptions, type SerializedOpenDocsProvider, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsSearchDocuments, buildDocsSitemapManifest, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createDocsSitemapResponse, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, formatDocsAskAIPackageHints, inferDocsAskAIPackageHints, isApiReferenceOpenApiRequest, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, readDocsSitemapManifest, readDocsSitemapManifestFromContentMap, renderDocsSitemapMarkdown, renderDocsSitemapXml, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveAskAISearchRequestConfig, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProvider, serializeOpenDocsProviders, toDocsSitemapMarkdownUrl };
|
|
58
|
+
export { type ApiReferenceFramework, type ApiReferenceOpenApiDiscovery, type ApiReferenceRenderer, type ApiReferenceRoute, DEFAULT_API_REFERENCE_OPENAPI_ROUTE, DEFAULT_OPEN_DOCS_PROMPT, DEFAULT_OPEN_DOCS_PROVIDER_IDS, DEFAULT_OPEN_DOCS_TARGET, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DEFAULT_SITEMAP_MANIFEST_PATH, DEFAULT_SITEMAP_MD_ROUTE, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, DEFAULT_SITEMAP_XML_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAskAIFeedbackConfig, type DocsAskAIFeedbackData, type DocsAskAIFeedbackMessage, type DocsAskAIFeedbackValue, type DocsAskAIMcpConfig, type DocsCloudAnalyticsOptions, type DocsMcpCodeExample, type DocsMcpConfigSchema, type DocsMcpConfigSchemaOption, type DocsMcpHttpHandlers, type DocsMcpNavigationNode, type DocsMcpNavigationTree, type DocsMcpPage, type DocsMcpResolvedConfig, type DocsMcpSource, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchQuery, type DocsSearchResult, type DocsSearchSourcePage, type DocsSitemapFormat, type DocsSitemapManifest, type DocsSitemapManifestPage, type DocsSitemapPageInput, type DocsSitemapResolvedConfig, type McpDocsSearchConfig, type PromptAction, type PromptProviderChoice, type ResolvedApiReferenceConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsObservabilityConfig, type SerializeOpenDocsProviderOptions, type SerializedOpenDocsProvider, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsSearchDocuments, buildDocsSitemapManifest, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createDocsSitemapResponse, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, formatDocsAskAIPackageHints, inferDocsAskAIPackageHints, isApiReferenceOpenApiRequest, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, readDocsSitemapManifest, readDocsSitemapManifestFromContentMap, renderDocsSitemapMarkdown, renderDocsSitemapXml, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveAskAISearchRequestConfig, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProvider, serializeOpenDocsProviders, toDocsSitemapMarkdownUrl };
|
|
@@ -987,6 +987,10 @@ interface DocsMcpToolsConfig {
|
|
|
987
987
|
searchDocs?: boolean;
|
|
988
988
|
/** Expose a `get_navigation` tool for the docs tree. */
|
|
989
989
|
getNavigation?: boolean;
|
|
990
|
+
/** Expose a `get_code_examples` tool for fenced code blocks and their metadata. */
|
|
991
|
+
getCodeExamples?: boolean;
|
|
992
|
+
/** Expose a `get_config_schema` tool for docs.config option metadata. */
|
|
993
|
+
getConfigSchema?: boolean;
|
|
990
994
|
}
|
|
991
995
|
/**
|
|
992
996
|
* Built-in MCP server configuration.
|