@farming-labs/docs 0.2.61 → 0.2.62
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/package.json +1 -1
- package/dist/agent-DFHlw_JC.mjs +0 -624
- package/dist/agent-Fl0pjVNF.mjs +0 -4352
- package/dist/agent-evals-f4_OL10T.mjs +0 -2144
- package/dist/agent-export-D0zQhasD.mjs +0 -910
- package/dist/agent-scope-C_U--OZ7.mjs +0 -283
- package/dist/agent-skills-bundle.d.mts +0 -13
- package/dist/agent-skills-bundle.mjs +0 -12
- package/dist/agent-skills-server-CIeBszxp.mjs +0 -263
- package/dist/agent-skills-server-CKq3_jMj.d.mts +0 -12
- package/dist/agent-skills-vite.d.mts +0 -31
- package/dist/agent-skills-vite.mjs +0 -70
- package/dist/agents-ibnXrWyp.mjs +0 -221
- package/dist/analytics-Bx44lg6d.mjs +0 -177
- package/dist/cli/index.d.mts +0 -15
- package/dist/cli/index.mjs +0 -452
- package/dist/client/react.d.mts +0 -45
- package/dist/client/react.mjs +0 -223
- package/dist/cloud-analytics-CSyFE6SS.mjs +0 -132
- package/dist/cloud-ask-ai-D7ZgF47y.d.mts +0 -23
- package/dist/cloud-ask-ai-sbpjOR2K.mjs +0 -382
- package/dist/cloud-pdNC-tyj.mjs +0 -1615
- package/dist/code-blocks-DnNVNK2M.mjs +0 -871
- package/dist/codeblocks-CFuurVIH.mjs +0 -250
- package/dist/config-Wcdj-D0a.mjs +0 -369
- package/dist/dev-Cmy6DtdF.mjs +0 -1333
- package/dist/docs-cloud-server.d.mts +0 -70
- package/dist/docs-cloud-server.mjs +0 -310
- package/dist/doctor-CXostbsI.mjs +0 -2036
- package/dist/downgrade-w7e6Se0L.mjs +0 -184
- package/dist/errors-DbOhkE1h.mjs +0 -20
- package/dist/golden-evaluations-CBZ_JZjf.mjs +0 -1498
- package/dist/i18n-CCaFUnAN.mjs +0 -40
- package/dist/index.d.mts +0 -1141
- package/dist/index.mjs +0 -10
- package/dist/init-CQY0Woe3.mjs +0 -1264
- package/dist/mcp-DyPcoLwm.mjs +0 -156
- package/dist/mcp.d.mts +0 -298
- package/dist/mcp.mjs +0 -4426
- package/dist/metadata-Dv1ah0Aj.mjs +0 -237
- package/dist/package-version-n5AFur8a.mjs +0 -128
- package/dist/reading-time-C-SAhQT9.mjs +0 -742
- package/dist/review-D2UBrxFq.mjs +0 -673
- package/dist/robots-5Yqz9mz7.mjs +0 -179
- package/dist/robots-C08kDLsz.mjs +0 -201
- package/dist/search-9OnMGMvt.mjs +0 -1758
- package/dist/search-C6heDO8h.d.mts +0 -274
- package/dist/search-CNsRpz90.mjs +0 -104
- package/dist/server.d.mts +0 -342
- package/dist/server.mjs +0 -13
- package/dist/sitemap-BpYnSsfJ.mjs +0 -249
- package/dist/sitemap-server-D_0Kzanj.mjs +0 -1137
- package/dist/standards-discovery-C4HUqMd2.d.mts +0 -227
- package/dist/standards-discovery-C54V_aJH.mjs +0 -510
- package/dist/templates-Bq_P7ctv.mjs +0 -2465
- package/dist/types-EhFhYGfr.d.mts +0 -3305
- package/dist/upgrade-oz-GChgt.mjs +0 -56
- package/dist/utils-DpiIioYb.mjs +0 -225
package/dist/mcp-DyPcoLwm.mjs
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import "./agent-Fl0pjVNF.mjs";
|
|
2
|
-
import { k as resolveDocsPublishedAgentSkill } from "./standards-discovery-C54V_aJH.mjs";
|
|
3
|
-
import "./search-9OnMGMvt.mjs";
|
|
4
|
-
import "./sitemap-server-D_0Kzanj.mjs";
|
|
5
|
-
import "./agent-evals-f4_OL10T.mjs";
|
|
6
|
-
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
7
|
-
import "./code-blocks-DnNVNK2M.mjs";
|
|
8
|
-
import { t as resolveConfiguredAgentSkills } from "./agent-skills-server-CIeBszxp.mjs";
|
|
9
|
-
import "./server.mjs";
|
|
10
|
-
import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, i as hasTopLevelProperty, l as readBooleanProperty, n as extractObjectLiteral, o as loadDocsConfigModuleResult, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-Wcdj-D0a.mjs";
|
|
11
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
-
import path from "node:path";
|
|
13
|
-
import pc from "picocolors";
|
|
14
|
-
|
|
15
|
-
//#region src/cli/mcp.ts
|
|
16
|
-
const HOSTED_MCP_CLIENTS = [
|
|
17
|
-
"claude-code",
|
|
18
|
-
"cursor",
|
|
19
|
-
"vscode"
|
|
20
|
-
];
|
|
21
|
-
const HOSTED_MCP_CLIENT_LABELS = {
|
|
22
|
-
"claude-code": "Claude Code",
|
|
23
|
-
cursor: "Cursor",
|
|
24
|
-
vscode: "VS Code"
|
|
25
|
-
};
|
|
26
|
-
async function runMcp(options = {}) {
|
|
27
|
-
if (options.setup) {
|
|
28
|
-
printHostedMcpSetup(options);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const rootDir = process.cwd();
|
|
32
|
-
const content = readFileSync(resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
|
|
33
|
-
const configLoad = await loadDocsConfigModuleResult(rootDir, options.configPath);
|
|
34
|
-
const loadedConfig = configLoad.status === "evaluated" ? configLoad.config : void 0;
|
|
35
|
-
const staticAgent = extractNestedObjectLiteral(content, ["agent"]);
|
|
36
|
-
if (configLoad.status === "static-fallback" && staticAgent && hasTopLevelProperty(staticAgent, "skills")) throw new Error(`Could not evaluate ${configLoad.path}, so configured agent.skills cannot be published through MCP. ${configLoad.error}`);
|
|
37
|
-
const entry = readStringProperty(content, "entry") ?? "docs";
|
|
38
|
-
const contentDir = resolveDocsContentDir(rootDir, content, entry);
|
|
39
|
-
const navTitle = readNavTitle(content);
|
|
40
|
-
const mcp = readMcpConfig(content);
|
|
41
|
-
const filesystemSource = createFilesystemDocsMcpSource({
|
|
42
|
-
rootDir,
|
|
43
|
-
entry,
|
|
44
|
-
contentDir,
|
|
45
|
-
siteTitle: navTitle ?? "Documentation"
|
|
46
|
-
});
|
|
47
|
-
const resolvedMcp = resolveDocsMcpConfig(mcp ?? true, { defaultName: navTitle ?? "@farming-labs/docs" });
|
|
48
|
-
await runDocsMcpStdio({
|
|
49
|
-
source: {
|
|
50
|
-
...filesystemSource,
|
|
51
|
-
async getSkills() {
|
|
52
|
-
const configured = await resolveConfiguredAgentSkills(loadedConfig?.agent?.skills, { rootDir });
|
|
53
|
-
const rootSkillPath = path.join(rootDir, "skill.md");
|
|
54
|
-
return [await resolveDocsPublishedAgentSkill({
|
|
55
|
-
preferredDocument: existsSync(rootSkillPath) ? readFileSync(rootSkillPath, "utf8") : null,
|
|
56
|
-
fallbackDocument: `---\nname: docs\ndescription: Use the project documentation through MCP resources and tools.\n---\n\n# Documentation\n`
|
|
57
|
-
}), ...configured];
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
mcp: resolvedMcp,
|
|
61
|
-
defaultName: navTitle ?? "@farming-labs/docs"
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function normalizeApiBaseUrl(value) {
|
|
65
|
-
return (value?.trim() || "https://api.farming-labs.dev").replace(/\/+$/g, "");
|
|
66
|
-
}
|
|
67
|
-
function normalizeHostedMcpClient(value) {
|
|
68
|
-
const normalized = value?.trim().toLowerCase() || "claude-code";
|
|
69
|
-
if (normalized === "claude") return "claude-code";
|
|
70
|
-
if (HOSTED_MCP_CLIENTS.includes(normalized)) return normalized;
|
|
71
|
-
throw new Error(`Unsupported MCP client "${value}". Expected one of: ${HOSTED_MCP_CLIENTS.join(", ")}.`);
|
|
72
|
-
}
|
|
73
|
-
function createHostedMcpClientConfig(deploymentId, apiBaseUrl, clientName) {
|
|
74
|
-
const endpoint = `${normalizeApiBaseUrl(apiBaseUrl)}/v1/mcp/${deploymentId.trim()}`;
|
|
75
|
-
const client = normalizeHostedMcpClient(clientName);
|
|
76
|
-
if (client === "cursor") return { mcpServers: { "docs-cloud": {
|
|
77
|
-
url: endpoint,
|
|
78
|
-
headers: { Authorization: "Bearer ${env:DOCS_CLOUD_API_KEY}" }
|
|
79
|
-
} } };
|
|
80
|
-
if (client === "vscode") return {
|
|
81
|
-
inputs: [{
|
|
82
|
-
type: "promptString",
|
|
83
|
-
id: "docs-cloud-api-key",
|
|
84
|
-
description: "Docs Cloud API key",
|
|
85
|
-
password: true
|
|
86
|
-
}],
|
|
87
|
-
servers: { "docs-cloud": {
|
|
88
|
-
type: "http",
|
|
89
|
-
url: endpoint,
|
|
90
|
-
headers: { Authorization: "Bearer ${input:docs-cloud-api-key}" }
|
|
91
|
-
} }
|
|
92
|
-
};
|
|
93
|
-
return { mcpServers: { "docs-cloud": {
|
|
94
|
-
type: "http",
|
|
95
|
-
url: endpoint,
|
|
96
|
-
headers: { Authorization: "Bearer ${DOCS_CLOUD_API_KEY}" }
|
|
97
|
-
} } };
|
|
98
|
-
}
|
|
99
|
-
function printHostedMcpSetup(options) {
|
|
100
|
-
const deploymentId = options.deploymentId?.trim();
|
|
101
|
-
if (!deploymentId) {
|
|
102
|
-
console.error(pc.red("Missing MCP deployment id."));
|
|
103
|
-
console.error();
|
|
104
|
-
console.error(`Run ${pc.cyan("npx @farming-labs/docs mcp setup --deployment <deployment-id>")}.`);
|
|
105
|
-
process.exit(1);
|
|
106
|
-
}
|
|
107
|
-
const client = normalizeHostedMcpClient(options.client);
|
|
108
|
-
const jsonConfig = createHostedMcpClientConfig(deploymentId, options.apiBaseUrl, client);
|
|
109
|
-
const endpoint = `${normalizeApiBaseUrl(options.apiBaseUrl)}/v1/mcp/${deploymentId}`;
|
|
110
|
-
if (options.json) {
|
|
111
|
-
console.log(JSON.stringify(jsonConfig, null, 2));
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
console.log(pc.bold("Docs Cloud MCP deployment"));
|
|
115
|
-
console.log(pc.dim(`Deployment: ${deploymentId}`));
|
|
116
|
-
console.log();
|
|
117
|
-
console.log(pc.cyan("Streamable HTTP (recommended)"));
|
|
118
|
-
console.log(` ${endpoint}`);
|
|
119
|
-
console.log();
|
|
120
|
-
console.log(pc.cyan("SSE"));
|
|
121
|
-
console.log(` ${endpoint}/sse`);
|
|
122
|
-
console.log();
|
|
123
|
-
console.log(pc.cyan(`MCP client JSON (${HOSTED_MCP_CLIENT_LABELS[client]})`));
|
|
124
|
-
console.log(JSON.stringify(jsonConfig, null, 2));
|
|
125
|
-
console.log();
|
|
126
|
-
if (client === "vscode") console.log(pc.dim("VS Code prompts for the API key once and stores it securely."));
|
|
127
|
-
else console.log(pc.dim("The config reads DOCS_CLOUD_API_KEY from the MCP client environment; no secret is embedded."));
|
|
128
|
-
console.log(pc.dim("Use --client cursor or --client vscode to emit another native format."));
|
|
129
|
-
}
|
|
130
|
-
function readMcpConfig(content) {
|
|
131
|
-
if (content.match(/mcp\s*:\s*false/)) return false;
|
|
132
|
-
if (content.match(/mcp\s*:\s*true/)) return true;
|
|
133
|
-
const block = extractObjectLiteral(content, "mcp");
|
|
134
|
-
if (!block) return void 0;
|
|
135
|
-
return {
|
|
136
|
-
enabled: readBooleanProperty(block, "enabled"),
|
|
137
|
-
route: readStringProperty(block, "route"),
|
|
138
|
-
name: readStringProperty(block, "name"),
|
|
139
|
-
version: readStringProperty(block, "version"),
|
|
140
|
-
tools: {
|
|
141
|
-
listDocs: readBooleanProperty(block, "listDocs"),
|
|
142
|
-
listPages: readBooleanProperty(block, "listPages"),
|
|
143
|
-
listTasks: readBooleanProperty(block, "listTasks"),
|
|
144
|
-
readTask: readBooleanProperty(block, "readTask"),
|
|
145
|
-
readPage: readBooleanProperty(block, "readPage"),
|
|
146
|
-
searchDocs: readBooleanProperty(block, "searchDocs"),
|
|
147
|
-
getNavigation: readBooleanProperty(block, "getNavigation"),
|
|
148
|
-
getCodeExamples: readBooleanProperty(block, "getCodeExamples"),
|
|
149
|
-
getConfigSchema: readBooleanProperty(block, "getConfigSchema"),
|
|
150
|
-
getContext: readBooleanProperty(block, "getContext")
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
//#endregion
|
|
156
|
-
export { runMcp };
|
package/dist/mcp.d.mts
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { A as DocsPublishedAgentSkill } from "./standards-discovery-C4HUqMd2.mjs";
|
|
2
|
-
import { Dt as DocsObservabilityConfig, En as PageAgentFrontmatter, Qt as DocsTelemetryConfig, R as DocsAnalyticsConfig, Ut as DocsSearchConfig, Yt as DocsSearchSourcePage, gt as DocsMcpAuthenticate, ht as DocsMcpAuthPrincipal, mt as DocsMcpAllowedOrigins, rn as DocsTelemetryFramework, xn as OrderingItem, yt as DocsMcpConfig } from "./types-EhFhYGfr.mjs";
|
|
3
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
|
|
5
|
-
//#region src/mcp.d.ts
|
|
6
|
-
interface DocsMcpPage {
|
|
7
|
-
slug: string;
|
|
8
|
-
url: string;
|
|
9
|
-
title: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
related?: DocsSearchSourcePage["related"];
|
|
12
|
-
agent?: PageAgentFrontmatter;
|
|
13
|
-
icon?: string;
|
|
14
|
-
sourcePath?: string;
|
|
15
|
-
lastModified?: string;
|
|
16
|
-
locale?: string;
|
|
17
|
-
framework?: string;
|
|
18
|
-
version?: string;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
content: string;
|
|
21
|
-
rawContent?: string;
|
|
22
|
-
agentContent?: string;
|
|
23
|
-
agentRawContent?: string;
|
|
24
|
-
agentFallbackContent?: string;
|
|
25
|
-
agentFallbackRawContent?: string;
|
|
26
|
-
}
|
|
27
|
-
interface DocsMcpCodeExample {
|
|
28
|
-
id: string;
|
|
29
|
-
page: {
|
|
30
|
-
slug: string;
|
|
31
|
-
url: string;
|
|
32
|
-
title: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
sourcePath?: string;
|
|
35
|
-
lastModified?: string;
|
|
36
|
-
};
|
|
37
|
-
language?: string;
|
|
38
|
-
title?: string;
|
|
39
|
-
framework?: string;
|
|
40
|
-
packageManager?: string;
|
|
41
|
-
runnable: boolean;
|
|
42
|
-
meta: Record<string, string | boolean>;
|
|
43
|
-
code: string;
|
|
44
|
-
}
|
|
45
|
-
interface DocsMcpDocsPageSummary {
|
|
46
|
-
slug: string;
|
|
47
|
-
url: string;
|
|
48
|
-
title: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
agent?: DocsMcpAgentContractSummary;
|
|
51
|
-
icon?: string;
|
|
52
|
-
sourcePath?: string;
|
|
53
|
-
lastModified?: string;
|
|
54
|
-
}
|
|
55
|
-
interface DocsMcpAgentContractSummary {
|
|
56
|
-
hasContract: boolean;
|
|
57
|
-
task?: string;
|
|
58
|
-
outcome?: string;
|
|
59
|
-
appliesTo?: PageAgentFrontmatter["appliesTo"];
|
|
60
|
-
}
|
|
61
|
-
interface DocsMcpTaskSummary {
|
|
62
|
-
slug: string;
|
|
63
|
-
url: string;
|
|
64
|
-
title: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
task?: string;
|
|
67
|
-
outcome?: string;
|
|
68
|
-
appliesTo?: PageAgentFrontmatter["appliesTo"];
|
|
69
|
-
}
|
|
70
|
-
interface DocsMcpDocsSection {
|
|
71
|
-
slug: string;
|
|
72
|
-
title: string;
|
|
73
|
-
url?: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
icon?: string;
|
|
76
|
-
pageCount: number;
|
|
77
|
-
pages: DocsMcpDocsPageSummary[];
|
|
78
|
-
sections: DocsMcpDocsSection[];
|
|
79
|
-
}
|
|
80
|
-
interface DocsMcpDocsList {
|
|
81
|
-
section?: string;
|
|
82
|
-
resultCount: number;
|
|
83
|
-
sectionCount: number;
|
|
84
|
-
pages: DocsMcpDocsPageSummary[];
|
|
85
|
-
rootPages: DocsMcpDocsPageSummary[];
|
|
86
|
-
sections: DocsMcpDocsSection[];
|
|
87
|
-
}
|
|
88
|
-
interface DocsMcpConfigSchemaOption {
|
|
89
|
-
path: string;
|
|
90
|
-
name: string;
|
|
91
|
-
type: string;
|
|
92
|
-
default?: string | boolean | number | null;
|
|
93
|
-
description: string;
|
|
94
|
-
docs?: string;
|
|
95
|
-
values?: readonly string[];
|
|
96
|
-
children?: readonly DocsMcpConfigSchemaOption[];
|
|
97
|
-
}
|
|
98
|
-
interface DocsMcpConfigSchema {
|
|
99
|
-
schemaVersion: 1;
|
|
100
|
-
configFile: "docs.config.ts";
|
|
101
|
-
description: string;
|
|
102
|
-
filters?: {
|
|
103
|
-
option?: string;
|
|
104
|
-
query?: string;
|
|
105
|
-
};
|
|
106
|
-
resultCount: number;
|
|
107
|
-
options: DocsMcpConfigSchemaOption[];
|
|
108
|
-
examples: Array<{
|
|
109
|
-
title: string;
|
|
110
|
-
code: string;
|
|
111
|
-
}>;
|
|
112
|
-
}
|
|
113
|
-
interface DocsMcpContextSource {
|
|
114
|
-
id: string;
|
|
115
|
-
title: string;
|
|
116
|
-
/** Page URL without a fragment. */
|
|
117
|
-
pageUrl: string;
|
|
118
|
-
/** Source URL for this exact context chunk, including its heading anchor when available. */
|
|
119
|
-
url: string;
|
|
120
|
-
section?: string;
|
|
121
|
-
anchor?: string;
|
|
122
|
-
sourcePath?: string;
|
|
123
|
-
lastModified?: string;
|
|
124
|
-
locale?: string;
|
|
125
|
-
framework?: string;
|
|
126
|
-
version?: string;
|
|
127
|
-
tags?: string[];
|
|
128
|
-
score?: number;
|
|
129
|
-
content: string;
|
|
130
|
-
/** JavaScript string length for this source's content only. */
|
|
131
|
-
chars: number;
|
|
132
|
-
/** Encoded UTF-8 bytes for this source's content only. */
|
|
133
|
-
utf8Bytes: number;
|
|
134
|
-
truncated: boolean;
|
|
135
|
-
}
|
|
136
|
-
interface DocsMcpContextResult {
|
|
137
|
-
query: string;
|
|
138
|
-
filters: {
|
|
139
|
-
framework?: string;
|
|
140
|
-
version?: string;
|
|
141
|
-
locale?: string;
|
|
142
|
-
};
|
|
143
|
-
budget: {
|
|
144
|
-
/** Caller-provided token target; retained as the stable input contract. */requestedTokens: number; /** Dependency-free conservative accounting strategy. */
|
|
145
|
-
strategy: "utf8-bytes"; /** Hard UTF-8 byte ceiling for the complete assembled `context`. */
|
|
146
|
-
maxUtf8Bytes: number; /** Exact UTF-8 bytes used by the complete assembled `context`. */
|
|
147
|
-
usedUtf8Bytes: number; /** Conservative token-count upper bound derived from `usedUtf8Bytes`. */
|
|
148
|
-
conservativeTokenUpperBound: number;
|
|
149
|
-
remainingUtf8Bytes: number;
|
|
150
|
-
truncated: boolean;
|
|
151
|
-
};
|
|
152
|
-
resultCount: number;
|
|
153
|
-
candidateCount: number;
|
|
154
|
-
context: string;
|
|
155
|
-
sources: DocsMcpContextSource[];
|
|
156
|
-
}
|
|
157
|
-
interface DocsMcpContextOptions {
|
|
158
|
-
pages: readonly DocsMcpPage[];
|
|
159
|
-
query: string;
|
|
160
|
-
framework?: string;
|
|
161
|
-
version?: string;
|
|
162
|
-
locale?: string;
|
|
163
|
-
tokenBudget: number;
|
|
164
|
-
entry?: string;
|
|
165
|
-
siteTitle?: string;
|
|
166
|
-
/** Maximum number of ranked, deduplicated candidates to render. Defaults to 50. */
|
|
167
|
-
maxResults?: number;
|
|
168
|
-
}
|
|
169
|
-
interface DocsMcpPageNode {
|
|
170
|
-
type: "page";
|
|
171
|
-
name: string;
|
|
172
|
-
url: string;
|
|
173
|
-
icon?: string;
|
|
174
|
-
description?: string;
|
|
175
|
-
}
|
|
176
|
-
interface DocsMcpFolderNode {
|
|
177
|
-
type: "folder";
|
|
178
|
-
name: string;
|
|
179
|
-
icon?: string;
|
|
180
|
-
index?: DocsMcpPageNode;
|
|
181
|
-
children: DocsMcpNavigationNode[];
|
|
182
|
-
}
|
|
183
|
-
type DocsMcpNavigationNode = DocsMcpPageNode | DocsMcpFolderNode;
|
|
184
|
-
interface DocsMcpNavigationTree {
|
|
185
|
-
name: string;
|
|
186
|
-
children: DocsMcpNavigationNode[];
|
|
187
|
-
}
|
|
188
|
-
interface DocsMcpSource {
|
|
189
|
-
entry?: string;
|
|
190
|
-
siteTitle?: string;
|
|
191
|
-
getPages(locale?: string, context?: DocsMcpRequestContext): DocsMcpPage[] | Promise<DocsMcpPage[]>;
|
|
192
|
-
getNavigation(locale?: string, context?: DocsMcpRequestContext): DocsMcpNavigationTree | Promise<DocsMcpNavigationTree>;
|
|
193
|
-
/** Reusable Agent Skills exposed as progressive-disclosure MCP resources. */
|
|
194
|
-
getSkills?(context?: DocsMcpRequestContext): readonly DocsPublishedAgentSkill[] | Promise<readonly DocsPublishedAgentSkill[]>;
|
|
195
|
-
}
|
|
196
|
-
/** Request-scoped identity available to custom MCP sources. */
|
|
197
|
-
interface DocsMcpRequestContext {
|
|
198
|
-
transport: "http" | "stdio";
|
|
199
|
-
request?: Request;
|
|
200
|
-
auth?: DocsMcpAuthPrincipal;
|
|
201
|
-
}
|
|
202
|
-
interface DocsMcpResolvedSecurityConfig {
|
|
203
|
-
allowedOrigins: DocsMcpAllowedOrigins;
|
|
204
|
-
authenticate?: DocsMcpAuthenticate;
|
|
205
|
-
protectedResource?: DocsMcpResolvedProtectedResourceConfig;
|
|
206
|
-
maxBodyBytes: number;
|
|
207
|
-
cors: DocsMcpResolvedCorsConfig;
|
|
208
|
-
}
|
|
209
|
-
interface DocsMcpResolvedProtectedResourceConfig {
|
|
210
|
-
authorizationServers: string[];
|
|
211
|
-
scopesSupported: string[];
|
|
212
|
-
requiredScopes: string[];
|
|
213
|
-
resourceName?: string;
|
|
214
|
-
resourceDocumentation?: string;
|
|
215
|
-
}
|
|
216
|
-
interface DocsMcpResolvedCorsConfig {
|
|
217
|
-
enabled: boolean;
|
|
218
|
-
allowedHeaders: string[];
|
|
219
|
-
exposedHeaders: string[];
|
|
220
|
-
allowCredentials: boolean;
|
|
221
|
-
maxAgeSeconds: number;
|
|
222
|
-
}
|
|
223
|
-
interface DocsMcpResolvedConfig {
|
|
224
|
-
enabled: boolean;
|
|
225
|
-
route: string;
|
|
226
|
-
name: string;
|
|
227
|
-
version: string;
|
|
228
|
-
tools: {
|
|
229
|
-
listDocs: boolean;
|
|
230
|
-
listPages: boolean;
|
|
231
|
-
readPage: boolean;
|
|
232
|
-
listTasks?: boolean;
|
|
233
|
-
readTask?: boolean;
|
|
234
|
-
searchDocs: boolean;
|
|
235
|
-
getNavigation: boolean;
|
|
236
|
-
getCodeExamples: boolean;
|
|
237
|
-
getConfigSchema: boolean;
|
|
238
|
-
getContext: boolean;
|
|
239
|
-
};
|
|
240
|
-
/** Resolved HTTP-only security policy. Omitted on manually constructed legacy values. */
|
|
241
|
-
security?: DocsMcpResolvedSecurityConfig;
|
|
242
|
-
}
|
|
243
|
-
interface DocsMcpHttpHandlers {
|
|
244
|
-
GET: (context: {
|
|
245
|
-
request: Request;
|
|
246
|
-
}) => Promise<Response>;
|
|
247
|
-
POST: (context: {
|
|
248
|
-
request: Request;
|
|
249
|
-
}) => Promise<Response>;
|
|
250
|
-
DELETE: (context: {
|
|
251
|
-
request: Request;
|
|
252
|
-
}) => Promise<Response>;
|
|
253
|
-
OPTIONS: (context: {
|
|
254
|
-
request: Request;
|
|
255
|
-
}) => Promise<Response>;
|
|
256
|
-
}
|
|
257
|
-
interface CreateDocsMcpServerOptions {
|
|
258
|
-
source: DocsMcpSource;
|
|
259
|
-
mcp?: boolean | DocsMcpConfig;
|
|
260
|
-
search?: boolean | DocsSearchConfig;
|
|
261
|
-
analytics?: boolean | DocsAnalyticsConfig;
|
|
262
|
-
telemetry?: boolean | DocsTelemetryConfig;
|
|
263
|
-
telemetryFramework?: DocsTelemetryFramework;
|
|
264
|
-
observability?: boolean | DocsObservabilityConfig;
|
|
265
|
-
defaultName?: string;
|
|
266
|
-
defaultVersion?: string;
|
|
267
|
-
/** Internal request context used to expose an authenticated principal to custom sources. */
|
|
268
|
-
requestContext?: DocsMcpRequestContext;
|
|
269
|
-
}
|
|
270
|
-
interface CreateFilesystemDocsMcpSourceOptions {
|
|
271
|
-
rootDir?: string;
|
|
272
|
-
entry?: string;
|
|
273
|
-
contentDir?: string;
|
|
274
|
-
siteTitle?: string;
|
|
275
|
-
ordering?: "alphabetical" | "numeric" | OrderingItem[];
|
|
276
|
-
}
|
|
277
|
-
declare const DEFAULT_DOCS_MCP_MAX_BODY_BYTES: number;
|
|
278
|
-
declare const DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS = 600;
|
|
279
|
-
declare const DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS: readonly string[];
|
|
280
|
-
declare const DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS: readonly string[];
|
|
281
|
-
declare const DOCS_CONFIG_SCHEMA_OPTIONS: readonly DocsMcpConfigSchemaOption[];
|
|
282
|
-
declare function normalizeDocsMcpRoute(route?: string): string;
|
|
283
|
-
declare function resolveDocsMcpConfig(mcp?: boolean | DocsMcpConfig, defaults?: {
|
|
284
|
-
defaultName?: string;
|
|
285
|
-
defaultVersion?: string;
|
|
286
|
-
defaultRoute?: string;
|
|
287
|
-
}): DocsMcpResolvedConfig;
|
|
288
|
-
declare function createFilesystemDocsMcpSource(options?: CreateFilesystemDocsMcpSourceOptions): DocsMcpSource;
|
|
289
|
-
declare function createDocsMcpServer(options: CreateDocsMcpServerOptions): Promise<McpServer>;
|
|
290
|
-
declare function createDocsMcpHttpHandler(options: CreateDocsMcpServerOptions): DocsMcpHttpHandlers;
|
|
291
|
-
declare function runDocsMcpStdio(options: CreateDocsMcpServerOptions): Promise<void>;
|
|
292
|
-
declare function getDocsConfigSchema(filters?: {
|
|
293
|
-
option?: string;
|
|
294
|
-
query?: string;
|
|
295
|
-
}): DocsMcpConfigSchema;
|
|
296
|
-
declare function buildDocsMcpContext(options: DocsMcpContextOptions): Promise<DocsMcpContextResult>;
|
|
297
|
-
//#endregion
|
|
298
|
-
export { CreateDocsMcpServerOptions, 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, DocsMcpAgentContractSummary, DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpContextOptions, DocsMcpContextResult, DocsMcpContextSource, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpRequestContext, DocsMcpResolvedConfig, DocsMcpResolvedCorsConfig, DocsMcpResolvedProtectedResourceConfig, DocsMcpResolvedSecurityConfig, DocsMcpSource, DocsMcpTaskSummary, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio };
|