docs: generate llms.txt, llms-full.txt, and markdown page renditions (#2407)
This commit is contained in:
parent
f172626a8e
commit
ebca273a3c
1 changed files with 313 additions and 78 deletions
|
|
@ -4,8 +4,14 @@ import { fileURLToPath } from 'node:url';
|
|||
|
||||
import { defineConfig, type DefaultTheme } from 'vitepress';
|
||||
|
||||
import { generateLlmsArtifacts } from './llms';
|
||||
import { guideSidebar } from './nav';
|
||||
|
||||
const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
/** Absolute site URL (origin + base), the single copy every consumer derives from. */
|
||||
const siteUrl = 'https://ts.sdk.modelcontextprotocol.io/v2';
|
||||
|
||||
/**
|
||||
* The API Reference sidebar is generated by `pnpm docs:api` (typedoc + typedoc-vitepress-theme)
|
||||
* into docs/api/typedoc-sidebar.json. When it is missing (e.g. `docs:dev` before `docs:api`),
|
||||
|
|
@ -25,7 +31,7 @@ export default defineConfig({
|
|||
description: 'The TypeScript SDK implementation of the Model Context Protocol specification.',
|
||||
base: '/v2/',
|
||||
srcExclude: ['v1/**', '_meta/**', 'behavior-surface-pins.md'],
|
||||
sitemap: { hostname: 'https://ts.sdk.modelcontextprotocol.io/v2/' },
|
||||
sitemap: { hostname: `${siteUrl}/` },
|
||||
markdown: {
|
||||
config(md) {
|
||||
// Spec-generated JSDoc (packages/core-internal/src/types/spec.types.*.ts) carries
|
||||
|
|
@ -42,6 +48,9 @@ export default defineConfig({
|
|||
};
|
||||
}
|
||||
},
|
||||
buildEnd(siteConfig) {
|
||||
generateLlmsArtifacts(docsDir, siteConfig.outDir, siteUrl);
|
||||
},
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: 'Get started', link: '/get-started/first-server', activeMatch: '^/get-started/' },
|
||||
|
|
@ -52,82 +61,7 @@ export default defineConfig({
|
|||
{ text: 'V1 Docs', link: 'https://ts.sdk.modelcontextprotocol.io/' }
|
||||
],
|
||||
sidebar: [
|
||||
{
|
||||
text: 'Get started',
|
||||
items: [
|
||||
{ text: 'Build a server', link: '/get-started/first-server' },
|
||||
{ text: 'Plug into a real host', link: '/get-started/real-host' },
|
||||
{ text: 'Build a client', link: '/get-started/first-client' },
|
||||
{ text: 'Packages', link: '/get-started/packages' },
|
||||
{ text: 'Examples', link: '/get-started/examples' }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Servers',
|
||||
items: [
|
||||
{ text: 'Tools', link: '/servers/tools' },
|
||||
{ text: 'Resources', link: '/servers/resources' },
|
||||
{ text: 'Prompts', link: '/servers/prompts' },
|
||||
{ text: 'Completion', link: '/servers/completion' },
|
||||
{ text: 'Logging, progress, cancellation', link: '/servers/logging-progress-cancellation' },
|
||||
{ text: 'Elicitation', link: '/servers/elicitation' },
|
||||
{ text: 'Sampling (sunset)', link: '/servers/sampling' },
|
||||
{ text: 'Input required', link: '/servers/input-required' },
|
||||
{ text: 'Notifications', link: '/servers/notifications' },
|
||||
{ text: 'Errors', link: '/servers/errors' }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Serving',
|
||||
items: [
|
||||
{ text: 'stdio', link: '/serving/stdio' },
|
||||
{ text: 'HTTP', link: '/serving/http' },
|
||||
{ text: 'Express', link: '/serving/express' },
|
||||
{ text: 'Hono', link: '/serving/hono' },
|
||||
{ text: 'Fastify', link: '/serving/fastify' },
|
||||
{ text: 'Web-standard runtimes', link: '/serving/web-standard' },
|
||||
{ text: 'Sessions, state, scaling', link: '/serving/sessions-state-scaling' },
|
||||
{ text: 'Authorization', link: '/serving/authorization' },
|
||||
{ text: 'Legacy clients', link: '/serving/legacy-clients' }
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Clients',
|
||||
items: [
|
||||
{ text: 'Connect', link: '/clients/connect' },
|
||||
{ text: 'Calling', link: '/clients/calling' },
|
||||
{ text: 'Handle server requests', link: '/clients/server-requests' },
|
||||
{ text: 'Roots (sunset)', link: '/clients/roots' },
|
||||
{ text: 'Subscriptions', link: '/clients/subscriptions' },
|
||||
{ text: 'OAuth', link: '/clients/oauth' },
|
||||
{ text: 'Machine auth', link: '/clients/machine-auth' },
|
||||
{ text: 'Middleware', link: '/clients/middleware' },
|
||||
{ text: 'Caching', link: '/clients/caching' }
|
||||
]
|
||||
},
|
||||
{ text: 'Protocol versions', link: '/protocol-versions' },
|
||||
{
|
||||
text: 'Advanced',
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'Low-level server', link: '/advanced/low-level-server' },
|
||||
{ text: 'Custom methods', link: '/advanced/custom-methods' },
|
||||
{ text: 'Schema libraries', link: '/advanced/schema-libraries' },
|
||||
{ text: 'Custom transports', link: '/advanced/custom-transports' },
|
||||
{ text: 'Wire schemas', link: '/advanced/wire-schemas' },
|
||||
{ text: 'Gateway', link: '/advanced/gateway' }
|
||||
]
|
||||
},
|
||||
{ text: 'Testing', link: '/testing' },
|
||||
{ text: 'Troubleshooting', link: '/troubleshooting' },
|
||||
{
|
||||
text: 'Migration',
|
||||
items: [
|
||||
{ text: 'Overview', link: '/migration/' },
|
||||
{ text: 'Upgrade to v2', link: '/migration/upgrade-to-v2' },
|
||||
{ text: '2026-07-28 protocol support', link: '/migration/support-2026-07-28' }
|
||||
]
|
||||
},
|
||||
...guideSidebar,
|
||||
{
|
||||
text: 'API Reference',
|
||||
collapsed: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue