CockroachDB▌

by amineelkouhen
Monitor and manage CockroachDB clusters: perform DB operations, table management, SQL queries with transactions and perf
Integrates with CockroachDB to provide cluster monitoring, database operations, table management, and SQL query execution with transaction support and performance analysis.
best for
- / AI agents managing CockroachDB deployments
- / Natural language database administration
- / Automated database monitoring workflows
- / LLM-powered data analysis tasks
capabilities
- / Execute SQL queries with transaction support
- / Monitor cluster health and performance metrics
- / Manage database tables and schemas
- / Perform database operations via natural language
- / Analyze query performance and execution plans
- / Create and manage database transactions
what it does
Provides a natural language interface for AI agents to interact with CockroachDB clusters, enabling database operations, monitoring, and SQL queries through conversational commands.
about
CockroachDB is a community-built MCP server published by amineelkouhen that provides AI assistants with tools and capabilities via the Model Context Protocol. Monitor and manage CockroachDB clusters: perform DB operations, table management, SQL queries with transactions and perf It is categorized under databases, developer tools.
how to install
You can install CockroachDB in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
CockroachDB is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
CockroachDB MCP Server
Overview
The CockroachDB MCP Server is a natural language interface designed for LLMs and agentic applications to manage, monitor, and query data in CockroachDB. It integrates seamlessly with MCP (Model Content Protocol) clients, such as Claude Desktop or Cursor, enabling AI-driven workflows to interact directly with your database.
Table of Contents
- Overview
- Features
- Tools
- Installation
- Configuration
- Integrations
- Testing
- Contributing
- License
- Quality Badge
- Contact
Features
- Natural Language Queries: Enables AI agents to query and create transactions using natural language, supporting complex workflows.
- Search & Filtering: Supports efficient data retrieval and searching in CockroachDB.
- Cluster Monitoring: Check and monitor the CockroachDB cluster status, including node health and replication.
- Database Operations: Perform all operations related to databases, such as creation, deletion, and configuration.
- Table Management: Handle tables, indexes, and schemas for flexible data modeling.
- Seamless MCP Integration: Works with any MCP client for smooth communication.
- Scalable & Lightweight: Designed for high-performance data operations.
Tools
The CockroachDB MCP Server Server provides tools to manage the data stored in CockroachDB.
The tools are organized into four main categories:
Cluster Monitoring
Purpose: Provides tools for monitoring and managing CockroachDB clusters.
Summary:
- Get cluster health and node status.
- Show currently running queries.
- Analyze query performance statistics.
- Retrieve replication and distribution status for tables or the whole database.
- Get query execution insights with optional keyword filtering.
- Find slow queries from statement statistics with optional keyword filtering.
- Get transaction execution insights with optional keyword filtering.
- View contention events with optional table filtering.
- Get index recommendations from query insights.
Database Operations
Purpose: Handles database-level operations and connection management.
Summary:
- Connect to a CockroachDB database.
- List, create, drop, and switch databases.
- Get connection status and active sessions.
- Retrieve database settings.
Table Management
Purpose: Provides tools for managing tables, indexes, views, and schema relationships in CockroachDB.
Summary:
- Create, drop, and describe tables and views.
- Bulk import data into tables.
- Manage indexes (create/drop).
- List tables, views, and table relationships.
- Analyze schema structure and metadata.
Query Engine
Purpose: Executes and manages SQL queries and transactions.
Summary:
- Execute SQL queries with formatting options (JSON, CSV, table).
- Run multi-statement transactions.
- Explain query plans for optimization.
- Track and retrieve query history.
Installation
The CockroachDB MCP Server supports the stdio transport and the streamable-http transport.
Quick Start with uvx
The easiest way to use the CockroachDB MCP Server is with uvx, which allows you to run it directly from GitHub (from a branch, or use a tagged release). It is recommended to use a tagged release. The main branch is under active development and may contain breaking changes. As an example, you can execute the following command to run the 0.1.0 release:
uvx --from git+https://github.com/amineelkouhen/mcp-cockroachdb.git@0.1.0 cockroachdb-mcp-server --url postgresql://localhost:26257/defaultdb
Check the release notes for the latest version in the Releases section. Additional examples are provided below.
# Run with CockroachDB URI
uvx --from git+https://github.com/amineelkouhen/mcp-cockroachdb.git cockroachdb-mcp-server --url postgresql://localhost:26257/defaultdb
# Run with individual parameters
uvx --from git+https://github.com/amineelkouhen/mcp-cockroachdb.git cockroachdb-mcp-server --host localhost --port 26257 --database defaultdb --user root --password mypassword
# See all options
uvx --from git+https://github.com/amineelkouhen/mcp-cockroachdb.git cockroachdb-mcp-server --help
# Run with streamable HTTP transport
uvx --from git+https://github.com/amineelkouhen/mcp-cockroachdb.git cockroachdb-mcp-server \
--url postgresql://localhost:26257/defaultdb \
--transport http \
--http-host 0.0.0.0 \
--http-port 8000 \
--http-path /mcp
Development Installation
For development or if you prefer to clone the repository:
# Clone the repository
git clone https://github.com/amineelkouhen/mcp-cockroachdb.git
cd mcp-cockroachdb
# Install dependencies using uv
uv venv
source .venv/bin/activate
uv sync
# Run with CLI interface
uv run cockroachdb-mcp-server --help
# Or run the main file directly (uses environment variables)
uv run src/main.py
Once you cloned the repository, installed the dependencies and verified you can run the server, you can configure Claude Desktop or any other MCP Client to use this MCP Server running the main file directly (it uses environment variables). This is usually preferred for development. The following example is for Claude Desktop, but the same applies to any other MCP Client.
- Specify your CockroachDB credentials and TLS configuration
- Retrieve your
uvcommand full path (e.g.which uv) - Edit the
claude_desktop_config.jsonconfiguration file - on a MacOS, at~/Library/Application Support/Claude/
{
"mcpServers": {
"cockroach": {
"command": "<full_path_uv_command>",
"args": [
"--directory",
"<your_mcp_server_directory>",
"run",
"src/main.py"
],
"env": {
"CRDB_HOST": "<your_cockroachdb_hostname>",
"CRDB_PORT": "<your_cockroachdb_port>",
"CRDB_DATABASE": "<your_cockroach_database>",
"CRDB_USERNAME": "<your_cockroachdb_user>",
"CRDB_PWD": "<your_cockroachdb_password>",
"CRDB_SSL_MODE": "disable|allow|prefer|require|verify-ca|verify-full",
"CRDB_SSL_CA_PATH": "<your_cockroachdb_ca_path>",
"CRDB_SSL_KEYFILE": "<your_cockroachdb_keyfile_path>",
"CRDB_SSL_CERTFILE": "<your_cockroachdb_certificate_path>",
}
}
}
}
You can troubleshoot problems by tailing the log file.
tail -f ~/Library/Logs/Claude/mcp-server-cockroach.log
With Docker Compose (Local Development)
For local development and testing, use the provided docker-compose.yaml to spin up both CockroachDB and the MCP server:
# Start CockroachDB and MCP server
docker compose up -d
# The MCP server is available at http://localhost:8000/mcp/
# CockroachDB UI is available at http://localhost:8080
# View logs
docker compose logs -f mcp-server
# Stop and clean up
docker compose down -v
With Docker
You can use a dockerized deployment of this server. You can either build your image or use the official CockroachDB MCP Docker image.
If you'd like to build your image, the CockroachDB MCP Server provides a Dockerfile. Build this server's image with:
docker build -t mcp-cockroachdb .
Finally, configure the client to create the container at start-up. An example for Claude Desktop is provided below. Edit the claude_desktop_config.json and add:
{
"mcpServers": {
"cockroach": {
"command": "docker",
"args": ["run",
"--rm",
"--name",
"cockroachdb-mcp-server",
"-e", "CRDB_HOST=<cockroachdb_host>",
"-e", "CRDB_PORT=<cockroachdb_port>",
"-e", "CRDB_DATABASE=<cockroachdb_database>",
"-e", "CRDB_USERNAME=<cockroachdb_user>",
"mcp-cockroachdb"]
}
}
}
To use the CockroachDB MCP Docker image, just replace your image name (mcp-cockroachdb in the example above) with mcp/cockroachdb.
Configuration
The CockroachDB MCP Server can be configured in two ways: either via command-line arguments or via environment variables. The precedence is: CLI arguments > environment variables > default values.
Configuration via c
FAQ
- What is the CockroachDB MCP server?
- CockroachDB is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for CockroachDB?
- This profile displays 10 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
Ratings
4.5★★★★★10 reviews- ★★★★★Shikha Mishra· Oct 10, 2024
CockroachDB is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
- ★★★★★Piyush G· Sep 9, 2024
We evaluated CockroachDB against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Chaitanya Patil· Aug 8, 2024
Useful MCP listing: CockroachDB is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Sakshi Patil· Jul 7, 2024
CockroachDB reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Ganesh Mohane· Jun 6, 2024
I recommend CockroachDB for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Oshnikdeep· May 5, 2024
Strong directory entry: CockroachDB surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Dhruvi Jain· Apr 4, 2024
CockroachDB has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Rahul Santra· Mar 3, 2024
According to our notes, CockroachDB benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Pratham Ware· Feb 2, 2024
We wired CockroachDB into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Yash Thakker· Jan 1, 2024
CockroachDB is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.