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

# 将 ClickHouse MCP 服务器与 Jan.ai 搭配使用

> 本指南介绍如何为 Jan.ai 配置 ClickHouse MCP 服务器。

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

> 本指南介绍如何将 ClickHouse MCP 服务器与 [Jan.ai](https://jan.ai/docs) 搭配使用。

<Steps>
  <Step>
    ## 安装 Jan.ai

    Jan.ai 是一款开源的 ChatGPT 替代方案，可 100% 离线运行。
    你可以下载适用于 [Mac](https://jan.ai/docs/desktop/mac)、[Windows](https://jan.ai/docs/desktop/windows) 或 [Linux](https://jan.ai/docs/desktop/linux) 的 Jan.ai。

    它是一款原生应用，因此下载后即可启动。
  </Step>

  <Step>
    ## 将 LLM 添加到 Jan.ai

    我们可以通过设置菜单启用模型。

    要启用 OpenAI，我们需要提供一个 API key，如下所示：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/0_janai_openai.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=48f51576cfffec995a0a1e99ec848363" alt="启用 OpenAI 模型" size="md" width="938" height="359" data-path="images/use-cases/AI_ML/MCP/0_janai_openai.png" />
  </Step>

  <Step>
    ## 启用 MCP servers

    在撰写本文时，`MCP servers` 是 Jan.ai 中的一项 Experimental 功能。
    我们可以通过打开 experimental features 来启用它们：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/1_janai_mcp_servers.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=9103c16a74430db953cee6d12187ac5b" alt="启用 MCP servers" size="md" width="1320" height="325" data-path="images/use-cases/AI_ML/MCP/1_janai_mcp_servers.png" />

    打开该开关后，我们会在左侧菜单中看到 `MCP servers`。
  </Step>

  <Step>
    ## 配置 ClickHouse MCP 服务器

    如果我们点击 `MCP servers` 菜单，就会看到一个可连接的 MCP servers 列表：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/2_janai_mcp_servers_list.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=a5fb2a6a97cdb15fe0ce8c0b3df37e4c" alt="MCP servers 列表" size="md" width="1061" height="793" data-path="images/use-cases/AI_ML/MCP/2_janai_mcp_servers_list.png" />

    这些服务器默认都是禁用的，但我们可以通过点击开关来启用它们。

    要安装 ClickHouse MCP 服务器，我们需要点击 `+` 图标，然后用以下内容填写表单：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/3_janai_add_mcp_server.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=eb798e041a1e54be0295cda98c09fcd5" alt="添加 MCP server" size="md" width="543" height="551" data-path="images/use-cases/AI_ML/MCP/3_janai_add_mcp_server.png" />

    完成后，如果 ClickHouse Server 尚未开启，我们需要将其切换为开启状态：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/4_janai_toggle.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=62cd9add6c98d75f9e7bf04c26023591" alt="启用 MCP server" size="md" width="759" height="147" data-path="images/use-cases/AI_ML/MCP/4_janai_toggle.png" />

    现在，ClickHouse MCP 服务器的工具将显示在聊天对话中：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/5_jani_tools.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=762fad1d9b274ec0fe8931158afb2056" alt="ClickHouse MCP 服务器工具" size="md" width="625" height="367" data-path="images/use-cases/AI_ML/MCP/5_jani_tools.png" />
  </Step>

  <Step>
    ## 使用 Jan.ai 与 ClickHouse MCP 服务器聊天

    现在可以开始围绕存储在 ClickHouse 中的数据展开对话了！
    让我们先提出一个问题：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/6_janai_question.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=206c2b611e7d90b99bf1b2d41b1fac94" alt="问题" size="md" width="830" height="183" data-path="images/use-cases/AI_ML/MCP/6_janai_question.png" />

    Jan.ai 在调用工具前会先请求确认：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/7_janai_tool_confirmation.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=03f1a75886709873e3b97a0c80121e11" alt="工具确认" size="md" width="538" height="274" data-path="images/use-cases/AI_ML/MCP/7_janai_tool_confirmation.png" />

    然后，它会显示已发起的工具调用列表：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/8_janai_tools_called.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=c2b1e845f9d536be6797c691c946c2a0" alt="已调用的工具" size="md" width="1174" height="577" data-path="images/use-cases/AI_ML/MCP/8_janai_tools_called.png" />

    如果我们点击某个工具调用，就可以看到该调用的详细信息：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/9_janai_tools_called_expanded.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=e12ff8f5dab1edd7983480a1bac6cc48" alt="已展开的工具调用" size="md" width="1139" height="1418" data-path="images/use-cases/AI_ML/MCP/9_janai_tools_called_expanded.png" />

    然后在下方，我们会看到结果：

    <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8c05c8a2/elHO3NI0U6chx0rg/images/use-cases/AI_ML/MCP/10_janai_result.png?fit=max&auto=format&n=elHO3NI0U6chx0rg&q=85&s=680c0bc33643659cd9569ac55beab301" alt="结果" size="md" width="1122" height="679" data-path="images/use-cases/AI_ML/MCP/10_janai_result.png" />
  </Step>
</Steps>
