CockroachDB

CockroachDB

Enable AI agents to manage, monitor, and query CockroachDB using natural language. Perform complex database operations, cluster management, and query execution seamlessly through AI-driven workflows. Integrate effortlessly with MCP clients for scalable and high-performance data operations.

593

0

29 Tools

Signed
Built by Docker
Requires Secrets
Add to Docker Desktop

Version 4.43 or later needs to be installed to add the server automatically

About

CockroachDB MCP Server

Enable AI agents to manage, monitor, and query CockroachDB using natural language. Perform complex database operations, cluster management, and query execution seamlessly through AI-driven workflows. Integrate effortlessly with MCP clients for scalable and high-performance data operations.

What is an MCP Server?

Characteristics

AttributeDetails
Docker Imagemcp/cockroachdb
Authoramineelkouhen
Repositoryhttps://github.com/amineelkouhen/mcp-cockroachdb
Dockerfilehttps://github.com/amineelkouhen/mcp-cockroachdb/blob/main/Dockerfile
Docker Image built byDocker Inc.
Docker Scout Health ScoreDocker Scout Health Score
Verify SignatureCOSIGN_REPOSITORY=mcp/signatures cosign verify mcp/cockroachdb --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub
LicenceMIT License

Available Tools (29)

Tools provided by this ServerShort Description
analyze_performanceAnalyze query performance statistics for a given query or time range.
analyze_schemaAnalyze the schema and provide a summary of tables, views, and relationships.
bulk_importBulk import data into a table from a file (CSV or Avro) stored in cloud or web storage.
connectConnect to the default CockroachDB database and create a connection pool.
connect_databaseConnect to a CockroachDB database and create a connection pool.
create_databaseEnable the creation of new databases.
create_indexCreate a new index on a specified table to improve query performance.
create_tableEnable the creation of new tables in the current database.
create_viewCreate a view from a specific query.
describe_tableProvide detailed schema information, column definitions, data types, and other metadata for a specified table.
drop_databaseDrop an existing database.
drop_indexDrop an existing index.
drop_tableFacilitate the deletion of existing tables from the database.
drop_viewDrop an existing view.
execute_queryExecute a SQL query with optional parameters and formatting.
execute_transactionExecute a list of SQL queries as a single transaction.
explain_queryReturn CockroachDB's statement plan for a preparable statement.
get_active_connectionsList active connections/sessions to the current database.
get_cluster_statusGet cluster health and node distribution.
get_connection_statusGet the current connection status and details.
get_database_settingsRetrieve current database or cluster settings.
get_query_historyGet the history of executed queries.
get_replication_statusGet replication and distribution status for a table or the whole database.
get_table_relationshipsGet foreign key relationships for a table or all tables.
list_databasesList all databases in the CockroachDB cluster.
list_tablesList all tables present in the connected Cockroach database instance.
list_viewsList all views in a schema.
show_running_queriesShow currently running queries on the cluster.
switch_databaseSwitch the connection to a different database.

Tools Details

Tool: analyze_performance

Analyze query performance statistics for a given query or time range.

ParametersTypeDescription
querystring
time_rangestringoptional

Tool: analyze_schema

Analyze the schema and provide a summary of tables, views, and relationships.

ParametersTypeDescription
db_schemastringoptional

Tool: bulk_import

Bulk import data into a table from a file (CSV or Avro) stored in cloud or web storage. Supports S3, Azure Blob, Google Storage, HTTP/HTTPS URLs.

ParametersTypeDescription
file_urlstring
formatstring
table_namestring
delimiterstringoptional
skip_headerbooleanoptional

Tool: connect

Connect to the default CockroachDB database and create a connection pool.

Returns: A success message or an error message.

Tool: connect_database

Connect to a CockroachDB database and create a connection pool.

ParametersTypeDescription
databasestring
hoststring
passwordstring
portinteger
sslcertstring
sslkeystring
sslmodestring
sslrootcertstring
usernamestring

Tool: create_database

Enable the creation of new databases.

ParametersTypeDescription
database_namestring

Tool: create_index

Create a new index on a specified table to improve query performance. This tool allows users to define indexes on one or more columns, enabling faster data retrieval and optimized execution plans for read-heavy workloads.

ParametersTypeDescription
columnsarray
index_namestring
table_namestring

Tool: create_table

Enable the creation of new tables in the current database. You can instruct the AI to define table names, columns, and their types, streamlining database setup and schema evolution directly through natural language.

ParametersTypeDescription
columnsarray
table_namestring

Tool: create_view

Create a view from a specific query.

ParametersTypeDescription
querystring
view_namestring

Tool: describe_table

Provide detailed schema information, column definitions, data types, and other metadata for a specified table. This allows the AI to accurately interpret table structures and formulate precise queries or data manipulation commands.

ParametersTypeDescription
table_namestring
db_schemastringoptional

Tool: drop_database

Drop an existing database.

ParametersTypeDescription
database_namestring

Tool: drop_index

Drop an existing index.

ParametersTypeDescription
index_namestring

Tool: drop_table

Facilitate the deletion of existing tables from the database. This tool is useful for cleaning up test environments or managing schema changes, always with the necessary confirmations for security.

ParametersTypeDescription
table_namestring

Tool: drop_view

Drop an existing view.

ParametersTypeDescription
view_namestring

Tool: execute_query

Execute a SQL query with optional parameters and formatting.

ParametersTypeDescription
querystring
formatstringoptional
limitstringoptional
paramsstringoptional

Tool: execute_transaction

Execute a list of SQL queries as a single transaction.

ParametersTypeDescription
queriesarray

Tool: explain_query

Return CockroachDB's statement plan for a preparable statement. You can use this information to optimize the query. If you run it with Analyze, it executes the SQL query and generates a statement plan with execution statistics.

ParametersTypeDescription
querystring
analyzebooleanoptional

Tool: get_active_connections

List active connections/sessions to the current database.

Returns: Active sessions on the cluster.

Tool: get_cluster_status

Get cluster health and node distribution.

ParametersTypeDescription
detailedbooleanoptional

Tool: get_connection_status

Get the current connection status and details.

Returns: The connection status or an error message.

Tool: get_database_settings

Retrieve current database or cluster settings.

Returns: All cluster settings.

Tool: get_query_history

Get the history of executed queries.

ParametersTypeDescription
limitintegeroptional

Tool: get_replication_status

Get replication and distribution status for a table or the whole database.

ParametersTypeDescription
table_namestring

Tool: get_table_relationships

Get foreign key relationships for a table or all tables.

ParametersTypeDescription
table_namestringoptional

Tool: list_databases

List all databases in the CockroachDB cluster.

Returns: A list of databases with row count or an error message.

Tool: list_tables

List all tables present in the connected Cockroach database instance. This is invaluable for AI to understand the database’s landscape and identify relevant data sources for a given query.

ParametersTypeDescription
db_schemastringoptional

Tool: list_views

List all views in a schema.

ParametersTypeDescription
db_schemastringoptional

Tool: show_running_queries

Show currently running queries on the cluster.

ParametersTypeDescription
min_durationstringoptional
node_idintegeroptional
userstringoptional

Tool: switch_database

Switch the connection to a different database.

ParametersTypeDescription
databasestring

Use this MCP Server

{
  "mcpServers": {
    "cockroachdb": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "CRDB_HOST",
        "-e",
        "CRDB_PORT",
        "-e",
        "CRDB_DATABASE",
        "-e",
        "CRDB_USERNAME",
        "-e",
        "CRDB_SSL_MODE",
        "-e",
        "CRDB_SSL_CA_PATH",
        "-e",
        "CRDB_SSL_KEYFILE",
        "-e",
        "CRDB_SSL_CERTFILE",
        "-e",
        "CRDB_PWD",
        "mcp/cockroachdb"
      ],
      "env": {
        "CRDB_HOST": "127.0.0.1",
        "CRDB_PORT": "26257",
        "CRDB_DATABASE": "defaultdb",
        "CRDB_USERNAME": "root",
        "CRDB_SSL_MODE": "disable",
        "CRDB_SSL_CA_PATH": "",
        "CRDB_SSL_KEYFILE": "",
        "CRDB_SSL_CERTFILE": "",
        "CRDB_PWD": ""
      }
    }
  }
}

Why is it safer to run MCP Servers with Docker?

Manual installation

You can install the MCP server using:

Installation for

Related servers