How scalvert/docusaurus-plugin-mcp-server works
This Docusaurus plugin turns built documentation into artifacts and serves them through an MCP endpoint. The main workflow is: the site build collects routes, extracts and converts page content, generates search and skill artifacts, and the running server exposes search and fetch tools to AI clients. The graph also shows the Node and web adapters, optional search-provider extension points, and the install-button UI. Some subsystem links are based on the README or SOURCE INDEX; unsampled implementation details are not assumed.
Main entry points: docusaurus-plugin.ts Plugin orchestration · server.ts MCP server · packager.ts Skill packager · web-request.ts Web request adapter
Components 22
Site build
- Plugin orchestration
src/plugin/docusaurus-plugin.ts - Route collection
src/plugin/route-collector.ts - HTML extraction
src/processing/html-parser.ts - Markdown conversion
src/processing/html-to-markdown.ts
Search
- Local indexer
src/providers/indexers/local-search-indexer.ts - Search index and ranking
src/search/local-search.ts - Provider loader
src/providers/loader.ts - Local search provider
src/providers/search/local-search-provider.ts
MCP serving
- Web request adapter
src/adapters/web-request.ts - Node HTTP adapter
src/adapters/node.ts - CORS handling
src/adapters/cors.ts - MCP server
src/mcp/server.ts - docs_search tool
src/mcp/tools/docs-search.ts - docs_fetch tool
src/mcp/tools/docs-fetch.ts - Skills protocol
src/mcp/skills.ts
Agent skills
- Skill packager
src/skills/packager.ts - Built-in skill
src/skills/builtin.ts - Skill site map
src/skills/site-map.ts - Skill frontmatter
src/skills/frontmatter.ts
Site UI
- MCP install button
src/theme/McpInstallButton.tsx
Other components
- Docusaurus build
- AI client
Connections 24
- Docusaurus build → Plugin orchestration: runs plugin
- Plugin orchestration → Route collection: collects routes
src/plugin/docusaurus-plugin.ts - Plugin orchestration → HTML extraction: extracts content
src/plugin/docusaurus-plugin.ts - Plugin orchestration → Markdown conversion: converts content
src/plugin/docusaurus-plugin.ts - Plugin orchestration → Local indexer: loads indexer
src/plugin/docusaurus-plugin.ts - Local indexer → Search index and ranking: builds index
src/providers/indexers/local-search-indexer.ts - Plugin orchestration → Skill packager: builds skills
src/plugin/docusaurus-plugin.ts - Skill packager → Built-in skill: renders template
src/skills/packager.ts - Skill packager → Skill frontmatter: validates metadata
src/skills/packager.ts - Skill packager → Skill site map: generates site map
src/skills/packager.ts - AI client → Web request adapter: sends requests
- Web request adapter → MCP server: dispatches requests
src/adapters/web-request.ts - Web request adapter → CORS handling: applies CORS
src/adapters/web-request.ts - Node HTTP adapter → MCP server: dispatches requests
src/adapters/node.ts - Node HTTP adapter → CORS handling: applies CORS
src/adapters/node.ts - MCP server → Provider loader: loads provider
src/mcp/server.ts - MCP server → docs_search tool: registers tool
src/mcp/server.ts - MCP server → docs_fetch tool: registers tool
src/mcp/server.ts - MCP server → Skills protocol: adds skills
src/mcp/server.ts - Provider loader → Local search provider: loads provider
src/providers/loader.ts - Local search provider → Search index and ranking: queries index
src/providers/search/local-search-provider.ts - AI client → docs_search tool: requests search
- AI client → docs_fetch tool: fetches page
- AI client → MCP install button: configures connection