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

# Using ClickHouse MCP server with Jan.ai

> This guide explains how to set up Jan.ai with a ClickHouse MCP server.

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

> This guide explains how to use the ClickHouse MCP server with [Jan.ai](https://jan.ai/docs).

<Steps>
  <Step>
    <h2 id="install-janai">
      Install Jan.ai
    </h2>

    Jan.ai is an open source ChatGPT-alternative that runs 100% offline.
    You can download Jan.ai for [Mac](https://jan.ai/docs/desktop/mac), [Windows](https://jan.ai/docs/desktop/windows), or [Linux](https://jan.ai/docs/desktop/linux).

    It's a native app, so once it's downloaded, you can launch it.
  </Step>

  <Step>
    <h2 id="add-llm-to-janai">
      Add LLM to Jan.ai
    </h2>

    We can enabled models via the settings menu.

    To enable OpenAI, we need to provide an API key, as shown below:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/0_janai_openai.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=5b02862bfcac53f125f80257df6cda2d" alt="Enable OpenAI models" size="md" width="938" height="359" data-path="images/use-cases/AI_ML/MCP/0_janai_openai.png" />
  </Step>

  <Step>
    <h2 id="enable-mcp-servers">
      Enable MCP servers
    </h2>

    At the time of writing, MCP servers are an experimental feature in Jan.ai.
    We can enable them by toggling experimental features:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/1_janai_mcp_servers.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=cbb0beb08af1db164cbc64c1a1bbe538" alt="Enable MCP servers" size="md" width="1320" height="325" data-path="images/use-cases/AI_ML/MCP/1_janai_mcp_servers.png" />

    Once that toggle is pressed, we'll see `MCP servers` on the left menu.
  </Step>

  <Step>
    <h2 id="configure-clickhouse-mcp-server">
      Configure ClickHouse MCP server
    </h2>

    If we click on the `MCP servers` menu, we'll see a list of MCP servers that we can connect to:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/2_janai_mcp_servers_list.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=43c002ec138ea8149766122279ba8cb8" alt="MCP servers list" size="md" width="1061" height="793" data-path="images/use-cases/AI_ML/MCP/2_janai_mcp_servers_list.png" />

    There servers are all disabled by default, but we can able them by clicking the toggle.

    To install the ClickHouse MCP server, we need to click on the `+` icon and then populate the form with the following:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/3_janai_add_mcp_server.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=9709f72ef5b2d16eb448eca6b068e4cd" alt="Add MCP server" size="md" width="543" height="551" data-path="images/use-cases/AI_ML/MCP/3_janai_add_mcp_server.png" />

    Once we've done that, we'll need to toggle the ClickHouse Server if it's not already toggled:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/4_janai_toggle.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=741674918fe32146ffe6832033302005" alt="Enable MCP server" size="md" width="759" height="147" data-path="images/use-cases/AI_ML/MCP/4_janai_toggle.png" />

    The ClickHouse MCP server's tools will now be visible on the chat dialog:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/5_jani_tools.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=acfabc8d340898944c6f408cee0376f9" alt="ClickHouse MCP server tools" size="md" width="625" height="367" data-path="images/use-cases/AI_ML/MCP/5_jani_tools.png" />
  </Step>

  <Step>
    <h2 id="chat-to-clickhouse-mcp-server">
      Chat to ClickHouse MCP server with Jan.ai
    </h2>

    It's time to have a conversation about some data stored in ClickHouse!
    Let's ask a question:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/6_janai_question.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=7c5deb0f39d92f7153609ea12c037e20" alt="Question" size="md" width="830" height="183" data-path="images/use-cases/AI_ML/MCP/6_janai_question.png" />

    Jan.ai will ask confirmation before calling a tool:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/7_janai_tool_confirmation.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=7f82527000a02dc3ca573c8305439239" alt="Tool confirmation" size="md" width="538" height="274" data-path="images/use-cases/AI_ML/MCP/7_janai_tool_confirmation.png" />

    It will then show us the list of tool calls that were made:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/8_janai_tools_called.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=e533469999c1fc5fbe4538c88de3b098" alt="Tools called" size="md" width="1174" height="577" data-path="images/use-cases/AI_ML/MCP/8_janai_tools_called.png" />

    If we click on the tool call, we can see the details of the call:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/9_janai_tools_called_expanded.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=6552f6cced89b908c03824d8b02d8231" alt="Tools called expanded" size="md" width="1139" height="1418" data-path="images/use-cases/AI_ML/MCP/9_janai_tools_called_expanded.png" />

    And then underneath, we have our result:

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-55d9d317/NbJ5yM7BEGPbYTkJ/images/use-cases/AI_ML/MCP/10_janai_result.png?fit=max&auto=format&n=NbJ5yM7BEGPbYTkJ&q=85&s=823365094e7d225d9289c0da7c11e19c" alt="Result" size="md" width="1122" height="679" data-path="images/use-cases/AI_ML/MCP/10_janai_result.png" />
  </Step>
</Steps>
