Skip to main content
In this guide you’ll learn how to build a CrewAI AI agent that can interact with ClickHouse’s SQL playground using ClickHouse’s MCP server.
Example notebookThis example can be found as a notebook in the examples repository.

Prerequisites

  • You’ll need to have Python installed on your system.
  • You’ll need to have pip installed on your system.
  • You’ll need an OpenAI API key
You can run the following steps either from your Python REPL or via script.
1

Install libraries

Install the CrewAI library by running the following commands:
2

Setup credentials

Next, you’ll need to provide your OpenAI API key:
Response
Next, define the credentials needed to connect to the ClickHouse SQL playground:
3

Initialize MCP server and CrewAI agent

Now configure the ClickHouse MCP server to point at the ClickHouse SQL playground and also initialize our agent and ask it a question:
Response
Last modified on June 19, 2026