CockroachDB MCP Server
Overview
CockroachDB MCP Server is a server that allows you to interact directly with a CockroachDB database using the Model Context Protocol (MCP) specification.
To use the CockroachDB MCP Server, clone the repository, install the required dependencies, and run the server with the appropriate configuration in your Cursor application.
- Connect to CockroachDB database - Retrieve all tables and their structure - Execute SQL queries - Automatic reconnection and keep-alive mechanisms - Detailed logging for troubleshooting - Support for manual disconnection
- Managing and querying data in a CockroachDB database.
- Integrating with applications that require database interactions.
- Troubleshooting database connection issues with detailed logs.
Add to your AI client
Use these steps to connect CockroachDB MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"cockroachdb-mcp-server-swayingleaves": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"cockroachdb-mcp-server-swayingleaves": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"cockroachdb-mcp-server-swayingleaves": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"cockroachdb-mcp-server-swayingleaves": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"cockroachdb-mcp-server-swayingleaves": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"cockroachdb-mcp-server-swayingleaves": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cockroachdb-mcp-server-swayingleaves"
]
}
}
}FAQ
What is the MCP specification?
The MCP specification defines how to interact with databases in a standardized way.
How do I install the CockroachDB MCP Server?
Clone the repository and install dependencies as per the installation instructions in the README.
What should I do if I encounter connection issues?
Check the log file for detailed error messages and ensure the CockroachDB server is running.