> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up the Agentic Data Stack with Docker Compose

> Run the full agentic data stack (ClickHouse, LibreChat, the MCP server, and Langfuse) via Docker Compose

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

Run the complete Agentic Data Stack locally with Docker Compose to ask questions of your data from the first login. One `docker compose up` command brings up [LibreChat](/products/agentic-data-stack/components/librechat), the [ClickHouse MCP server](/products/agentic-data-stack/components/mcp-server), [ClickHouse](/core/get-started/setup/install), and [Langfuse](/products/agentic-data-stack/components/langfuse) for observability.

<h2 id="prerequisites">
  Prerequisites
</h2>

* **Docker** with the Compose plugin (Compose v2 or later).
* **Git**, to clone the repository.
* A model provider API key (such as OpenAI, Anthropic, or Google). The agent needs a model to answer questions, so supply a key during setup or add one in the LibreChat UI before your first chat.

<h2 id="stand-up-the-stack">
  Stand up the stack
</h2>

<Steps>
  <Step title="Clone the repository">
    ```bash theme={null}
    git clone https://github.com/ClickHouse/agentic-data-stack
    cd agentic-data-stack
    ```

    The repository ships with a top-level `docker-compose.yml`, so the whole stack comes up with a single command. See [Architecture](#how-it-is-wired) for the full list of services.
  </Step>

  <Step title="Run the demo setup script">
    ```bash theme={null}
    ./scripts/prepare-demo.sh
    ```

    This generates a `.env` file with credentials for every service, then offers an interactive menu to configure API keys for a chosen provider. You can also set these keys directly in the `.env` file. Any provider you skip stays set to `user_provided`, so you can add your own key in the LibreChat UI instead.

    On first startup, the stack creates an admin user from `.env`. The default login is `admin@admin.com` / `password`.

    <Accordion title="Set your own login credentials">
      Run `generate-env.sh` with these variables before `prepare-demo.sh`:

      ```bash theme={null}
      USER_EMAIL="you@example.com" USER_PASSWORD="supersecret" USER_NAME="YourName" ./scripts/generate-env.sh
      ```

      `prepare-demo.sh` then sees the existing `.env` and goes straight to API-key configuration.
    </Accordion>
  </Step>

  <Step title="Start the services in the background">
    ```bash theme={null}
    docker compose up -d
    ```

    Startup is ordered automatically. LibreChat boots only after the MCP server is healthy, so its connection to ClickHouse is ready on first load.
  </Step>

  <Step title="Open LibreChat and sign in">
    Once the stack is up, the services are available in your browser:

    * **LibreChat** (chat UI) — [http://localhost:3080](http://localhost:3080)
    * **Langfuse** (observability) — [http://localhost:3000](http://localhost:3000)
    * **Admin Panel** (browser-based LibreChat configuration) — [http://localhost:3081](http://localhost:3081)
    * **MinIO console** (object storage; credentials in `.env`) — [http://localhost:9091](http://localhost:9091)

    Sign in to LibreChat with the admin credentials from your `.env` file.
  </Step>

  <Step title="Select a model">
    A model is selected by default. If you want to change it, open the model selector and choose the one you want to use.

    <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/select-model.png?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=aa090922741963055274ed0f8c1c7d3d" alt="The LibreChat model selector in the top-left corner, showing the default model with a Select a model tooltip" size="md" width="3128" height="1936" data-path="images/agentic-data-stack/select-model.png" />

    If you didn't set a provider key during setup, add one in the UI.

    <Accordion title="Set a provider key in the UI">
      Open the model selector and click **Set API Key** next to the provider.

      <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/set-api-key.png?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=e574401c6dd10508c392eddee3fac920" alt="LibreChat model selector with the Set API Key button next to the Anthropic provider" size="md" width="3128" height="1936" data-path="images/agentic-data-stack/set-api-key.png" />

      Paste your key in the dialog and click **Submit**. You can set an expiration, or keep the key from expiring.

      <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/set-api-key-modal.png?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=228f55c50a43985f35df03bd438411b0" alt="The Set API Key for Anthropic dialog with an expiration dropdown, a Key field, and Submit and Revoke buttons" size="md" width="1350" height="728" data-path="images/agentic-data-stack/set-api-key-modal.png" />
    </Accordion>
  </Step>

  <Step title="Select the MCP server">
    The stack preconfigures its MCP servers in LibreChat's `librechat.yaml`. In the message composer, click **MCP Servers** and select **ClickHouse-Local**.

    Select **ClickHouse-Cloud** instead to use a ClickHouse Cloud service.

    <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/select-clickhouse-local.png?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=1c570ffdcbdec72de51da7bd0e5180f0" alt="The MCP Servers menu open in the LibreChat composer, showing ClickHouse-Local with a green connected dot and ClickHouse-Cloud" size="md" width="2036" height="742" data-path="images/agentic-data-stack/select-clickhouse-local.png" />
  </Step>

  <Step title="Ask your first question">
    For example:

    > What databases and tables are available, and how many rows are in the largest table?

    The agent uses the MCP server's tools to list databases and tables, run read-only queries against ClickHouse, and build an answer from the results. You don't need to write SQL.

    <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/prompt-chat.png?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=8e32b04ffd69ce8b33615664d88f4af0" alt="LibreChat answering the example question by calling the ClickHouse-Local MCP tools and listing the available databases and tables" size="md" width="3838" height="1936" data-path="images/agentic-data-stack/prompt-chat.png" />
  </Step>
</Steps>

<h2 id="stop-or-reset">
  Stop or reset the stack
</h2>

Stop the services without deleting anything:

```bash theme={null}
docker compose down
```

To tear down all containers and wipe every volume for a clean start, use the stack's reset script:

```bash theme={null}
./scripts/reset-all.sh
```

<h2 id="how-it-is-wired">
  Architecture
</h2>

`docker-compose.yml` is a thin entrypoint that includes four Compose files:

| Compose file                 | Defines                                                                      |
| ---------------------------- | ---------------------------------------------------------------------------- |
| `langfuse-compose.yml`       | Langfuse and its backing services (ClickHouse, PostgreSQL, Redis, MinIO)     |
| `clickhouse-mcp-compose.yml` | The ClickHouse MCP server                                                    |
| `librechat-compose.yml`      | LibreChat and its backing services (MongoDB, Meilisearch, pgvector, RAG API) |
| `admin-panel-compose.yml`    | The LibreChat Admin Panel                                                    |

Two details make the single-command startup work:

* **Health checks and start order.** Compose uses health checks to sequence startup. The MCP server waits for ClickHouse, and LibreChat waits for the MCP server.
* **Shared environment file.** The `.env` holds each service's credentials and connection values, set consistently so the services can reach each other. For example, the MCP server connects to ClickHouse with the ClickHouse credentials from `.env`. LibreChat is given `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and `LANGFUSE_BASE_URL`, so every run is traced to Langfuse out of the box.

ClickHouse plays two roles in the stack: it's both Langfuse's storage backend and the database your agent queries through the MCP server.

<h2 id="next-steps">
  Next steps
</h2>

* Learn what each piece does in the stack: [ClickHouse MCP server](/products/agentic-data-stack/components/mcp-server), [LibreChat](/products/agentic-data-stack/components/librechat), and [Langfuse](/products/agentic-data-stack/components/langfuse).
* See the [overview](/products/agentic-data-stack/overview) for how the stack fits together.
* To try the stack against public datasets without installing anything, use [AgentHouse](https://llm.clickhouse.com), the hosted demo.
