ClickHouse MCP Server
for AI Agents
Connect your AI agent to StackOne's ClickHouse MCP server and give it 172 MCP tools out of the box. Auth, tool execution, and security all managed.
Coverage
172 Agent Actions
Agents can read, write, delete and run operations in ClickHouse. Extend your agent's capabilities with custom actions.
Authentication
Agent Tool Authentication
Per-user OAuth in one call. Your ClickHouse MCP server gets session-scoped tokens with zero credentials stored on your infra.
Agent Auth →Security
Agent Protection
Every ClickHouse tool response scanned for prompt injection in about 2.5 ms, with 0.94 F1 on tool-response attacks, all running on a CPU.
Prompt Injection Defense →Performance
Max Agent Context. Min Cost.
Free up to 96% of your agent's context window to enhance reasoning and reduce cost, on every ClickHouse call.
Tools Discovery →What is the ClickHouse MCP Server?
A ClickHouse MCP server lets AI agents read and write ClickHouse data through the Model Context Protocol, Anthropic's open standard for connecting LLMs to external tools. StackOne's ClickHouse MCP server ships with 172 pre-built actions, fully extensible via the Connector Builder, plus managed authentication, prompt injection defense, observability, and agent execution runtime. Connect it from MCP clients like Claude Desktop, Claude Code, Cursor, Goose, and VS Code, or from agent frameworks like OpenAI Agents SDK, LangChain, and Vercel AI SDK.
All ClickHouse MCP Tools
Every StackOne action for ClickHouse, ready for your agent. Read, write, delete and run operations, scoped to exactly what you need.
Service Backups
- List Service Backups
List all backups of a ClickHouse Cloud service
- List Service Backups
Lists the backups of a ClickHouse service, most recent first. Each backup has id, status, start and finish times, size in bytes, duration in seconds, type, and, for backups exported to a customer bucket, the backup name and bucket details. On success result has status "success" and a backups array; on failure it is an error object with status "error" and a message.
Service Backup Configurations
- Get Service Backup Configuration
Get the backup schedule and retention configuration of a service
- Get Service Backup Configuration
Returns the backup schedule of a ClickHouse service: backupPeriodInHours (interval between backups), backupRetentionPeriodInHours (how long backups stay available), and backupStartTime (UTC HH:MM, present only when a custom start time is set). On failure result is an error object with status "error" and a message.
- Update Service Backup Configuration
Update the backup schedule and retention configuration of a service
Service Backup Buckets
- Create Service Backup Bucket
Configure a custom AWS, GCP or Azure bucket for service backups
- Get Service Backup Bucket
Get the custom backup bucket configured for a service
- Update Service Backup Bucket
Update the custom backup bucket configured for a service
- Delete Service Backup Bucket
Remove the custom backup bucket from a service
ClickPipes
- Create ClickPipe
Create a ClickPipe that ingests data from Kafka, object storage, Kinesis, Pub/Sub, Postgres, MySQL, BigQuery or MongoDB into a service.
- List ClickPipes
List the ClickPipes (data ingestion pipelines) in a ClickHouse Cloud service.
- Get ClickPipe
Get a single ClickPipe by ID, including its source, destination, scaling and state.
- Get ClickPipe
Returns the full definition of one ClickPipe on a ClickHouse service: name, description, state, replica scaling, source settings (Kafka, object storage, Kinesis, or Postgres), destination database and table definition, field mappings, and creation and update times. If the lookup fails, result is an error object with status "error" and a message.
- List ClickPipes
Lists the ClickPipes of a ClickHouse service. Each entry has id, name, description, state, scaling, source and destination configuration, field mappings, and creation and update times; returns an empty array when the service has none. Pass an id to get_clickpipe for the fully typed definition of one pipe. If the lookup fails, result is an error object.
- Update ClickPipe
Update the name, mutable source fields, destination columns, field mappings or settings of a ClickPipe.
- Delete ClickPipe
Delete a ClickPipe.
ClickPipe Settings
- Get ClickPipe Settings
Get the advanced settings of a ClickPipe.
- Update ClickPipe Settings
Update the advanced settings of a ClickPipe.
CDC ClickPipes Scalings
- Get CDC ClickPipes Scaling
Get the shared scaling settings of database (CDC) ClickPipes in a service.
- Update CDC ClickPipes Scaling
Update the shared CPU and memory of database (CDC) ClickPipes in a service.
Reverse Private Endpoints
- Create Reverse Private Endpoint
Create a reverse private endpoint so ClickPipes can reach a source privately.
- List Reverse Private Endpoints
List the ClickPipes reverse private endpoints of a ClickHouse Cloud service.
- Get Reverse Private Endpoint
Get a single ClickPipes reverse private endpoint by ID.
- Update Reverse Private Endpoint
Update the custom private DNS mappings of a reverse private endpoint.
- Delete Reverse Private Endpoint
Delete a ClickPipes reverse private endpoint.
ClickStack Alerts
- Create ClickStack Alert
Create a ClickStack alert on a saved search, dashboard tile or inline chart
- List ClickStack Alerts
List ClickStack alerts on a service, with optional tag, source, state and name filters
- Get ClickStack Alert
Get a ClickStack alert by ID
- Update ClickStack Alert
Replace a ClickStack alert with a full new definition
- Delete ClickStack Alert
Delete a ClickStack alert
ClickStack Dashboards
- Create ClickStack Dashboard
Create a ClickStack dashboard with tiles, filters and containers
- List ClickStack Dashboards
List all ClickStack dashboards on a service
- Get ClickStack Dashboard
Get a ClickStack dashboard by ID
- Update ClickStack Dashboard
Replace a ClickStack dashboard with a full new definition
- Delete ClickStack Dashboard
Delete a ClickStack dashboard
ClickStack Sources
- Create ClickStack Source
Create a ClickStack data source for logs, traces, metrics, sessions or PromQL
- List ClickStack Sources
List all ClickStack data sources (logs, traces, metrics, sessions, PromQL) on a service
- Get ClickStack Source
Get a ClickStack data source by ID
- Update ClickStack Source
Replace a ClickStack data source with a full new definition
- Delete ClickStack Source
Delete a ClickStack data source
ClickStack Webhooks
- List ClickStack Webhooks
List ClickStack webhook notification destinations on a service
- Delete ClickStack Webhook
Delete a ClickStack webhook destination
ClickStack Saved Searchs
- Create ClickStack Saved Search
Create a ClickStack saved search on a source
- Get ClickStack Saved Search
Get a ClickStack saved search by ID
- Update ClickStack Saved Search
Replace a ClickStack saved search with a full new definition
- Delete ClickStack Saved Search
Delete a ClickStack saved search and its alerts
ClickStack Roles
- List ClickStack Roles
List the ClickStack roles of a service, including predefined roles
- Update ClickStack Role
Replace the permissions, name and description of a custom ClickStack role
Organizations
- Get Organizations
Retrieves all accessible ClickHouse Cloud organizations.
- Get Organizations
List the ClickHouse Cloud organizations available to the caller
- Get Organization
Get the details of a ClickHouse Cloud organization
- Update Organization
Update the name, private endpoints or crash-report setting of a ClickHouse Cloud organization
Postgres Slow Query Patterns
- List Postgres Slow Query Patterns
Lists the slowest query patterns observed on a Postgres service in a time window, with aggregate metrics per pattern (call count, total/avg/p50/p95/p99/max duration, rows, shared buffer cache hits and reads, CPU time, WAL bytes, error count). Durations are in microseconds. Use this first to find which queries dominate execution time, CPU, I/O, or WAL, then pass a selected pattern queryId, dbName, dbUser, dbOperation, and app exactly as returned to get_postgres_slow_query_pattern_details for its recent executions. Pass app as an empty string when the selected pattern has no application_name; omit the app filter only when intentionally querying across all applications. The queryText is normalized with $1-style placeholders.
- List Postgres Slow Query Patterns
List aggregate metrics for the slowest query patterns on a Postgres service in a time window
- Get Postgres Slow Query Pattern
Get a slow query pattern with its most recent executions
Postgres Metrics
- Get Postgres Metrics
Returns bucketed time-series metrics for a Postgres service over a time window (CPU, memory, disk, network, connections, cache hit ratio, throughput, transactions, wait events, lock waits, and more). Wait metrics are active_sessions_by_wait (one series per wait event, such as Lock:relation, or None when a session is not waiting), lock_wait_time (p50, p95, and Max series, in seconds), and blocked_sessions. Each metric has a key, name, unit, description, and one series per label dimension, where each series is a list of (timestamp, value) data points. Timestamps are Unix seconds at the bucket start. Provide fromDate and toDate to bound the window; omit bucketSizeSeconds to let the server pick a bucket granularity for the window. Use this to chart or analyze how a service behaved over time.
- Get Postgres Metrics
Get bucketed time-series metrics for a Postgres service over a time window
Postgres Logs
- Get Postgres Logs
Returns PostgreSQL server log entries for a Postgres service in a time window, most recent first unless sortOrder is asc. Each entry has a timestamp (RFC 3339), a severity, and the raw body; structured bodies are returned as a JSON-encoded string. Filter with severity (exact match, so ERROR does not include FATAL or PANIC) and bodyContains (case-sensitive substring). The window must not exceed 30 days, and toDate must be after fromDate. Results are paginated: omit limit for 50 entries per page (up to 2000) and advance offset until a page returns fewer than limit entries. Use this to investigate errors, failed connections, crashes, and other server events.
- List Postgres Logs
List PostgreSQL server log entries for a Postgres service in a time window
Organization Members
- List Organization Members
List all members of a ClickHouse Cloud organization
- Get Organization Member
Get the details of a single ClickHouse Cloud organization member
- Update Organization Member
Change the roles assigned to a ClickHouse Cloud organization member
- Remove Organization Member
Remove a user from a ClickHouse Cloud organization
Invitations
- Create Invitation
Invite a user by email to join a ClickHouse Cloud organization
- List Invitations
List all invitations of a ClickHouse Cloud organization
- Get Invitation
Get the details of a single ClickHouse Cloud organization invitation
- Delete Invitation
Revoke a pending ClickHouse Cloud organization invitation
BYOC Infrastructures
- Create BYOC Infrastructure
Create a BYOC (Bring Your Own Cloud) infrastructure in the organization
- Get BYOC Infrastructure
Get the full configuration of a BYOC (Bring Your Own Cloud) infrastructure
- Update BYOC Infrastructure
Rename a BYOC infrastructure, toggle its private link and load balancers, or replace its tags
- Remove BYOC Infrastructure
Remove a BYOC infrastructure from the organization
Postgres Services
- Create Postgres Service
Create a new managed Postgres service in the organization
- List Postgres Services
List all managed Postgres services in the organization
- Get Postgres Service
Get the details of a managed Postgres service
- Update Postgres Service
Update the name, size, HA settings, tags, IP access list or deletion protection of a Postgres service
- Delete Postgres Service
Delete a managed Postgres service
Postgres Service Configurations
- Get Postgres Service Configuration
Get the Postgres and PgBouncer configuration of a Postgres service
- Update Postgres Service Configuration
Update selected Postgres and PgBouncer configuration settings of a Postgres service
Postgres Private Endpoints
- Create Postgres Private Endpoint
Create the AWS private endpoint service of a Postgres service
- Get Postgres Private Endpoint
Get the AWS private endpoint service of a Postgres service
- Update Postgres Private Endpoint
Approve VPC endpoints and set supported regions for a Postgres private endpoint
- Delete Postgres Private Endpoint
Delete the AWS private endpoint service of a Postgres service
API Endpoints
- Create Query API Endpoint
Create a Query API endpoint that exposes a SQL statement over HTTP on a ClickHouse Cloud service
- List Query API Endpoints
List the active Query API endpoints of a ClickHouse Cloud service
- Get Query API Endpoint
Get a single Query API endpoint of a ClickHouse Cloud service
- Update Query API Endpoint
Replace the configuration of a Query API endpoint on a ClickHouse Cloud service
- Delete Query API Endpoint
Delete a Query API endpoint from a ClickHouse Cloud service
Roles
- List Roles
List the system and custom roles available in a ClickHouse Cloud organization
- Get Role
Get the details of a single ClickHouse Cloud organization role
Saved Querys
- Create Saved Query
Save a SQL query on a ClickHouse Cloud service
- Get Saved Query
Get a single saved SQL query of a ClickHouse Cloud service
- Update Saved Query
Replace the name, SQL, database and parameters of a saved query
- Delete Saved Query
Delete a saved SQL query from a ClickHouse Cloud service
Services
- Create Service
Create a new ClickHouse Cloud service in the organization
- List Services
List all ClickHouse Cloud services in an organization
- Get Service
Get the details of a ClickHouse Cloud service
- Update Service
Update basic details of a service such as its name, IP access list or tags
- Delete Service
Delete a stopped ClickHouse Cloud service
Service JWT Providers
- List Service JWT Providers
List the JWT authentication providers configured on a service
- Get Service JWT Provider
Get a single JWT authentication provider of a service
- Delete Service JWT Provider
Remove a JWT authentication provider from a service
Service Query Endpoints
- Get Service Query Endpoint
Get the configuration of the service query endpoint that executes queries via API
- Delete Service Query Endpoint
Remove the service query endpoint of a service
Service Autoscaling Schedules
- Get Service Autoscaling Schedule
Get the autoscaling schedule of a service
- Delete Service Autoscaling Schedule
Delete the autoscaling schedule of a service
Service Upgrade Windows
- Get Service Upgrade Window
Get the configured upgrade window of a service
- Set Service Upgrade Window
Create or fully replace the upgrade window of a service
- Delete Service Upgrade Window
Delete the upgrade window of a service, restoring default upgrade scheduling
Replica Aware Routings
- Get Replica Aware Routing
Get whether replica aware (sticky) routing is enabled for a service
- Update Replica Aware Routing
Enable or disable replica aware (sticky) routing for a service
Service Snapshot Configurations
- Get Service Snapshot Configuration
Get the scheduled snapshot configuration of a service
- Update Service Snapshot Configuration
Enable, disable or change the cadence of scheduled service snapshots
UDFs
- Create UDF
Create a user-defined function from an uploaded source archive
- List UDFs
List the user-defined functions in an organization
- Get UDF
Get the latest version of a user-defined function
- Delete UDF
Delete a user-defined function and all of its versions
UDF Versions
- Create UDF Version
Create a new version of a user-defined function from an uploaded source archive
- List UDF Versions
List all versions of a user-defined function
- Delete UDF Version
Delete one version of a user-defined function
UDF Attachments
- List UDF Attachments
List the services a user-defined function is attached to
- Get UDF Attachment
Get the attachment of a user-defined function to one service
Other (51)
- Create Postgres Read Replica
Create a new read replica for a Postgres service
- Create Service Private Endpoint
Create a private endpoint associated with a service and organization
- Create Or Replace Service Autoscaling Schedule
Create or fully replace the autoscaling schedule of a service
- Create UDF Upload URL
Create a presigned URL for uploading a UDF source archive
- List API Keys
List the API keys of a ClickHouse Cloud organization
- Get Backup
Get the details of a single service backup
- Get Organization Usage Costs
Get the usage costs of a ClickHouse Cloud organization for a date range of up to 31 days
- Get ClickPipes Service Context
Get service-level ClickPipes capabilities and workload identity context for a service.
- List ClickStack Saved Searches
List ClickStack saved searches on a service
- Get Postgres Slow Query Pattern Details
Returns up to the 10 most recent individual executions for a single Postgres slow query pattern from the last 24 hours, plus aggregate metrics for the pattern when available. For exact drill-down from list_postgres_slow_query_patterns, pass queryId, dbName, dbUser, dbOperation, and app exactly as returned; pass app as an empty string when the selected pattern has no application_name. Omit app only when intentionally querying across all applications. Each execution includes duration, rows, buffer/temp/WAL/JIT/CPU counters, and the error message and SQLSTATE if it failed. Durations are in microseconds. The execution sample is capped at 10 rows, so when aggregate is present rely on its fields for totals.
- List Databases
Lists the databases in a ClickHouse Cloud service by running SHOW DATABASES as the authenticated identity. Returns only database names as an array of strings, with no tables, sizes, or other metadata; call list_tables with one of these names to see its tables and columns. If the query fails or the user lacks passwordless access to the service, result is an error object instead. Idle services are woken automatically and the call returns an error asking you to retry shortly; stopped services are never started automatically and must be started manually.
- List Tables
Lists the tables of one database on a ClickHouse service by querying system.tables and system.columns as the authenticated identity, optionally narrowed with the like and notLike name patterns. Each table includes its engine and full engine definition, CREATE TABLE statement, sorting and primary keys, view dependencies, row, byte, part, and mark counts, comment, and its columns with type, default kind and expression, and comment. Returns an empty array when nothing matches. If the query fails or the user lacks passwordless access to the service, result is an error object instead. Idle services are woken automatically and the call returns an error asking you to retry shortly; stopped services are never started automatically and must be started manually.
- Get Services List
Lists every ClickHouse and Managed Postgres service in an organization. Each entry has serviceType ("clickhouse" or "postgres"), id, name, provider, region, state, and createdAt; ClickHouse services add version, endpoints, replica and memory settings, idle scaling, IP access list, private endpoints, and encryption fields, while Postgres services add version, VM size, storage size, and HA type. Use the id values with the service-scoped tools. If one service kind cannot be listed, result holds the other kind and partialResults and warning explain what is missing; if both fail, result is an error object.
- Get Organization Details
Returns one organization: its id, name, creation time, configured private endpoints, and BYOC (bring your own cloud) configurations. The credentials must belong to the organization; otherwise result is an error object with status "error" and a message.
- Get Service Details
Returns a service that belongs to the organization. Supports both ClickHouse services and Managed Postgres services; the service type is detected automatically from the service id and is reported in the `serviceType` field of the response.
- Get Organization Cost
Returns usage costs for an organization over an inclusive range of UTC calendar days from from_date to to_date (both required, at most 31 days). result has grandTotalCHC, the total in ClickHouse Credits (CHC), and costs, one record per day per billed entity (data warehouse, service, or ClickPipe) with the entity id and name, a per-metric CHC breakdown, the day total, and whether the record is final. On failure result is an error object with status "error" and a message.
- Get Service Backup Details
Returns one backup of a ClickHouse service: its status, start and finish times, size in bytes, duration in seconds, type, and, when the backup was exported to a customer bucket, its name and bucket details. Use list_service_backups to find backup ids. On failure result is an error object with status "error" and a message.
- Get Prometheus Service Discovery Targets
Get one Prometheus scrape target per service in the organization, in Prometheus HTTP service discovery format
- Get Service Prometheus Metrics
Get the Prometheus metrics of a ClickHouse service
- Get Organization PostgreSQL Prometheus Metrics
Get the Prometheus metrics of all managed PostgreSQL services in the organization
- Get PostgreSQL Service Prometheus Metrics
Get the Prometheus metrics of a single managed PostgreSQL service
- List Organization Activities
List the audit activities recorded for a ClickHouse Cloud organization
- Get Organization Activity
Get a single organization activity by ID
- Get BYOC Infrastructure Tags
Get the additional tags applied to the cloud resources of a BYOC infrastructure
- Get BYOC Infrastructure Private Endpoint Configuration
Get the private link endpoint service details of a BYOC infrastructure
- List Postgres Service Backups
List the base backups retained for a Postgres service, newest first
- List Postgres Blocking Queries
List queries that waited on locks held by other queries on a Postgres service in a time window
- Get Postgres CA Certificates
Download the CA certificates for a Postgres service
- List Saved Queries
List the saved SQL queries of a ClickHouse Cloud service
- List Service Profiles
List the custom instance profiles available to the organization in a region
- Get Service Private Endpoint Configuration
Get the information required to set up a private endpoint for a service
- List Service Snapshots
List the snapshots of a ClickHouse Cloud service
- Get Snapshot
Get the details of a single service snapshot
- Update ClickPipe Scaling
Change the replicas, CPU or memory of a Kafka, Kinesis or object storage ClickPipe.
- Update ClickPipe State
Start, stop or resync a ClickPipe.
- Update Postgres Password
Set a new password for the superuser account of a Postgres service
- Update Postgres Service State
Restart a Postgres service, promote a read replica, or switch over to a standby
- Update Service Auto Scaling Settings
Update the per-replica memory limits, replica count and idle scaling of a service
- Update Service Password
Set a new password for the default user of a service
- Update Service State
Start, stop or wake a ClickHouse Cloud service
- Discover ClickPipe Source Schema
Infer the field names and ClickHouse data types of a ClickPipe source without creating a pipe.
- Silence ClickStack Alert
Silence a ClickStack alert until a given time
- Unsilence ClickStack Alert
Clear the silence on a ClickStack alert so notifications resume
- Validate ClickStack Dashboard
Validate a ClickStack dashboard definition without saving it
- Run SELECT Query
Executes a SELECT query against a ClickHouse service. Runs a read-only SELECT query on the specified ClickHouse service via the Query API endpoint. This function provides direct access to database content through SQL queries while ensuring that only read operations are permitted. The result size is limited (see maxResultBytes). Prefer aggregations (COUNT, SUM, GROUP BY) and selecting only the columns you need. To read many rows, fetch them in pages with LIMIT and OFFSET, or by a key range such as WHERE id > <last id> ORDER BY id LIMIT n.
- Run Postgres SELECT Query
Executes a read-only SELECT query against a Postgres service. The query is routed through the Postgres query endpoint with the read-only role and only read-style statements are permitted.
- Restore Postgres Service
Restore a Postgres service from continuous backup into a new service at a point in time
- Replace Postgres Service Configuration
Replace the entire Postgres and PgBouncer configuration of a Postgres service
- Upsert Service Query Endpoint
Create or update the service query endpoint that executes queries via API
- Attach UDF To Service
Attach a version of a user-defined function to a service
- Detach UDF From Service
Detach a user-defined function from a service
Set Up Your ClickHouse MCP Server in Minutes
One endpoint. Any framework. Your agent is talking to ClickHouse in under 10 lines of code.
Agent Frameworks
{
"mcpServers": {
"stackone": {
"command": "npx",
"args": [
"-y",
"mcp-remote@latest",
"https://api.stackone.com/mcp?x-account-id=<account_id>",
"--header",
"Authorization: Basic <YOUR_BASE64_TOKEN>"
]
}
}
}Check More Data Infrastructure MCP Servers
560+ actions
239+ actions
178+ actions
172+ actions
145+ actions
138+ actions
135+ actions
Platform Resources
Comparing BM25, TF-IDF, and Hybrid Search for MCP Tool Discovery
Benchmarking BM25, TF-IDF, and hybrid search for MCP tool discovery across 916 tools. The 80/20 TF-IDF/BM25 hybrid hits 21% Top-1 accuracy in under 1ms.
10 min
Indirect Prompt Injection Defense for MCP Tools: A Technical Guide
MCP tools that read emails, CRM records, and tickets are indirect prompt injection vectors. Here's how we built a two-tier defense that scans tool results in ~11ms.
12 min
MCP vs A2A: Architecture, Security, and When to Use Each
MCP vs A2A: what each protocol standardizes, how they differ, the security risks they share, and when to use one, both or a hybrid.
12 min
MCP vs API: What Hundreds of Connector Builds Taught Us
MCP wraps APIs, it doesn't replace them. After building hundreds of connectors that serve both, here's when each approach wins.
14 min read
FAQ
ClickHouse MCP Server FAQ
origin_owner_id.