Skip to main content

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.

docusaurus.config.js
module.exports = {
plugins: [
[
'docusaurus-plugin-mcp-server',
{
server: { name: 'my-docs', version: '1.0.0' },
excludeRoutes: ['/404*', '/search*', '/blog/tags/**'],
},
],
],
};
OptionTypeDefaultDescription
server.namestring'docs-mcp-server'Name of the MCP server
server.versionstring'1.0.0'Version of the MCP server
server.urlstringderivedThe 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
outputDirstring'mcp'Directory for the artifact bundle, relative to the build directory
contentSelectorsstring[]see belowCSS selectors for a page's main content, in priority order. Invalid selectors are skipped with a build warning
excludeSelectorsstring[]see belowCSS selectors for elements to remove from the content. Full CSS since 2.2. Invalid selectors are skipped with a build warning
minContentLengthnumber50Pages with less extracted text than this are skipped
excludeRoutesstring[]['/404*', '/search*']Glob patterns for routes to leave out
mdxComponentsbooleantrueMake the plugin's components available in MDX pages without an import (see below). Set false if your theme has no MDXComponents
indexersstring[] | 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 } | falsebuilt-in skill onlyAgent Skills to package. dir is relative to the site directory. false turns skills off
searchstring'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​

urlbaseUrlOptionsAdvertised 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-classic works as is: the plugin extends the MDXComponents of the theme loaded before it.

  • @docusaurus/theme-classic under themes loads after everything in plugins, so its MDXComponents replaces the plugin's, and a page that uses a component without importing it fails the build with Expected component `ForAgents` to be defined. List the plugin under themes too, after the classic theme:

    themes: ['@docusaurus/theme-classic', ['docusaurus-plugin-mcp-server', { /* options */ }]],
  • A swizzled MDXComponents that wraps the original (import MDXComponents from '@theme-original/MDXComponents') keeps the plugin's components.

  • A swizzled MDXComponents you ejected (a full copy) replaces them. Spread them into yours:

    src/theme/MDXComponents.js
    import { mdxComponents } from 'docusaurus-plugin-mcp-server/theme';

    export default {
    // ...your components
    ...mdxComponents,
    };
  • A theme with no MDXComponents fails the build with a missing @theme-init/MDXComponents. Set mdxComponents: false and import the components in each page.