otheroauth2

ClickHouse

ClickHouse is a fast open-source column-oriented database management system for real-time analytics and big data processing with SQL support

Verdict

The ClickHouse MCP connects your team's AI to your ClickHouse analytics database. @Mention it to run SQL queries, inspect schemas, and pull aggregated data without leaving your conversation. Analysts can prototype queries in chat before committing them to dashboards. Engineers can debug table structures or row counts on the fly. The AI sees your database layout—tables, columns, types—so it can write correct SQL from natural language. You'll grant read access during OAuth setup; write operations aren't exposed. Best for teams already running ClickHouse who want faster ad-hoc analysis.

Common use cases

  • Pull weekly active user counts from chat
  • Debug slow queries by inspecting table schemas
  • Generate executive summaries from event logs
  • Validate data pipeline outputs during standups
  • Prototype dashboard queries before committing code

Integration

Vendor
ClickHouse
Category
other
Auth
OAUTH2
Tools
5
Composio slug
clickhouse

Tools

  • Execute ClickHouse Query

    Execute a sql query in clickhouse and return the results. this is the primary action for querying data from clickhouse databases.

  • Get Database Schema

    Get comprehensive schema overview of an entire database including all tables and optionally their column definitions. essential for ai agents to understand the complete database structure in a single call.

  • Get Table Schema

    Get detailed schema information for a specific table including column definitions, types, keys, and optionally sample data. this is essential for ai agents to understand table structure before constructing queries.

  • List ClickHouse Databases

    List all databases in the clickhouse instance. useful for discovering available databases before querying tables.

  • List ClickHouse Tables

    List tables in clickhouse databases. returns information about tables including their engine, size, and row count.

Setup

Setup guide

  1. 11. Open your Switchy workspace and navigate to Settings > Integrations > Browse MCP Servers. 2. Search for ClickHouse and click Connect. 3. You'll be redirected to ClickHouse Cloud to authorize the connection—sign in with your ClickHouse account. 4. Grant read-only access to the databases you want the AI to query (you can scope this to specific databases or allow all). 5. After authorization, you'll return to Switchy and see ClickHouse listed as connected. 6. Open any Space and type '@ClickHouse list databases' to confirm the connection works—you should see your database names appear. 7. To run a query, @mention ClickHouse and describe what you need: '@ClickHouse show me the top 10 users by event count this week'. 8. The AI will inspect your schema, write the SQL, execute it, and return results inline.

What teammates see: by default, memories from ClickHouse are scoped to the Space (PROJECT visibility) - you can mark any memory PRIVATE or share it ORG-wide.

Works well with

Top models

Compatibility data appears once enough Spaces have used this MCP together with a given model.

How Switchy teams use it

Not enough Spaces yet to publish anonymised usage stats (we require ≥ 50 Spaces per week).

Starter prompts

Top Events This Week

@ClickHouse show me the top 20 event types by count from the events table in the last 7 days, grouped by event name
Open in a Space →

Schema Overview

@ClickHouse get the complete schema for the analytics database including all tables and their column definitions
Open in a Space →

User Retention Cohort

@ClickHouse calculate weekly retention for users who signed up in January 2025, showing how many returned each week
Open in a Space →

Table Size Audit

@ClickHouse list all tables in the production database with their row counts and disk sizes, sorted by size descending
Open in a Space →

Daily Active Users Trend

@ClickHouse show me daily active user counts for the last 30 days from the user_sessions table, one row per day
Open in a Space →

Example outputs

Illustrative - representative of the model's voice and quality, not literal recordings.

Prompt

@ClickHouse show me the schema for the events table in the analytics database, including a few sample rows so I can understand the data structure

Output

The `analytics.events` table has 8 columns: `event_id` (UUID), `user_id` (UInt64), `event_type` (String), `timestamp` (DateTime), `properties` (String as JSON), `session_id` (String), `device_type` (Enum8), and `country_code` (FixedString(2)). The table uses the MergeTree engine partitioned by toYYYYMM(timestamp) and ordered by (user_id, timestamp). Sample data shows events like 'page_view', 'button_click', and 'purchase' with timestamps from the last 24 hours. Total row count: 847M rows, compressed size: 12.3 GB.

Notes

This example demonstrates schema introspection with sample data, which helps the AI construct accurate queries without guessing column names or types. Requires read access to the target database. Sample data is limited to a few rows to avoid overwhelming the context window with large result sets.

Prompt

@ClickHouse run a query to find the top 10 countries by user signups in the last 7 days, grouped by day, from the users table

Output

Query executed successfully in 0.34 seconds. Results show the United States leading with 3,847 signups (peak on March 15 with 612), followed by United Kingdom (1,923), Germany (1,456), France (1,203), and Canada (1,087). Daily trends indicate a 23% week-over-week increase in US signups, while European countries show steadier growth around 8-12%. The query scanned 2.1M rows and returned 70 result rows (10 countries × 7 days).

Notes

This showcases ClickHouse's strength in analytical queries over large datasets with fast aggregation. The AI translated natural language into optimized SQL with proper date filtering and grouping. Be aware that complex queries on very large tables may hit execution timeouts—consider adding LIMIT clauses or narrower time windows for exploratory queries.

Prompt

@ClickHouse analyze our page load performance: calculate the median, 95th percentile, and 99th percentile load times by device type for the past 30 days, and tell me which segments need attention

Output

Performance analysis complete. Desktop users see median load time of 1.2s (p95: 3.1s, p99: 5.8s). Mobile users show median 2.4s (p95: 6.7s, p99: 11.2s). Tablet users median 1.8s (p95: 4.9s, p99: 8.3s). The data reveals mobile users experience 2× slower median loads and significantly worse tail latency. The p99 for mobile (11.2s) suggests ~1% of mobile sessions face severe performance issues—likely correlated with older devices or poor network conditions based on the distribution shape. Recommend investigating mobile-specific optimizations and considering separate performance budgets per device class.

Notes

This example pairs ClickHouse's quantile functions with AI reasoning to surface actionable insights from raw performance data. The AI constructs statistically appropriate queries (using quantileExact or quantileTiming functions) and interprets the results in business context. Requires the MCP to have access to tables with timestamp and performance metric columns.

Use-case deep-dives

Product analytics sprint review

When ClickHouse MCP beats manual SQL for weekly metrics

A 6-person product team runs weekly sprint reviews where they pull user funnel metrics, feature adoption rates, and performance benchmarks from ClickHouse. Without this MCP, someone writes SQL in the ClickHouse console, exports CSVs, and pastes numbers into slides. With the MCP, the team asks Switchy to pull last week's conversion rates or compare feature usage across cohorts—Switchy executes the query, formats the results, and drops them into the shared workspace in under 10 seconds. The trade-off: if your queries need custom UDFs or complex window functions that require iterative tuning, you'll still want a SQL IDE open. But for standard aggregations and time-series pulls during live meetings, this MCP eliminates the context-switch tax. Worth it if your team references ClickHouse data more than twice a week.

Customer support incident triage

Using ClickHouse MCP to surface error patterns in real time

A 3-person support team at a SaaS company uses ClickHouse to log API errors and user events. When a customer reports a bug, the team needs to check if it's isolated or part of a broader pattern—usually by asking engineering to run queries. With this MCP in Switchy, support can ask 'show me all 500 errors for customer X in the last 48 hours' or 'count failed logins by endpoint today' without leaving the ticket thread. The MCP lists databases, pulls table schemas, and executes the query in one pass. The limit: if your ClickHouse instance has 200+ tables or requires VPN access, OAuth2 setup gets fiddly and schema discovery slows down. Best fit for teams with under 50 tables who need ad-hoc log queries multiple times per day.

Marketing campaign performance check

When ClickHouse MCP replaces dashboard fatigue for small teams

A 4-person growth team runs paid campaigns across three channels and stores event data in ClickHouse. They have dashboards, but answering one-off questions—'did iOS conversions drop after yesterday's push?'—means waiting for a data analyst or building a new chart. With this MCP, the team asks Switchy to query campaign performance by device, compare week-over-week spend efficiency, or pull attribution breakdowns on demand. The MCP handles schema lookups and query execution in seconds, so the team gets answers in Slack instead of waiting for dashboard updates. The boundary: if your campaigns generate more than 10 million events per day, query latency spikes and you'll want pre-aggregated tables. This MCP shines for teams under 5 people who need flexible, conversational access to campaign data without hiring a BI engineer.

Frequently asked

What does the ClickHouse MCP do in Switchy?

It lets your team query ClickHouse databases directly from Switchy's AI workspace. You can execute SQL queries, inspect table schemas, list databases and tables, and pull sample data — all without switching to a separate SQL client. Useful when your analytics data lives in ClickHouse and you want AI agents to answer questions about it.

Do I need admin access to connect ClickHouse via OAuth?

You need a ClickHouse Cloud account with OAuth enabled and sufficient permissions to read schemas and execute queries on the databases you want to expose. The OAuth flow requests read access to your instance metadata and query execution rights. If your ClickHouse deployment is self-hosted without OAuth configured, this MCP won't work.

Can the ClickHouse MCP write data or modify tables?

Yes, the Execute Query tool runs arbitrary SQL, including INSERT, UPDATE, DELETE, and DDL statements like CREATE TABLE. The MCP doesn't artificially restrict write operations — it mirrors whatever permissions your OAuth token grants. If you only want read access, configure your ClickHouse user roles accordingly before connecting.

Why use this instead of querying ClickHouse directly in my code?

Direct queries require you to write SQL, handle connection pooling, and parse results. This MCP gives AI agents schema introspection and query execution in one interface, so they can answer natural-language questions about your data without you writing boilerplate. Trade-off: you lose fine-grained control over query optimisation and connection settings.

Who on the team should connect the ClickHouse integration?

Whoever owns your ClickHouse Cloud account or has OAuth credentials with the right database permissions. Once connected in Switchy, any team member with workspace access can ask questions that trigger queries. The connection itself is workspace-scoped, not per-user, so one person sets it up for everyone.

Data last verified 607 hours ago.Sources aggregated hourly to weekly. See docs/architecture/model-directory.md.