Skip to main content

Overview

The AI Assistant is a built-in chat interface that provides intelligent, contextual answers to user questions about your documentation. It uses the Model Context Protocol (MCP) to search and retrieve relevant content, then generates helpful responses with source citations and code examples.
The assistant requires an AI Gateway API key to function. Without this key, the assistant components will be automatically disabled.

How It Works

The assistant uses a multi-agent architecture powered by the AI SDK:
  1. User Query - Users ask questions through the floating input or slideover interface
  2. MCP Tools - The AI uses your built-in MCP server to search and retrieve documentation pages
  3. Response Generation - The AI synthesizes information into conversational answers with citations
  4. Streaming UI - Responses stream in real-time with syntax-highlighted code blocks
By default, the assistant connects to your documentation’s built-in MCP server at /mcp, giving it access to all your pages without additional configuration.

Quick Start

1

Get an API Key

Visit Vercel AI Gateway and create an API key. AI Gateway supports multiple providers (OpenAI, Anthropic, Google, and more) through a unified API.
2

Add Environment Variable

Set your API key in your environment:
.env
3

Deploy and Test

That’s it! The assistant is automatically enabled when the API key is detected. Deploy your site and look for the floating input at the bottom of documentation pages.

User Interface Components

Floating Input

A compact input field appears at the bottom center of documentation pages, allowing users to quickly ask questions without opening a panel. Features:
  • Auto-hides when the chat slideover is open
  • Expands on focus for better typing experience
  • Keyboard shortcut: Cmd+I (Mac) or Ctrl+I (Windows)
  • Press Escape to blur the input

Chat Slideover

When users submit a question, a side panel opens displaying the conversation. The panel includes:
  • Streaming responses with real-time text generation
  • Syntax-highlighted code blocks using Shiki
  • Source citations linking back to relevant documentation pages
  • FAQ suggestions when the chat is empty
  • Clear chat button to start a fresh conversation

Explain with AI Button

Each documentation page includes an “Explain with AI” button in the sidebar that opens the assistant with the current page as context.

Configuration

Basic Options

Configure the assistant in nuxt.config.ts:
nuxt.config.ts

Module Options

App Configuration

Customize the UI and behavior in app.config.ts:
app.config.ts

FAQ Questions

Display suggested questions when the chat is empty to help users discover capabilities.

Simple Array

app.config.ts

Categorized Questions

app.config.ts

Localized Questions

MCP Server Configuration

The assistant requires an MCP server to access your documentation content.

Built-in MCP Server (Default)

Use Docus’s built-in MCP server that automatically exposes all your documentation pages:
nuxt.config.ts
Ensure the MCP server is enabled in your configuration. If you’ve disabled it or customized the path, update the mcpServer option accordingly.

External MCP Server

Connect to any external MCP server by providing a full URL:
nuxt.config.ts
This allows the assistant to answer questions from different documentation sources or a centralized knowledge base.

AI Model Selection

The assistant uses google/gemini-3-flash by default for fast, cost-effective responses. You can change to any model supported by AI SDK Gateway:

Customization

Site Name in Responses

The assistant automatically uses your site name in responses. Configure it in nuxt.config.ts:
nuxt.config.ts
The assistant will respond as “the My Documentation assistant” and speak with authority about your specific product.

System Prompt

To customize the AI’s behavior and personality, you can override the system prompt by creating a custom server handler:
server/api/__docus__/assistant.ts

Keyboard Shortcuts

Customize the keyboard shortcut for focusing the floating input:
app.config.ts
Common shortcut formats:
  • meta_i - Cmd+I (Mac) / Ctrl+I (Windows)
  • meta_k - Cmd+K (Mac) / Ctrl+K (Windows)
  • ctrl_shift_p - Ctrl+Shift+P

Custom Icons

Replace the default icons with any Iconify icon:
app.config.ts
Browse available icons at Iconify.

Programmatic Control

Use the useAssistant composable to control the assistant from your components:

Composable API Reference

Disabling Features

Disable Floating Input

app.config.ts

Disable “Explain with AI” Button

app.config.ts

Disable Assistant Entirely

Simply remove the environment variable:
.env
When disabled, all assistant components are replaced with a disabled placeholder component.

Internationalization

All UI text is automatically translated based on the user’s locale. Docus includes built-in translations for English and French. Translated elements:
  • Slideover title and placeholder text
  • Button labels (“Clear chat”, “Close”, “Explain with AI”)
  • Tooltip texts
  • Status messages (“Thinking…”, “Chat is cleared on refresh”)
To add more languages, contribute to the Docus i18n files.

Dependencies

The assistant module requires these packages (automatically installed with Docus):
package.json

Troubleshooting

Assistant not appearing? Check that:
  1. AI_GATEWAY_API_KEY is set in your environment
  2. Your site is running in production mode or has the key in .env
  3. The MCP server is enabled and accessible at the configured path
API key in version control: Never commit your .env file or expose your API key in client-side code. Use environment variables in your deployment platform.

Advanced: Custom Implementation

The assistant module is located in modules/assistant/ and can be customized:
  • Components: runtime/components/ - Vue components for UI
  • Composables: runtime/composables/useAssistant.ts - State management
  • API Handler: runtime/server/api/search.ts - Streaming chat endpoint
  • Types: runtime/types.ts - TypeScript definitions
You can override any component or create a completely custom implementation using the same architecture.