ClickHouse MCP

Give AI agents trusted ClickHouse analytics — not a database console

@hypequery/mcp turns your TypeScript datasets and metrics into Model Context Protocol tools. Claude, Cursor, and other MCP clients can discover and query the analytics you approve while SQL and ClickHouse credentials stay inside your server.

Agent surface

Datasets + metrics

Database access

No raw SQL

Works with

Claude, Cursor, MCP clients

Raw SQL gives an agent too much authority

Prompt instructions are not an access-control layer. A general SQL tool lets the model choose tables, columns, joins, and result size at runtime.

Analytics meaning drifts between humans and agents

If every agent writes its own revenue query, it will disagree with the backend and dashboard sooner or later.

Multi-tenant data needs trusted scope

Tenant identity must come from the host process, never from a prompt or caller-supplied filter that can widen access.

One governed contract

Publish the analytics definitions your product already trusts

Define dimensions, measures, metrics, relationships, and tenant rules once in TypeScript. The MCP server turns that catalog into a small, discoverable tool surface.

  • Agents discover only the datasets and metrics you register
  • Fields, filters, ordering, and limits are validated before execution
  • Metric definitions stay identical across backend, React, and MCP
  • SQL is hidden by default and credentials never enter the model context
  • Tenant-scoped datasets fail closed without trusted server scope

Semantic contract

Define what the agent is allowed to understand

one-governed-contract.ts

The dataset is ordinary TypeScript that can be reviewed, tested, and versioned with the rest of your application.

MCP server

Start the server with approved models and trusted tenant scope

The dedicated @hypequery/mcp package exposes list, schema, metric, and dataset tools over stdio. The agent never writes or receives SQL.

Use the CLI for a local single-tenant server or createMCPServer() when your host process owns tenant identity and lifecycle.

Because MCP uses the same dataset client as the rest of your application, validation and metric meaning do not fork into an agent-only implementation.

@hypequery/mcp

A governed MCP server in a few lines

mcp-server.ts

Pass tenant scope from authenticated host state. Never ask the model to choose its own tenant.

Where teams usually get stuck

Questions teams ask

ClickHouse MCP server

Use a semantic tool surface when agents need ClickHouse analytics but should not receive general database access.

Semantic layer for AI agents

Datasets give humans, APIs, dashboards, and agents one definition for business metrics.

MCP for multi-tenant SaaS

The server accepts tenant identity from trusted host configuration and rejects unscoped tenant datasets.

Claude and Cursor analytics

Any MCP-compatible client can discover approved metrics without learning your schema or credentials.

Next step

Give one approved metric to your first agent

Install @hypequery/mcp, register a dataset and metric, then connect the stdio server to your MCP client.