Skip to main content

Ask AI assistant widget for Gatsby

Add an AI assistant or AI search widget to your Gatsby site. 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 the Biel.ai package:

    npm install biel-react biel-search
    Info

    For Yarn, use yarn add biel-react biel-search.

  2. In the main component where you wish to place the assistant (often src/pages/index.js), embed the Biel.ai button:

    import React, { useEffect } from 'react';

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

    const IndexPage = () => {

    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 (
    <div className="page-layout">
    {/* Other components and content */}
    <BielButton project="<YOUR_PROJECT_ID>"
    header-title="Biel.ai assistant"
    button-position="bottom-right"
    modal-position="bottom-right"
    button-style="dark">Ask AI
    </BielButton>
    </div>
    );
    }

    export default IndexPage;

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

  3. Run gatsby develop, open your site, and send a test question.

Add the search widget​

  1. Install biel-react:

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

    import React, { 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. Import the stylesheet in gatsby-browser.js:

    import 'biel-search/dist/biel-search/biel-search.css';
  4. Import and render <BielSearch /> in your shared header or layout. Run gatsby develop, open Search, and check a documentation query. Run gatsby build before publishing to verify the production build.

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​