CockroachDB SQL接口
STDIO连接CockroachDB的数据库查询服务器
连接CockroachDB的数据库查询服务器
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.
postgres://{host}/databases/{database}
- Get information about a specific databasepostgres://{host}/databases/{database}/tables/{table}/schema
- Get the schema for a specific tablepostgres://{host}/cluster-metadata/{resource}
- Get cluster metadata (requires auth token)
nodes
- Information about cluster nodesquery
- Execute a SQL query with options for execution plan analysispnpm install
npx tsc
Note: You must build the project with
tsc
before using the MCP server locally.
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.
Open your Claude for Desktop App configuration:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
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" ] } } }
Open your Cline configuration file from the extension settings under "MCP Servers". Select "Configure MCP Servers".
Add your server configuration:
{ "mcpServers": { "crdb": { "command": "node", "args": [ "/path/to/cockroachdb-mcp-server/dist/server.js", "postgres://[email protected]:26257/testdb", "your_auth_token" ] } } }
Here are some example queries you can ask Claude: