CockroachDB MCP Server

CockroachDB MCP Server

Mirror of

MCP-Mirror

Developer Tools
Visit Server

README

CockroachDB MCP Server

This MCP server connects to a CockroachDB instance, exposing database and table schemas as resources, running SQL queries as tools, and providing prompts for query analysis.

Features

Resources

  • postgres://{host}/databases/{database} - Get information about a specific database
  • postgres://{host}/databases/{database}/tables/{table}/schema - Get the schema for a specific table
  • postgres://{host}/cluster-metadata/{resource} - Get cluster metadata (requires auth token)
    • Currently supports: nodes - Information about cluster nodes

Tools

  • query - Execute a SQL query with options for execution plan analysis

Installation

  1. Clone this repository
  2. Install dependencies:
    pnpm install
    
  3. Build the project:
    npx tsc
    

Note: You must build the project with tsc before using the MCP server locally.

Configuration

The server requires a database URL as a command-line argument and optionally accepts an auth token for accessing admin UI endpoints:

node dist/server.js postgres://user:password@host:port/database [auth_token]

The auth token is required for accessing cluster metadata resources.

Using with Claude for Desktop

  1. Open your Claude for Desktop App configuration:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add your server configuration:

{
  "mcpServers": {
    "cockroachdb": {
      "command": "node",
      "args": [
        "/path/to/cockroachdb-mcp-server/dist/server.js", 
        "postgres://user:password@host:port/database",
        "your_auth_token"
      ]
    }
  }
}
  1. Restart Claude for Desktop

Using with Cline

  1. Open your Cline configuration file from the extension settings under "MCP Servers". Select "Configure MCP Servers".

  2. Add your server configuration:

{
  "mcpServers": {
    "crdb": {
      "command": "node",
      "args": [
        "/path/to/cockroachdb-mcp-server/dist/server.js",
        "postgres://root@127.0.0.1:26257/testdb",
        "your_auth_token"
      ]
    }
  }
}
  1. Restart Cline or start a new session

Example Queries

Here are some example queries you can ask Claude:

  1. "What databases are available in my CockroachDB instance?"
  2. "Can you show me the schema for the 'users' table in the 'testdb' database?"
  3. "Run this query on my database: SELECT * FROM users LIMIT 10"
  4. "Debug this query and suggest improvements: SELECT * FROM orders WHERE customer_id = 123"
  5. "Show me information about all nodes in my CockroachDB cluster"

Security Considerations

  • Be careful when configuring database access. Consider using a read-only user for the connection if you only need to query data.
  • The auth token is used to access the CockroachDB admin UI API. Make sure to keep this token secure.

Troubleshooting

  • If you encounter connection issues, verify your database credentials and ensure the CockroachDB instance is accessible from your machine.
  • For SQL errors, check the server logs for detailed error messages.
  • If Claude can't see the server, verify the configuration file is properly formatted and the path to the server.js file is correct.
  • For cluster metadata resources, ensure you've provided a valid auth token and that the admin UI is accessible on port 8080.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python