Cover image
Try Now
2025-02-26

3 years

Works with Finder

1

Github Watches

1

Github Forks

3

Github Stars

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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Gil kaminski
  • Make sure you are post-ready before you post on social media

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

    Reviews

    4 (1)
    Avatar
    user_b7nE3ZNi
    2025-04-16

    CockroachDB-MCP-Server is an impressive solution for managing distributed databases efficiently. Authored by dhartunian, it showcases robustness and performance in handling complex database tasks. The GitHub repository (https://github.com/dhartunian/cockroachdb-mcp-server) provides comprehensive details and I appreciate the clarity and support available. Highly recommended for anyone dealing with distributed systems.