How MCP Toolbox turns agent text into ClickHouse vectors Google's open-source MCP Toolbox for Databases, version 1.9.0, now natively supports ClickHouse, enabling AI agents to perform semantic search by automatically converting text queries into vectors using a Gemini embedding model, eliminating the need for custom embedding code. The tool, which also supports PostgreSQL, MySQL, and other databases, allows developers to define parameterized SQL tools in YAML, with features like connection pooling and OpenTelemetry metrics. If you've built an AI agent that needs semantic search, you've probably hit the same awkward gap everyone hits: your LLM speaks text, your database speaks SQL and vectors, and something in the middle has to do the translation. Usually that something ends up being bespoke application code or tools you write and maintain - accept a query string, call an embedding API, format the vector, splice it into SQL, hope you escaped everything correctly. MCP Toolbox for Databases https://github.com/googleapis/mcp-toolbox by Google closes that gap natively, and it works with ClickHouse out of the box. You declare a Gemini embedding model in YAML, mark a tool parameter as embeddedBy that model, and Toolbox handles the entire text → vector → search pipeline transparently. The agent never sees a vector. It sends "how do I configure TTL on a table?" and gets back ranked rows. In this post I'll cover what MCP Toolbox is, how to install and set it up, how to use its prebuilt ClickHouse tools, and then the main event: building an ingestion tool that embeds on insert and a search tool that embeds the query and ranks by cosine distance - with no embedding service of your own to write or maintain. Then we'll load a synthetic corpus through it and look at what actually comes back. Want to try it out? Give this post to your coding agent and let it follow the steps and set everything up for you. Everything below was run end to end against Toolbox 1.9.0 and a ClickHouse Cloud 26.4.1 service, the stable releases at the time of writing. What is MCP Toolbox? MCP Toolbox for Databases is Google's open-source Apache 2.0 Model Context Protocol server, originally released as genai-toolbox before MCP existed and since renamed. It's a single Go binary that sits between AI agents and your databases, and it serves two distinct purposes: 1. A ready-to-use MCP server. Point it at databases such as ClickHouse and Postgres with a --prebuilt flag and any MCP client - Claude Code, Gemini CLI, Codex, your IDE - instantly gets generic tools like execute sql and list tables . Great for exploration and development. 2. A custom tools framework. Define curated, parameterized SQL statements in YAML and expose those as tools instead of raw SQL access. This is a great pattern for production as the agent can only invoke the queries you wrote, passing typed parameters that the driver escapes on its way to the database. Alongside ClickHouse it supports PostgreSQL, MySQL, SQL Server, Oracle, MongoDB, Redis, Valkey, Elasticsearch, Neo4j, Cassandra, Snowflake, Trino, CockroachDB, TiDB, and the Google Cloud fleet AlloyDB, BigQuery, Cloud SQL, Spanner, Firestore . A single tools.yaml can define sources across several of them, so one MCP endpoint can expose tools for your ClickHouse analytics and a Postgres app database side by side. That isn't federation, though - each tool binds to exactly one source, so an agent correlates the two by making two calls and joining the results in its own context, not in SQL. Under the hood you also get connection pooling, optional authenticated tool invocation, and OpenTelemetry metrics and traces for free. Installation Pick whichever fits your setup: 1 Homebrew macOS / Linux 2brew install mcp-toolbox 3 4 Or grab the binary directly see the releases page for versions/platforms 5export VERSION=1.9.0 6curl -L -o toolbox https://storage.googleapis.com/mcp-toolbox-for-databases/v$VERSION/darwin/arm64/toolbox 7chmod +x toolbox 8 9 Or Docker 10docker pull us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION 11 12 Or zero-install via npx convenient, but not the fastest startup 13npx @toolbox-sdk/server --config tools.yaml Verify with toolbox --version . The server listens on 127.0.0.1:5000 by default - loopback, not all interfaces, which is the right default for a process holding database credentials. Here is an example tools.yaml 1kind: source 2name: my-clickhouse 3type: clickhouse 4host: ${CLICKHOUSE HOST} 5port: ${CLICKHOUSE PORT} 6database: ${CLICKHOUSE DATABASE} 7user: ${CLICKHOUSE USER} 8password: ${CLICKHOUSE PASSWORD} 9protocol: ${CLICKHOUSE PROTOCOL} 10secure: true 11 12--- 13kind: tool 14name: execute sql 15type: clickhouse-execute-sql 16source: my-clickhouse 17description: Execute a SQL query against ClickHouse and return the rows. 18 19--- 20kind: tool 21name: list databases 22type: clickhouse-list-databases 23source: my-clickhouse 24description: List all databases in ClickHouse. 25 26--- 27kind: tool 28name: list tables 29type: clickhouse-list-tables 30source: my-clickhouse 31description: List the tables in a ClickHouse database. 32 33--- 34kind: embeddingModel 35name: gemini-embedder 36type: gemini 37model: gemini-embedding-001 38project: ${GOOGLE CLOUD PROJECT} 39location: ${GOOGLE CLOUD LOCATION} 40dimension: 768 41 42--- 43kind: tool 44name: insert doc 45type: clickhouse-sql 46source: my-clickhouse 47description: Indexes a new document and its vector embedding. 48statement: | 49 INSERT INTO vectors.documents content, embedding VALUES ?, ? 50parameters: 51 - name: content 52 type: string 53 description: The text content to store. 54 - name: text to embed 55 type: string 56 description: Hidden copy of content, embedded as a vector. 57 valueFromParam: content 58 embeddedBy: gemini-embedder 59 60--- 61kind: tool 62name: search docs 63type: clickhouse-sql 64source: my-clickhouse 65description: Finds the most semantically similar documents to a query. 66statement: | 67 SELECT content, cosineDistance embedding, ? AS distance 68 FROM vectors.documents 69 ORDER BY distance ASC 70 LIMIT 5 71parameters: 72 - name: query 73 type: string 74 description: The natural-language search query. 75 embeddedBy: gemini-embedder 76 77--- 78kind: toolset 79name: semantic search 80tools: 81 - insert doc 82 - search docs 83 84--- 85kind: toolset 86name: clickhouse explore 87tools: 88 - execute sql 89 - list databases 90 - list tables An FYI before you write any YAML: 1.9 prefers a flat config format . Each resource is its own YAML document with kind , name , and type keys, separated by --- . Older examples on the internet use a nested format sources: → my-clickhouse: → … where kind carries the type. That older shape still parses and runs fine in 1.9 I kept a nested config around and it executed happily so nothing is broken if you have one. toolbox migrate converts it when you want the new shape, and all the examples below use it. Quick start: prebuilt ClickHouse tools You can use Toolbox as a generic ClickHouse MCP server, similar to connecting it to mcp-clickhouse https://github.com/clickhouse/mcp-clickhouse or the ClickHouse Cloud MCP server https://clickhouse.com/docs/products/cloud/features/ai-ml/mcp/remote-mcp . Add this to your MCP client config e.g. .mcp.json for Claude Code or claude desktop config.json for Claude Desktop : 1{ 2 "mcpServers": { 3 "clickhouse": { 4 "command": "npx", 5 "args": "-y", "@toolbox-sdk/server", "--prebuilt=clickhouse", "--stdio" , 6 "env": { 7 "CLICKHOUSE HOST": "your-instance.clickhouse.cloud", 8 "CLICKHOUSE PORT": "8443", 9 "CLICKHOUSE USER": "default", 10 "CLICKHOUSE PASSWORD": "…", 11 "CLICKHOUSE DATABASE": "default", 12 "CLICKHOUSE PROTOCOL": "https" 13 } 14 } 15 } 16} All six of those variables are required, and the prebuilt config fails fast and tells you exactly which one is missing, which is nicer than a connection timeout. Note that CLICKHOUSE HOST is a bare hostname: scheme and port live in CLICKHOUSE PROTOCOL and CLICKHOUSE PORT , so https://host:8443 in the host field won't work. That gives your agent three tools immediately: execute sql , list databases , and list tables . You can now ask "what's the schema of my events table?" and the agent figures it out. Toolbox is refreshingly blunt about what this mode is for, logging a warning on every start: These prebuilt configs are intended for 'build-time' use cases, where agents are helping trusted developers build things. They are not secure enough for 'run time' use cases, where the agent will be talking to potentially untrusted developers. Which is the cue for the curated tools below. Native text → vector → search ClickHouse also has strong vector search https://clickhouse.com/blog/vector-search-clickhouse-p1 support, and includes distance functions such as cosine and support for HNSW indexes. Toolbox's custom tools framework has first-class embedding models as a resource type. When a tool parameter carries an embeddedBy: