Skip to main content
This page shows how to install the , connect it to a cluster, and configure your AI tools to use it.
AI tools with cluster access can execute operations on your behalf. When first connecting an AI tool to CockroachDB, consider starting with a staging cluster to understand the tool’s behavior before granting it access to production data.

Before you begin

  • To install with go install or build from source, ensure that you have Go 1.26 or later.
  • Ensure that you have a reachable CockroachDB cluster. For a multi-node cluster, connect through a ; for development, you can connect to any node directly. The default port is 26257.
  • Create a dedicated for the server, and issue for it.
    • the user only the privileges that the tools you plan to use need. For example, grant SELECT on the relevant databases for read-only use. Avoid admin and write privileges unless you plan to enable the .

Step 1. Install the server

Pre-built binaries are not available for macOS because a CockroachDB parser dependency requires cgo on macOS. Use one of the following options instead.

Option 1: go install

The binary lands in $(go env GOPATH)/bin/cockroachdb-mcp-server.

Option 2: Build from source

Option 3: Docker

Pull the multi-arch image (linux/amd64, linux/arm64) from Google Artifact Registry:
The image runs as nonroot on a distroless base image. On Apple Silicon, Docker runs the linux/arm64 image natively. This is the only install option on macOS that does not require Go.To configure an MCP client to run the image, refer to the Docker configuration in Step 2.

Step 2. Configure your MCP client

Each server instance connects to a single cluster. To give your AI tool access to multiple clusters, add one mcpServers entry per cluster, each pointing at its own server instance.
In stdio mode, your AI tool launches the server as a subprocess, so all configuration is passed in the env block of the tool’s MCP configuration. Add one of the following to your MCP client’s configuration file, replacing the example values with your own host, user, and certificate paths. Most MCP clients read an mcpServers block or an equivalent. Refer to your client’s documentation for the file location and format.
GUI clients such as Claude Desktop often launch with a minimal PATH and do not expand ~, so a bare command may not resolve. Use the absolute path to the binary instead, for example /Users/{username}/go/bin/cockroachdb-mcp-server.

Specify configuration variables

Use to connect with client certificates:

Connection string

Use to pass all connection parameters in a single string:
must include an sslmode of require, verify-ca, or verify-full. A connection string that omits sslmode is rejected at startup.

Local insecure cluster (development only)

For a local cluster started with cockroach start-single-node --insecure or , opt in to a TLS-free connection. No certificate files are needed:
For the full list of configuration options, refer to the .

Docker

To run the Docker image in stdio mode, set command to docker and move all configuration into args: pass run, --rm, and -i, followed by each environment variable with -e, and the image reference last. The same CRDB_* variables apply unchanged. Because the server runs inside the container, mount the host certificate directory read-only and point the CRDB_SSL_* paths at the in-container mount location:
In this example, /path/to/certs is the certificate directory on the host, and /certs is where it is mounted inside the container.A connection string translates the same way: keep the read-only mount, and use the in-container /certs paths in the sslcert, sslkey, and sslrootcert parameters of CRDB_DATABASE_URL.For a local insecure cluster, localhost inside the container refers to the container itself, not the host. On macOS and Windows, use host.docker.internal in place of localhost in the connection string. On Linux, add "--network", "host" to args and keep localhost.

Step 3. Verify the connection

Restart your AI tool so that it registers the new MCP configuration, then send a prompt that exercises a read tool. For example:

See also