forked from modelcontextprotocol/typescript-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypedoc.config.mjs
More file actions
59 lines (55 loc) · 2.69 KB
/
Copy pathtypedoc.config.mjs
File metadata and controls
59 lines (55 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { OptionDefaults } from 'typedoc';
import fg from 'fast-glob';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
// Find all package.json files under packages/ and build package list.
// Exclude node_modules and the codemod batch-test's cloned real-world repos, which are not part
// of this SDK's public API surface (and would otherwise fail docs:check locally when present).
const packageJsonPaths = await fg('packages/**/package.json', {
cwd: process.cwd(),
ignore: ['**/node_modules/**', '**/batch-test/**']
});
const packages = packageJsonPaths.map(p => {
const rootDir = join(process.cwd(), p.replace('/package.json', ''));
const manifest = JSON.parse(readFileSync(join(process.cwd(), p), 'utf8'));
return { rootDir, manifest };
});
// @modelcontextprotocol/core is published for direct schema imports (CallToolResultSchema.parse(...)),
// but it's a thin re-export of the spec/OAuth Zod schemas whose JSDoc cross-references TYPES that live
// in client/server — unresolvable from core's own per-package doc scope. We skip rendering its API docs
// (the schemas mirror the documented types 1:1) so monorepo-wide invalid-link validation can stay ON.
const DOCS_EXCLUDED_PACKAGES = new Set(['@modelcontextprotocol/core']);
const publicPackages = packages.filter(p => p.manifest.private !== true && !DOCS_EXCLUDED_PACKAGES.has(p.manifest.name));
const entryPoints = publicPackages.map(p => p.rootDir);
console.log(
'Typedoc selected public packages:',
publicPackages.map(p => p.manifest.name)
);
/** @type {Partial<import("typedoc").TypeDocOptions>} */
export default {
name: 'MCP TypeScript SDK (V2)',
plugin: ['typedoc-plugin-markdown', 'typedoc-vitepress-theme'],
entryPointStrategy: 'packages',
entryPoints,
packageOptions: {
blockTags: [...OptionDefaults.blockTags, '@format'],
exclude: ['**/*.examples.ts']
},
highlightLanguages: [...OptionDefaults.highlightLanguages, 'powershell'],
// typedoc-plugin-markdown: one page per module/package, symbols as sections.
outputFileStrategy: 'modules',
// The VitePress landing page replaces the root README; rendering it here would duplicate it
// under /api/ and drag relative-linked files into _media/ copies with broken links.
readme: 'none',
// typedoc-vitepress-theme: emits docs/api/typedoc-sidebar.json with links relative to the
// VitePress source root.
docsRoot: 'docs',
treatWarningsAsErrors: true,
out: 'docs/api',
externalSymbolLinkMappings: {
'@modelcontextprotocol/core-internal': {
StandardSchemaV1: 'https://standardschema.dev/',
StandardJSONSchemaV1: 'https://standardschema.dev/'
}
}
};