How to build an AI Agent with Claude Agent SDK and the ClickHouse MCP Server
In this guide you'll learn how to build a Claude Agent SDK AI agent that can interact with ClickHouse's SQL playground using ClickHouse's MCP Server.
Example notebook
This 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 Anthropic API key
You can run the following steps either from your Python REPL or via script.
Setup credentials
Next, you'll need to provide your Anthropic API key:
Next, define the credentials needed to connect to the ClickHouse SQL playground:
Initialize MCP Server and Claude Agent SDK agent
Now configure the ClickHouse MCP Server to point at the ClickHouse SQL playground and also initialize our agent and ask it a question:
Note the code inside the for
block is filtering the output for brevity.