Skip to main content

Ask AI assistant widget for Fumadocs

Add an AI assistant or AI search widget to your Fumadocs site using Biel.ai's React components. You can also connect AI agents through MCP, with or without installing the widget.

Prerequisites​

Add the assistant widget​

Assistant widget for docs

  1. Install Biel.ai for React:

    npm install biel-react biel-search
  2. Create a client component at components/BielWidget.tsx. Start the file with 'use client':

    'use client';

    import { useEffect } from 'react';
    import { BielButton } from 'biel-react';
    import bielPackage from 'biel-search/package.json';

    export default function BielWidget() {
    useEffect(() => {
    if (!document.querySelector('script[data-biel]')) {
    const script = document.createElement('script');
    script.type = 'module';
    script.src = `https://cdn.jsdelivr.net/npm/biel-search@${bielPackage.version}/dist/biel-search/biel-search.esm.js`;
    script.dataset.biel = '';
    document.head.appendChild(script);
    }
    }, []);

    return (
    <BielButton
    project="<YOUR_PROJECT_ID>"
    header-title="Biel.ai assistant"
    button-position="bottom-right"
    modal-position="bottom-right"
    button-style="dark"
    >
    Ask AI
    </BielButton>
    );
    }

    Replace <YOUR_PROJECT_ID> with your project's ID from the Biel.ai dashboard.

  3. In your existing app/layout.tsx, import the client component and widget stylesheet:

    import BielWidget from '@/components/BielWidget';
    import 'biel-search/dist/biel-search/biel-search.css';

    Render <BielWidget /> inside your existing <body>, alongside RootProvider. Keep the root layout's HTML, fonts, metadata, and existing content. See Next.js Server and Client Components for client boundaries.

  4. Run npm run dev, open your site, and send a test question.

Add the search widget​

  1. Install biel-react:

    npm install biel-react biel-search
  2. Create components/BielSearch.tsx:

    'use client';

    import { useEffect } from 'react';
    import { BielSearchButton } from 'biel-react';
    import bielPackage from 'biel-search/package.json';

    export default function BielSearch() {
    useEffect(() => {
    if (!document.querySelector('script[data-biel]')) {
    const script = document.createElement('script');
    script.type = 'module';
    script.src = `https://cdn.jsdelivr.net/npm/biel-search@${bielPackage.version}/dist/biel-search/biel-search.esm.js`;
    script.dataset.biel = '';
    document.head.appendChild(script);
    }
    }, []);

    return (
    <BielSearchButton project="<YOUR_PROJECT_ID>" button-style="rounded">
    Search
    </BielSearchButton>
    );
    }

    Replace <YOUR_PROJECT_ID> with your project ID.

  3. For Fumadocs UI 16, create components/BielDocsLayout.tsx to replace both search triggers:

    'use client';

    import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
    import BielSearch from './BielSearch';

    export default function BielDocsLayout(props: DocsLayoutProps) {
    return (
    <DocsLayout
    {...props}
    slots={{
    ...props.slots,
    searchTrigger: { sm: BielSearch, full: BielSearch },
    }}
    />
    );
    }
  4. In your docs layout, use BielDocsLayout in place of DocsLayout, keeping the existing page tree and options. In the root layout, import the stylesheet and disable the built-in search dialog on your existing RootProvider:

    import 'biel-search/dist/biel-search/biel-search.css';

    <RootProvider search={{ enabled: false }}>{children}</RootProvider>
  5. Run npm run dev. Test Search in the sidebar and the mobile header. For other Fumadocs versions, render <BielSearch /> in your own header or follow the framework’s layout customization guide.

Connect AI agents with MCP​

Let AI tools search and read your indexed documentation. MCP is available on every plan and during your trial.

  1. In the Biel.ai dashboard, open your project’s Settings > MCP.
  2. Select Enable MCP server and click Save.
  3. In the widget, open Connect via MCP using the <> button. Select your AI client or choose MCP URL to copy the endpoint into its settings.

Without the widget: after enabling MCP, copy MCP endpoint from Settings > MCP and add it to your AI client. No widget installation or website changes are required.

The widget also exposes WebMCP tools to compatible browser agents visiting your site. Use the latest widget release and keep Enable WebMCP selected in Settings > MCP.

Next steps​