---
doc_version: "1.0.0"
last_updated: "2026-12-03T07:47:56.061Z"
title: "Tutorial: Add an AI Chatbot to Your Docs Site with Claude Code or Cursor"
description: "Add an AI chatbot to a docs-as-code site (Docusaurus, MkDocs, Starlight, VitePress, Mintlify or Next.js) with your coding agent. Index the site, let Claude Code or Cursor add the widget to your repo, connect the agent to your docs over MCP, and fix the pages users struggle with in the same repo."
keywords: [docs chatbot, add AI chatbot to documentation, Docusaurus chatbot, MkDocs chatbot, Starlight chatbot, VitePress chatbot, Mintlify chatbot, Claude Code, Cursor, coding agent, MCP, docs as code, tutorial, ChatbotIQ]
---

In this tutorial, you'll add an AI chatbot to a documentation site that you build from a Git repository, and let your coding agent (Claude Code, Cursor or a similar tool) do the work in the repo. By the end, visitors can ask a question on any page and get an answer from your documentation with a link to the page it came from. Your agent can also search the same documentation and fix the pages that users struggle with.

ChatbotIQ is a European platform that turns your help center, documentation, or website into an AI assistant. It answers only from your content, links to its sources, and says so when your content doesn't cover a question.

:::tip[Follow along in your own account]
[Start your free 14-day trial](https://app.chatbotiq.eu/register?plan=standard&intent=trial). No credit card needed, and the trial includes everything this tutorial uses. Prefer not to do it yourself? [We can prepare the assistant for you](https://chatbotiq.eu/#prepare).
:::

**Scenario:** Your documentation lives in a Git repository and is built with a static site generator such as Docusaurus, MkDocs, Astro Starlight, VitePress, Mintlify or Next.js. You already use a coding agent in that repository. You want an "Ask AI" assistant on the published site without writing the integration yourself, and you want to know which questions the documentation doesn't answer.

**Time needed:** About 20 minutes. Indexing runs in the background.

**What you'll need:**
- Your docs site published at a public address
- The repository, and a way to run the site locally
- A coding agent with access to the repository, such as Claude Code or Cursor

**Who does what:**

| Step | Who | Where |
|---|---|---|
| Sign up, index the site, create the bot | You | ChatbotIQ dashboard |
| Add the widget and run the site locally | Your coding agent | Your docs repository |
| Search the docs while writing code or docs | Your coding agent | Your bot's MCP server |
| Fix the pages users struggle with | Your coding agent | Insights MCP server and your repository |

---

## Step 1: Index your docs site

1. Go to **Knowledge Base** → **"+ Add Source"** → **Website**.
2. Enter the address of your published docs (e.g., `https://docs.yourproduct.com`).
3. Keep **Sitemap Discovery**. Docusaurus, MkDocs, Mintlify and most other generators publish a `sitemap.xml`, so discovery takes seconds. If your site has no sitemap, use **Link Crawling** instead.
4. **On Mintlify** (and GitBook or Scroll Sites), open **Advanced Options** → **Performance** and turn on **Simple Mode**. These platforms publish a [markdown version of each page](/reference/crawling-settings/#markdown-versions-of-your-pages), and ChatbotIQ reads that instead, so the crawl is much faster.
5. Click **Start Discovery**, review the pages it found, and click **Start Crawling**.

> **Versioned docs?** Each version of a page counts as a separate page toward your plan's page limit. If your readers only use the current version, deselect the older ones before you crawl. See [Configure Crawling for Your Site](/how-to/configure-crawling-for-your-site/).

---

## Step 2: Create the documentation bot

1. Go to **Bots** → **"Create Bot"**.
2. **Basic Info:** Name it (for example "Docs Assistant") and choose **Technical Documentation** as the bot type. It is tuned for precise, citation-rich answers.
3. **Sources:** Select the source from Step 1.
4. **Model:** GPT-6.1 Terra (the recommended default) suits most documentation.
5. **Behavior:** Paste this template into **Base Prompt** and customize it:

```
You are the documentation assistant for [Product Name].

Guidelines:
- Give step-by-step instructions when the user asks how to do something
- Include a short code example when the documentation has one
- If the user's version or setup matters and they have not said which one they use, ask
```

6. Review the summary and click **Create Bot**. You land in the Playground.

Ask it five questions your users actually ask, plus one your docs don't cover. The bot should answer the first five with links to the right pages and say plainly that it doesn't know the last one.

---

## Step 3: Make the bot public and copy the code

1. In the bot's **Settings** → **Advanced**, set **Privacy** to **Public**.
2. Under **Allowed Domains**, add your docs domain (e.g., `docs.yourproduct.com`) so the bot can't be embedded elsewhere. Add `localhost` too while you test; it covers every local port. If your dev server runs on `127.0.0.1` (MkDocs does by default), add that as well. Remove both once the site is live.
3. Switch to the **Deploy** tab, open **Website widget**, and scroll to **Advanced Options**. Copy the **JavaScript-only embed code**. It is easier for an agent to place than the HTML code at the top, because every docs generator can load a JavaScript file on all pages.

---

## Step 4: Let your coding agent add the widget

Open your coding agent in the docs repository and give it this prompt. Replace the code block with the code you copied; your bot ID is already filled in there.

````text
Add the ChatbotIQ chat widget to this documentation site.

This is the widget code:

```js
window.__chatbotiq = {
  botId: 'YOUR-BOT-ID',
  domain: 'www.chatbotiq.eu',
  apiBase: 'https://app.chatbotiq.eu',
};

var s = document.createElement('script');
s.src = 'https://www.chatbotiq.eu/embedded.js';
s.async = true;
document.head.appendChild(s);
```

Requirements:
- Put the code in its own file and load it on every page with this site's own
  mechanism (a config option, theme override or layout). Do not edit build output.
- Load it once per visit: moving between pages must not load it again or remove
  the chat launcher.
- If the site sets a Content-Security-Policy, allow what the widget needs and
  tell me exactly what you changed.
- Change nothing else.
- Start the local dev server and tell me which URL to open.
````

This is where the code usually ends up, so you can check the agent's change:

| Docs generator | Where the script is loaded |
|---|---|
| Docusaurus | `scripts` in `docusaurus.config.js`, pointing at a file in `static/` |
| MkDocs (including Material for MkDocs) | `extra_javascript` in `mkdocs.yml`, pointing at a file in `docs/` |
| Astro Starlight | the `head` option of the Starlight integration in `astro.config.mjs` |
| VitePress | `head` in `.vitepress/config` |
| Mintlify | a `.js` file in the docs content directory, which Mintlify includes on every page |
| Next.js, Nextra | a `next/script` tag in the root layout |

Review the diff before you accept it. The change should be a new script file and a few lines of configuration.

---

## Step 5: Check it, then publish

1. Open the URL the agent gave you. The launcher appears in the bottom-right corner.
2. Ask a question, then click a link in the answer. Move to another page: there should still be exactly one launcher.
3. If the launcher doesn't appear, open the browser console (F12 → Console) and look for `[ChatbotIQ]` messages or blocked requests. Paste them into your agent's chat; it can fix most of them. See also [Troubleshooting](/troubleshooting/).
4. Commit and deploy the way you usually publish your docs.
5. Open the live site with a hard refresh (Ctrl+Shift+R or Cmd+Shift+R) and check the launcher once more. Then remove `localhost` and `127.0.0.1` from **Allowed Domains**.

> **Preview deployments** (for example on Vercel or Netlify) run on a different domain. Add that exact domain to **Allowed Domains** if you want to test there.

To match the widget to your site's colors, see [Match Your Widget to Your Brand](/tutorials/customize-your-widget/).

---

## Step 6: Give your agent the same documentation

Your bot is also an MCP server. Connect it to your coding agent and the agent can search your published documentation the same way the bot does, for example to check how a feature is documented before it changes the code, or, once a new page is published and the source has re-synced, whether the bot finds it.

1. In the Playground, open the **Deploy** tab and pick **AI assistants**.
2. Choose **With API Key** and copy the key. It is shown once.
3. Add the server to Claude Code:

```bash
claude mcp add --transport http chatbotiq-docs \
  https://app.chatbotiq.eu/v1/mcp/bots/<bot-id>/mcp \
  --header "Authorization: Bearer mcpk_your_api_key_here"
```

For Cursor, VS Code and other tools, see [Connect via MCP](/how-to/set-up-mcp-integration/).

With an API key, the agent also gets a `submit_feedback` tool. When it finds a passage that is wrong or outdated, it can report it, and the report lands in your doc issues (Step 7).

---

## Step 7: Fix the pages users struggle with

Every question the bot can't answer, and every answer that gets a thumbs-down, points at a page that is missing, outdated or unclear. ChatbotIQ collects them under **Analytics** → **Doc issues**: one issue per problem, with the questions behind it and, when known, the page and section to change.

Because your documentation is a repository, your coding agent can fix those pages itself. Connect the **Insights MCP server**, which gives the agent your workspace's doc issues:

1. Open **Analytics** → **Docs Insights** and, under **Connect your AI assistant**, copy the endpoint from the Claude Code tab.
2. Add it and sign in:

```bash
claude mcp add --transport http --scope user chatbotiq-insights \
  https://app.chatbotiq.eu/v1/mcp/workspaces/<workspace-id>/mcp
```

3. Start Claude Code (`claude`), run `/mcp`, pick `chatbotiq-insights` and sign in when the browser opens. Owners and admins can tick write access on the approval page; the agent needs it to close issues.

Then ask:

> Take the oldest open doc issue, find the file in this repository for the page it points to, and draft the change. Don't commit yet.

Read the draft. The agent tells you when a fact has to come from someone who knows the product instead of being made up. When you have published the fix, ask it to close the issue with the page's URL and re-sync the source. If users keep asking about the topic, the issue reopens on its own.

Using Claude Code inside the Claude desktop app, or Cursor? See [Close the Documentation Feedback Loop](/how-to/close-the-documentation-feedback-loop/) for the sign-in steps, and [Work Through Doc Issues](/how-to/work-through-doc-issues/) for assigning issues to the people who own each part of the docs.

---

## Keep it current

On the Standard plan and above, sources re-crawl automatically, and only pages that changed are indexed again. To pick up a change right away, click **Update** on the source in **Knowledge Base**, or ask your agent to re-sync it through the Insights MCP server. See [Keep Content Up to Date](/how-to/refresh-and-maintain-sources/).

---

## Ready to try it on your docs?

[Start your free 14-day trial](https://app.chatbotiq.eu/register?plan=standard&intent=trial) and have an assistant answering from your documentation in about 20 minutes. No credit card needed.

Short on time? [Send us your docs address](https://chatbotiq.eu/#prepare) and we'll prepare the assistant for you.

---

## Related

- [Embed the Widget](/how-to/embed-the-widget/) - the standard HTML embed and allowed domains
- [Connect via MCP](/how-to/set-up-mcp-integration/) - connect Cursor, VS Code, Windsurf and ChatGPT to your bot
- [Close the Documentation Feedback Loop](/how-to/close-the-documentation-feedback-loop/) - the Insights MCP server in detail
- [Work Through Doc Issues](/how-to/work-through-doc-issues/) - assign and fix what the documentation is missing
- [Configure Crawling for Your Site](/how-to/configure-crawling-for-your-site/) - tune the crawl for your docs generator

## Sitemap

Full documentation index: [sitemap.md](/sitemap.md) and [llms.txt](/llms.txt).
