options = ClaudeAgentOptions(
allowed_tools=[
"mcp__mcp-clickhouse__list_databases",
"mcp__mcp-clickhouse__list_tables",
"mcp__mcp-clickhouse__run_select_query",
"mcp__mcp-clickhouse__run_chdb_select_query"
],
mcp_servers={
"mcp-clickhouse": {
"command": "uv",
"args": [
"run",
"--with", "mcp-clickhouse",
"--python", "3.10",
"mcp-clickhouse"
],
"env": env
}
}
)
async for message in query(prompt="告诉我一些关于英国房产交易的有趣信息", options=options):
if isinstance(message, AssistantMessage):
for block in message.content:
if isinstance(block, TextBlock):
print(f"🤖 {block.text}")
if isinstance(block, ToolUseBlock):
print(f"🛠️ {block.name} {block.input}")
elif isinstance(message, UserMessage):
for block in message.content:
if isinstance(block, TextBlock):
print(block.text)