Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 7 min read How-to mediumAdept

Agentic BI in Slack: MCP-powered analytics and visualisations

A Slack bot answers analytical questions by having an LLM query ClickHouse through MCP tools, and it now adds charts in about 50 lines of Python. The system prompt asks the model to emit a Vega-Lite JSON spec when a chart is useful, and the bot renders it to PNG with vl-convert and uploads it to the thread alongside a summary and the SQL. The main tradeoffs are that plotted data passes through the LLM's context window, so thousands of points aren't practical, and that charts aren't interactive or brand-styled and every request re-runs the query. Dashboards stay for curated KPIs, while chat handles exploratory questions.

Assumes: LLM tool callingSlack bot developmentSQL basics

Related posts

  • Agentic analytics in Slack with ClickHouse, MCP, and PydanticAI

    ClickHouse mediumAdept

    A Slack bot built with PydanticAI and the Anthropic API answers natural-language analytics questions by querying ClickHouse through the mcp-clickhouse MCP server. The walkthrough covers Slack app setup in Socket Mode (scopes, events, tokens), launching the MCP server on demand via MCPServerStdio (simpler to manage, at some latency cost), configuring the Agent with a system prompt, and handling DMs and mentions with thread history passed as context. Logs show the LLM listing tools, databases and tables before issuing SQL against the public sql.clickhouse.com playground.

  • Building an agentic app with ClickHouse MCP and CopilotKit

    ClickHouse mediumAdept

    A natural-language analytics dashboard for UK property prices can be built by combining an LLM (Claude Sonnet 3.7), the ClickHouse MCP Server and CopilotKit in a Next.js app. The LLM turns a prompt into SQL, CopilotKit's MCP client runs it against ClickHouse over SSE, and the model then calls a `generateChart` action defined with `useCopilotAction` to render the result via ECharts. The walkthrough covers swapping in the Anthropic adapter, running the MCP server with fastmcp, and sharing chart state with `useCopilotReadable`. It recommends a read-only ClickHouse user with restricted databases, quotas and a limited settings profile so the model cannot reach data or run queries beyond what is intended.

  • LLM observability with ClickStack, OpenTelemetry, and MCP

    ClickHouse mediumAdept

    LibreChat (Node.js) and the Python ClickHouse MCP server can be instrumented with OpenTelemetry and shipped to ClickStack (HyperDX UI, OTel collector, ClickHouse) to observe LLM interactions, MCP tool calls and token usage with minimal code changes. Node.js runs under @hyperdx/node-opentelemetry, while Python uses standard opentelemetry-instrument with the API key passed in OTLP headers. Structured JSON logs are written to files and picked up by a separate collector using filelog and Prometheus receivers, with trace/span IDs and conversation IDs parsed out. In HyperDX, prompts can be filtered by log attribute and tied to a TraceId to follow each interaction and its prompt and completion token counts.

  • Building a Chatbot for Hacker News and Stack Overflow with LlamaIndex and ClickHouse

    ClickHouse mediumAdept

    HackBot is a chatbot that answers questions about developer opinions by combining text-to-SQL over the 2021 Stack Overflow survey with vector search over 28m embedded Hacker News comments, both stored in ClickHouse and orchestrated with LlamaIndex, OpenAI and Streamlit. The design routes structured, unstructured and mixed questions through separate query pipelines, with mixed questions using a SQL result to drive a metadata-filtered vector search. Schema choices such as self-descriptive column names and Enum types help the LLM generate correct SQL without extra context. Ordering keys on date, length and score keep filtered vector queries fast.

  • How Fetch built its flexible agentic analytics tool on ClickHouse Cloud

    ClickHouse easyNovice

    Fetch built FAST, a conversational BI agent that lets non-technical sales teams query receipt purchase data in plain language, on ClickHouse Cloud ingesting 150 billion rows (6.5 TB compressed) a day. Ad hoc queries such as same-receipt basket intersections scan hundreds of millions of rows in under a second, and median agent response time is 1.9 seconds across about 500 daily queries. The team picked ClickHouse for its ad hoc query speed, compute isolation between concurrent queries and simple scaling. A nightly pipeline copies data from Snowflake to S3, loads it via ClickPipes into a new versioned wide table, then repoints a view at it. That keeps LLM-generated queries stable and makes rollback trivial, at the cost of skipping incremental loads.

The quest for software engineering knowledge.

Look:
Layout: