Configuring MCP

Enabling the Altinity MCP for your ClickHouse® cluster

The Configure MCP menu

The Altinity MCP server lets you expose your ClickHouse® data to an LLM. It exposes tools that let the LLM list tables, describe schemas, and run queries, and it enforces read-only mode by default. Here are the steps for getting everything working:

We’ll go through those steps next.

Enabling the MCP server for your environment

Before you can use the MCP server with a cluster, you have to enable it at the environment level. The MCP configuration documentation in the Administrator Guide has all the details. Once that’s done, come back here and we’ll wrap things up.

Enabling the MCP server for your cluster

Enabling the MCP server is pretty simple. If things are set up at the environment level, but this cluster doesn’t have MCP enabled, you’ll see something like this:

The initial MCP configuration dialog

Figure 1 - Initial view: MCP not enabled for this cluster

If you need to make changes to the environment-level MCP settings, click the gear icon to go to the Environment configuration panel. The text here indicates that the MCP server has read-only access, and it lists the client redirect URLs that the MCP server has. You can change the redirect URLs in the Environment-level MCP configuration dialog.

When you click the ENABLE MCP button, you’ll be advised that saving your changes may cause a restart:

Changing MCP settings confirmation dialog

Figure 2 - Confirming your changes

You’ll see a status message at the bottom of the panel:

MCP being enabled message

Figure 3 - MCP being enabled message

It will likely be a couple of minutes before your cluster’s configuration has been updated. Once the update is complete, the MCP configuration dialog will look something like this:

The MCP configuration dialog

Figure 4 - The MCP configuration dialog: MCP enabled for this cluster

The panel now has information that we’ll need to connect everything together. Here are the details:

  • MCP environment settings - Again, if you need to configure the MCP at an environment level, click the gear icon to go directly to the MCP configuration dialog for the environment.
  • Read-only mode - The check mark icon means that read-only mode is activated. (You can disable this at the environment level, but proceed with caution.)
  • Client redirect URLs - The redirect URLs defined at the environment level. In Figure 4 above, we’ve defined URLs for Claude and ChatGPT. LLMs use these URLs to handle authentication.
  • Connection configuration example - This is JSON to define the MCP to an agent other than Claude or ChatGPT.
  • Create a user example - This is the syntax to create a new ClickHouse user. We can create a user named maddie@example.com, then go to the LLM and authenticate as that user. The LLM will then pass an access token to the MCP when it wants to work with ClickHouse. If the access token matches the user we defined, ClickHouse will process the LLM’s request. (It may reject the request for some reason, but it will at least try. If the access token doesn’t represent a user we’ve defined to ClickHouse, the request won’t be evaluated at all.)

Adding the MCP server’s connection to your LLM

With the MCP server enabled for your cluster, you need to define it to your LLM. Looking at Figure 4 above, we need to tell our LLM to go to mcp.altinity-maddie.altinity.cloud/mcp. If you’re using something like Cursor, you define the MCP server with the JSON above. Other LLMs have a graphical interface. For example, here’s how to add the Altinity connector to Claude:

Go to the Settings menu and select Connectors, then Add custom connector from the dropdown menu:

Claude add custom connector menu

Figure 5 - Adding a custom connector to Claude

Give the connector a name and enter the URL from Figure 4 above:

Claude add custom connector dialog

Figure 6 - Entering the connector’s URL

With the connector defined, you’ll be asked to actually connect to the MCP server:

Connector not connected yet

Figure 7 - Making the connection

That will redirect you to the LLM’s login screen.

Authenticating to your LLM

When you add the connection, you’ll see something like this:

Connecting to an OAuth provider

Figure 8 - Authenticating with an IdP (Auth0)

As an example, let’s say we logged in as maddie@example.com.

If all goes well, you’ll be asked to confirm what you want to enable the connector to do:

Setting the connector’s permissions

Figure 9 - Setting the connector’s permissions

You can set each of the connector’s permissions to Always allow, Needs approval, or Blocked. In Figure 8, all read-only tools are always allowed to run, and the write/delete tool needs approval. If your prompt requires the LLM to do something that needs approval, you’ll see something like this:

Claude neds approval

Figure 10 - Claude needs approval

Creating a new ClickHouse user

This step is straightforward; use the email address you authenticated with the IdP to run the command shown in Figure 4:

CREATE USER `maddie@example.com` IDENTIFIED WITH http SERVER 'mcp_auth' SCHEME 'BASIC'

Next, use ClickHouse’s RBAC functions to say what that user can do:

GRANT SELECT ON raw.* TO `maddie@example.com`;
GRANT SELECT ON analytics.* to `maddie@example.com`;
GRANT SELECT ON reports.* to `maddie@example.com`;
GRANT SELECT ON system.query_log TO `maddie@example.com`;
GRANT SELECT ON system.processes TO `maddie@example.com`;

This simple example gives grants to the user at a per-database and per-table level, but you have full use of ClickHouse’s roles and grants to control access to your data.

At this point, everything is set up. Whenever the LLM needs to work with your data, it passes the access token from the LLM to the Altinity MCP server. The MCP server passes the LLM’s request and the access token to ClickHouse. If the access token matches a user defined to ClickHouse and that user has permission to perform the LLM’s request, ClickHouse will run the request, return the results to the MCP server, and the MCP server will return the results to the LLM.

Asking what the Altinity connector can do

With everything connected and configured, you can ask the LLM what the connector can do. A typical interaction might look like this:

You:

find out what things the altinity mcp connector can do, including descriptions

Claude’s response:

Here are the actual tool definitions as the MCP server declares them — this is the real, literal capability list, descriptions included verbatim from the server’s own schema:

Tool Description
search_schema Find candidate tables by keyword, searching database/table names, column names, types, and comments — plus saved memory (notes, recipes, join facts also match and boost relevant tables, so a table can rank for vocabulary its column names never contain). Query is tokenized on whitespace; any token may match. Empty query lists all tables, unranked. Never returns full schemas — that’s what inspect_table is for.
inspect_table Returns compact structured metadata for one table: engine, partition/sorting/primary/sampling keys, row and byte estimates, active parts/partitions, full column list (types, nullability, key membership, codecs, comments), heuristic guesses at likely time/dimension/measure columns, and a ready-to-run sample_select_sql string. Also surfaces saved notes (gotchas from past sessions — meant to be read before writing SQL), recipe titles (verified saved queries, fetchable via get_memory), and related tables (the join graph — since ClickHouse has no foreign keys, this is the only source of relationship knowledge).
execute_query Executes a read-only SQL query against ClickHouse. Only SELECT, WITH, SHOW, DESCRIBE, EXISTS, EXPLAIN are permitted — writes are rejected outright (there’s a separate write_query for those, not exposed to me here).
get_memory Retrieves saved knowledge about a dataset: durable notes, verified recipes, join relationships, and overviews written by a save_memory counterpart tool. Leave slug empty for a ranked index (freshest, non-stale entries first); pass an exact slug for the full body. Entries flagged is_stale mean the underlying tables have changed shape since the note was saved and need re-verification.
get_dashboards_prefix Reads from bentoclick.dashboards_prefix — no parameters. Looks like internal plumbing supporting a dashboard-saving feature; I don’t have a matching write tool for it.

From there you can start working with the data in your ClickHouse cluster. Here’s a sample series of prompts against sample data gated by the MCP server at mcp.demo.altinity.cloud/mcp/antalya:

  • use the Altinity connector until further notice. what databases are available?
  • what’s in the ontime database?
  • what are the airlines with the worst on-time performance?
  • let’s look at JetBlue since COVID. are their numbers consistent through the year, or are there times when they’re worse than normal?
  • are there particular airports or regions of the country that are worse than others? NYC is pretty notorious for delays; what percentage of JetBlue’s flights are there?
  • how much of their problem is weather delay, and how does weather delay vary across the worst airports?

And so on. None of these prompts involve SQL or even any awareness of the database schema on your part. Here we’re just asking questions based on a high-level understanding of what the dataset contains. The LLM figures out how to query the database, and the MCP server makes sure the LLM can’t do anything we don’t want it to do.