Plugin options
These go in docusaurus.config.js and control what the build produces. Options for the running server are on the handler instead: see Server options.
module.exports = {
plugins: [
[
'docusaurus-plugin-mcp-server',
{
server: { name: 'my-docs', version: '1.0.0' },
excludeRoutes: ['/404*', '/search*', '/blog/tags/**'],
},
],
],
};
| Option | Type | Default | Description |
|---|---|---|---|
server.name | string | 'docs-mcp-server' | Name of the MCP server |
server.version | string | '1.0.0' | Version of the MCP server |
server.url | string | derived | The endpoint URL the install button and global data advertise. Set it when the endpoint isn't at {url}/{outputDir} |
server.urlBase | 'origin' | 'site' | 'origin' | How to derive the endpoint URL when server.url isn't set. 'origin' → {url}/{outputDir}; 'site' → under the Docusaurus baseUrl |
outputDir | string | 'mcp' | Directory for the artifact bundle, relative to the build directory |
contentSelectors | string[] | see below | CSS selectors for a page's main content, in priority order. Invalid selectors are skipped with a build warning |
excludeSelectors | string[] | see below | CSS selectors for elements to remove from the content. Full CSS since 2.2. Invalid selectors are skipped with a build warning |
minContentLength | number | 50 | Pages with less extracted text than this are skipped |
excludeRoutes | string[] | ['/404*', '/search*'] | Glob patterns for routes to leave out |
mdxComponents | boolean | true | Make the plugin's components available in MDX pages without an import (see below). Set false if your theme has no MDXComponents |
indexers | string[] | false | ['local'] | Indexers to run at build time: 'local' (built-in), a path (relative to the site directory), or an npm package. false skips all MCP build output: no bundle, skills, or agent guides |
skills | { builtin?: boolean; dir?: string } | false | built-in skill only | Agent Skills to package. dir is relative to the site directory. false turns skills off |
search | string | 'local' | Deprecated since 2.2, removed in 3.0. Has had no effect since 2.0. Choose the search provider with the server's search option. 'flexsearch' is rejected |
Default selectors
Content selectors, in priority order. The first one that matches is used:
['article', 'main', '.main-wrapper', '[role="main"]'];
Exclude selectors, removed from the content before conversion:
[
'nav',
'header',
'footer',
'aside',
'[role="navigation"]',
'[role="banner"]',
'[role="contentinfo"]',
'.theme-doc-toc-mobile',
];
Setting excludeSelectors replaces the defaults, so include the ones you want to keep.
Endpoint URL examples
url | baseUrl | Options | Advertised endpoint |
|---|---|---|---|
https://docs.example.com | / | (none) | https://docs.example.com/mcp |
https://example.com | /docs/ | (none) | https://example.com/mcp |
https://example.com | /docs/ | server.urlBase: 'site' | https://example.com/docs/mcp |
https://my-org.github.io | /my-docs/ | server.url: 'https://mcp.example.com/mcp' | https://mcp.example.com/mcp |
resolveServerUrl computes the same value in code.
MDX components
The plugin adds its components to your theme's MDXComponents, so any page can use McpInstallButton, ForAgents, ForHumans, and the agent guide components (AgentGuide, DoneWhen, Prerequisites, Step, Check, Symptom) without importing them. Pages that import them from docusaurus-plugin-mcp-server/theme keep working, and a component a page imports itself takes precedence, so your own Step is unaffected.
-
preset-classicworks as is: the plugin extends theMDXComponentsof the theme loaded before it. -
@docusaurus/theme-classicunderthemesloads after everything inplugins, so itsMDXComponentsreplaces the plugin's, and a page that uses a component without importing it fails the build withExpected component `ForAgents` to be defined. List the plugin underthemestoo, after the classic theme:themes: ['@docusaurus/theme-classic', ['docusaurus-plugin-mcp-server', { /* options */ }]], -
A swizzled
MDXComponentsthat wraps the original (import MDXComponents from '@theme-original/MDXComponents') keeps the plugin's components. -
A swizzled
MDXComponentsyou ejected (a full copy) replaces them. Spread them into yours:src/theme/MDXComponents.jsimport { mdxComponents } from 'docusaurus-plugin-mcp-server/theme';export default {// ...your components...mdxComponents,}; -
A theme with no
MDXComponentsfails the build with a missing@theme-init/MDXComponents. SetmdxComponents: falseand import the components in each page.