Skip to content
CockroachDB MCP Server

CockroachDB MCP Server

Added to Onei
1 views
Apache-2.0

Summary

Cockroach Labs' official MCP server exposes a CockroachDB cluster to agents as typed tools — schema inspection, cluster metadata, EXPLAIN and SELECT — with writes and DDL locked off unless you explicitly turn them on.

Features

  • Read-only by default: schema, cluster metadata, SELECT, EXPLAIN and running-query inspection
  • Write and DDL tools appear only when CRDB_MCP_ENABLE_WRITE_QUERIES is set to true
  • Query timeout and max-row caps bound cost and context usage (30s / 10,000 rows by default)
  • TLS defaults to verify-full, with client-certificate authentication as the recommended path
  • Single Go binary, pre-built releases for Linux and Windows, or a published Docker image
  • stdio for local use, or an HTTP deployment with bearer auth for a shared team server

Installation

Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it, filling in the environment variables with your own values.
  3. Restart the agent — the "CockroachDB MCP Server" tools will be available.
{
  "mcpServers": {
    "cockroachdb-mcp-server": {
      "command": "cockroachdb-mcp-server",
      "env": {
        "CRDB_HOST": "my-cluster.crdb.io",
        "CRDB_USERNAME": "ai_agent",
        "CRDB_SSL_MODE": "verify-full",
        "CRDB_SSL_CA_PATH": "/certs/ca.crt",
        "CRDB_SSL_CERTFILE": "/certs/client.ai_agent.crt",
        "CRDB_SSL_KEYFILE": "/certs/client.ai_agent.key"
      }
    }
  }
}

Description

Handing an agent a database connection string is the fast way to a bad afternoon. The CockroachDB MCP Server is Cockroach Labs' first-party answer: a Model Context Protocol server that exposes the cluster as a fixed set of typed tools rather than an open SQL prompt, and that ships read-only.

The tool surface

Read-only tools are registered by default:

  • Schemalist_databases, list_tables, get_table_schema
  • Clusterget_cluster, list_sql_users, list_cluster_nodes
  • Queryselect_query, explain_query, show_statement, show_running_queries

Write tools (create_database, create_table, insert_rows, update_rows, delete_rows) only appear when CRDB_MCP_ENABLE_WRITE_QUERIES=true is set. The split is the point: an analyst-style session and a migration-writing session are two different configurations, not two different levels of trust in the model.

Two guardrails are worth setting deliberately rather than leaving at their defaults: CRDB_MCP_QUERY_TIMEOUT (30s) and CRDB_MCP_MAX_ROWS_COUNT (10000). Together they bound what a careless query can cost the cluster and how much of it lands in the context window.

Connecting

It is a single Go binary — go install github.com/cockroachdb/cockroachdb-mcp-server@latest, a pre-built release for Linux and Windows on amd64/arm64, or the published Docker image. Authentication is the normal CockroachDB story: CRDB_HOST, CRDB_USERNAME, and TLS settings that default to verify-full, with client-certificate auth (CRDB_SSL_CA_PATH, CRDB_SSL_CERTFILE, CRDB_SSL_KEYFILE) as the recommended path.

It runs over stdio next to the client, or as an HTTP server that MCP clients reach with "type": "http" and a bearer token — useful when one hardened deployment should serve a team rather than every laptop holding cluster credentials.

Practical advice

Point it at a dedicated SQL user with the grants the session actually needs. The server constrains which operations exist; the database still decides what that user may touch, and the two together are what make an agent-facing connection reasonable.

Apache 2.0, maintained in the cockroachdb GitHub organisation. Requires Go 1.26+ to build from source and a reachable cluster.

Related MCP Servers

New

Official AntV MCP server that turns a description of your data into a rendered chart — 26 visualization types from bar and line to sankey, mind-map, fishbone and geographic maps.

Featured

InfluxData's official MCP server for InfluxDB 3 — schema discovery, bounded SQL and InfluxQL queries, line-protocol writes and token administration across Core, Enterprise and Cloud.

Browse all MCP servers →