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.
Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.
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/[email protected] 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 32 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.
Use Cases▌
Direct Database Queries from AI
Enable Claude to query your database directly using natural language
Example
Ask 'Show me top 10 customers by revenue this month' and get SQL results instantly
Eliminate manual SQL writing for ad-hoc queries, get insights 10x faster
Data Analysis & Reporting
Generate complex reports and analytics without leaving conversation
Example
Analyze sales trends, cohort retention, user behavior patterns conversationally
Democratize data access—non-technical team members can query databases
Schema Exploration
Understand database structure, relationships, and data models
Example
'Explain the user_orders table schema and its relationships'
Onboard engineers faster, explore unfamiliar databases efficiently
Data Validation & Quality Checks
Run data quality queries to catch anomalies and inconsistencies
Example
Find duplicate records, missing values, orphaned foreign keys automatically
Maintain data integrity with less manual SQL work
Implementation Guide▌
Prerequisites
- ›Claude Desktop 0.7.0+ or Cursor with MCP support
- ›Database credentials (read-only recommended for safety)
- ›Network access from Claude client to database
- ›Understanding of database security and access control
Time Estimate
15-30 minutes including configuration and testing
Installation Steps
- 1.Install MCP server: npm install -g @modelcontextprotocol/server-[name]
- 2.Configure database connection in Claude Desktop config (~/.claude/mcp.json)
- 3.Provide connection string: host, port, database, username, password
- 4.Restart Claude Desktop to load MCP server
- 5.Test connection: 'List all tables in database'
- 6.Run simple query: 'Show me 5 rows from users table'
- 7.Verify results and permissions are correct
- 8.Document query patterns for team use
Troubleshooting
- ⚠Connection refused: Check database is running and network accessible
- ⚠Authentication failed: Verify credentials, check user permissions
- ⚠Claude can't see tables: Grant appropriate read permissions to database user
- ⚠Slow queries: Add indexes, limit result set size, use read replicas
- ⚠MCP server not loading: Check config syntax, restart Claude Desktop
Best Practices▌
✓ Do
- +Use read-only database credentials to prevent accidental writes
- +Connect to read replica, not production primary database
- +Set query timeout limits to prevent long-running queries
- +Document database schema and common queries for AI context
- +Monitor query performance and optimize slow queries
- +Use connection pooling for better performance
- +Test with non-production data first
✗ Don't
- −Don't use production write credentials—risk of data corruption
- −Don't query production database during peak traffic hours
- −Don't expose sensitive PII without proper access controls
- −Don't skip query result validation—AI can misinterpret schema
- −Don't allow unlimited result set sizes—set LIMIT clauses
- −Don't share database credentials in plain text config files
💡 Pro Tips
- ★Create database views for common queries to simplify AI access
- ★Add schema comments/descriptions so AI understands column meanings
- ★Use semantic table/column names ('customer_lifetime_value' not 'clv')
- ★Set up query logging to audit what Claude is querying
- ★Create saved query templates for recurring analysis
- ★Combine with data visualization tools for better insights
Technical Details▌
Architecture
MCP server acts as bridge between Claude and database, translating natural language to SQL queries and returning results in structured format.
Protocols
- Model Context Protocol (MCP)
- Database-specific protocols (PostgreSQL, MySQL, MongoDB)
Compatibility
- PostgreSQL
- MySQL
- SQLite
- MongoDB
- Redis
When to Use This▌
✓ Use When
Use for ad-hoc data queries, exploratory analysis, report generation, schema exploration, and democratizing data access. Best for read-heavy analytics workloads.
✗ Avoid When
Avoid for production write operations, mission-critical transactions, real-time OLTP workloads, or when database contains sensitive PII without proper access controls. Use read replicas, not primary.
Integration▌
- →Read replica connection for analytics queries
- →Database view layer to abstract complex joins
- →Query result caching for repeated questions
- →Audit logging of all AI-generated queries
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
List & Promote Your MCP Server
Share your MCP server with the developer community
Ratings
4.5★★★★★32 reviews- ★★★★★Chaitanya Patil· Dec 16, 2024
Useful MCP listing: CockroachDB is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Chen Garcia· Dec 8, 2024
We wired CockroachDB into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Harper Taylor· Dec 4, 2024
We evaluated CockroachDB against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Chen Haddad· Nov 27, 2024
CockroachDB is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
- ★★★★★Aditi Tandon· Nov 23, 2024
Useful MCP listing: CockroachDB is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Piyush G· Nov 7, 2024
We evaluated CockroachDB against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Shikha Mishra· Oct 26, 2024
I recommend CockroachDB for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Camila Ndlovu· Oct 18, 2024
CockroachDB has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Aditi Wang· Oct 14, 2024
Strong directory entry: CockroachDB surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Daniel Martinez· Sep 25, 2024
We evaluated CockroachDB against two servers with overlapping tools; this profile had the clearer scope statement.
showing 1-10 of 32