Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
CRDB_HOSTYesCockroachDB host
CRDB_PORTNoDatabase port26257
CRDB_USERYesDatabase username
CRDB_CLUSTERNoCloud cluster ID
CRDB_SSLMODENoSSL moderequire
CRDB_DATABASEYesDatabase name
CRDB_MAX_ROWSNoMax rows per query1000
CRDB_PASSWORDNoDatabase password
CRDB_READ_ONLYNoBlock write operationsfalse
CRDB_BLOCKED_COMMANDSNoCommands to block

Capabilities

Server capabilities have not been inspected yet.

Tools

Functions exposed to the LLM to take actions

NameDescription
connectA

Connect to the CockroachDB cluster.

Uses configuration from environment variables (CRDB_HOST, CRDB_USER, etc.).

Returns:
    Connection status and cluster information.
disconnectA

Disconnect from the CockroachDB cluster.

Returns:
    Disconnection status.
cluster_statusA

Get the health status of the CockroachDB cluster.

Returns:
    Cluster health including node count and live nodes.
execute_queryB

Execute a SQL query.

Args:
    sql: SQL statement to execute.
    max_rows: Maximum rows to return (default: from config).

Returns:
    Query results with columns and rows.
validate_queryA

Check if a query is safe to execute without running it.

Args:
    sql: SQL statement to validate.

Returns:
    Validation result with any issues found.
explain_queryA

Get the execution plan for a query.

Args:
    sql: SQL query to explain.
    analyze: If True, actually execute to get runtime stats.

Returns:
    Query execution plan.
list_databasesA

List all databases in the cluster.

Args:
    include_system: Include system databases (postgres, defaultdb, etc.).

Returns:
    List of databases.
list_schemasB

List schemas in the current database.

Returns:
    List of schemas.
list_tablesA

List all tables in the database.

Args:
    schema: Filter by schema name (default: all user schemas).
    include_views: Include views in results.
    include_system: Include system tables.

Returns:
    List of tables with schema, name, and type.
describe_tableA

Get detailed column information for a table.

Args:
    table: Table name (schema.table or just table for public schema).

Returns:
    Table structure with columns, indexes, and primary key.
get_table_statsB

Get statistics for a table.

Args:
    table: Table name (schema.table or just table).

Returns:
    Table statistics including row count and size.
get_foreign_keysC

Get foreign key constraints for a table.

Args:
    table: Table name (schema.table or just table).

Returns:
    Foreign key information.
read_rowsB

Read rows from a table.

Args:
    table: Table name (schema.table or just table).
    id_value: Primary key value for single row lookup.
    id_column: Name of the ID column (default: 'id').
    where: WHERE clause (without 'WHERE').
    columns: List of columns to return (default: all).
    order_by: ORDER BY clause (without 'ORDER BY').
    limit: Maximum rows to return.

Returns:
    Query results.
insert_rowB

Insert a new row into a table.

Args:
    table: Table name (schema.table or just table).
    data: Column names and values to insert.
    returning: Columns to return from inserted row.

Returns:
    Insert result.
update_rowB

Update an existing row by primary key.

Args:
    table: Table name (schema.table or just table).
    id_value: Primary key value.
    data: Column names and new values.
    id_column: Name of the ID column (default: 'id').
    returning: Columns to return from updated row.

Returns:
    Update result.
delete_rowA

Delete a row by primary key.

Args:
    table: Table name (schema.table or just table).
    id_value: Primary key value.
    id_column: Name of the ID column (default: 'id').

Returns:
    Delete result.
upsert_rowB

Insert or update a row (UPSERT).

Args:
    table: Table name (schema.table or just table).
    data: Column names and values.
    conflict_columns: Columns to check for conflicts (usually primary key).
    update_columns: Columns to update on conflict (default: all except conflict columns).
    returning: Columns to return.

Returns:
    Upsert result.
switch_databaseB

Switch the active database context.

Args:
    database_name: Database to switch to.

Returns:
    Switch status.
begin_transactionB

Begin a database transaction.

Returns:
    Transaction status.
commit_transactionB

Commit the current transaction.

Returns:
    Commit status.
rollback_transactionB

Rollback the current transaction.

Returns:
    Rollback status.
list_nodesA

List all nodes in the CockroachDB cluster.

Returns:
    List of cluster nodes with their status.
node_statusB

Get detailed status for a node.

Args:
    node_id: Specific node ID (optional, returns all if not specified).

Returns:
    Node status information.
show_regionsB

Show database regions for multi-region clusters.

Returns:
    Region information.
show_jobsC

Show background jobs in the cluster.

Args:
    job_type: Filter by job type (BACKUP, RESTORE, IMPORT, etc.).
    status: Filter by status (running, succeeded, failed, etc.).
    limit: Maximum jobs to return.

Returns:
    List of jobs.
show_sessionsB

Show active sessions in the cluster.

Args:
    active_only: Only show sessions with active queries.

Returns:
    List of sessions.
show_statementsB

Show active statements in the cluster.

Args:
    limit: Maximum statements to return.

Returns:
    List of active statements.
cancel_queryB

Cancel a running query.

Args:
    query_id: The query ID to cancel.

Returns:
    Cancellation result.
show_rangesC

Show range distribution in the cluster.

Args:
    table: Optional table to filter ranges.
    limit: Maximum ranges to return.

Returns:
    Range distribution information.
show_zone_configC

Show zone configurations.

Args:
    table: Optional table to get zone config for.

Returns:
    Zone configuration.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bpamiri/cockroachdb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server