Feature Flags

Optional features such as component docs, Mermaid, AI Chat and accessibility checks are controlled by switches in nuxt.config, and features that are off bundle none of their dependencies. This page lists each flag's default, the dependencies to install when enabling it, and what happens when it is off.
View source

Overview

nuxt.config.ts
export default defineNuxtConfig({
  extends: ['@movk/nuxt-docs'],
  movkNuxtDocs: {
    componentDocs: false,
    mcp: true,
    ogImage: true,
    mermaid: false,
    a11y: false
  },
  aiChat: {
    enabled: undefined
  }
})
FlagDefaultEnablesExtra install
movkNuxtDocs.componentDocsfalseComponentProps, ComponentSlots, ComponentEmits, ComponentCode, ComponentExample and Prettier formattingYes
movkNuxtDocs.mcptrueBuilt-in MCP Server (@nuxtjs/mcp-toolkit)No
movkNuxtDocs.ogImagetrueOG images generated per page at build time (nuxt-og-image)No
movkNuxtDocs.mermaidfalseMermaid diagrams in MarkdownYes
movkNuxtDocs.a11yfalse@nuxt/a11y accessibility checks during developmentYes
aiChat.enabledtrue when AI_API_KEY exists at build timeAI chat assistant, floating input and "Explain with AI"Yes

Dependencies of features that are on by default (MCP, OG images) ship with the layer. Features that are off by default declare their dependencies as optional peer dependencies, which your project installs when enabling them.

AI Chat reads the docs through the MCP Server. Setting movkNuxtDocs.mcp: false while aiChat is enabled fails the build.

Installing dependencies

When an enabled feature is missing dependencies, the build stops and lists the missing packages with an install command, for example:

[@movk/nuxt-docs] 已启用的功能缺少依赖:
  - mermaid: mermaid, dompurify
请安装后重试:pnpm add mermaid dompurify

Component docs

pnpm add nuxt-component-meta vue-component-meta prettier

Once enabled, only components listed in componentMeta.include get metadata, see nuxt.config Options.

Mermaid

pnpm add mermaid dompurify

Accessibility checks

pnpm add @nuxt/a11y

AI Chat

pnpm add ai @ai-sdk/openai @ai-sdk/vue @comark/vue @shikijs/engine-javascript @shikijs/langs @shikijs/themes

Then set AI_API_KEY (and optionally AI_BASE_URL) in both the build and runtime environments. See AI Chat for models and other options.

When a feature is off

Disabled features are excluded from bundling and type checking, and callers never need to check the flag:

FeatureWhen off
Component docsThe component docs MDC components are not registered; raw markdown and the MCP component tools receive empty metadata and examples
MCPThe /mcp endpoint is not registered and /.well-known/mcp/server-card.json is not generated
OG imagesdefineOgImage calls become no-ops; og:title, og:description and other meta tags remain
MermaidCode blocks tagged mermaid render as plain code blocks
a11y@nuxt/a11y is not loaded
AI ChatAiChat, AiChatPanel and related components are replaced with disabled versions, useAIChat() returns a disabled implementation, and the header hides the AI entry

When aiChat.enabled is not set, it follows whether AI_API_KEY exists at build time. If you set aiChat.enabled: true without the variable at build time, the build warns you to make sure the runtime environment provides it.

Turning every optional feature off gives the smallest output and the fastest build:
nuxt.config.ts
export default defineNuxtConfig({
  movkNuxtDocs: {
    mcp: false,
    ogImage: false
  },
  aiChat: {
    enabled: false
  }
})
Copyright © 2024 - 2026