Connect to CockroachDB with MCP server features for seamless database management and SQL execution
CockroachDB MCP Server is an advanced, robust MCP (Model Context Protocol) server tailored for direct interaction with CockroachDB databases through the Cursor platform. By implementing the Model Context Protocol (MCP), this server bridges the gap between various AI applications and specific data sources, ensuring seamless integration and efficient data operations.
CockroachDB MCP Server is equipped with a wide array of features designed to enhance the performance and flexibility of AI application workflows. Key capabilities include:
CockroachDB MCP Server adheres closely to the Model Context Protocol (MCP) specification, providing a well-defined structure and operational standards. The server's architecture leverages modern Python technologies such as psycopg2
and uv
, ensuring efficient execution of complex SQL queries.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TD;
A[MCP Client] --> B[]{"API Request -> MCP Protocol"};
B --> C[MCP Server];
C --> D[Database/External Tool];
D --> E[Data Response];
E --> F[]{"MCP Protocol -> API Response"};
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
To install the CockroachDB MCP Server for your AI application, such as Claude Desktop, follow these steps:
Set Up Smithery CLI:
npx -y @smithery/cli install @Swayingleaves/cockroachdb-mcp-server --client claude
Clone the Repository and Enter Project Directory:
git clone https://github.com/Swayingleaves/cockroachdb-mcp-server.git
cd cockroachdb-mcp-server
Install Required Dependencies:
pip install -r requirements.txt
curl -LsSf https://astral.sh/uv/install.sh | sh
By integrating CockroachDB MCP Server with an AI application, real-time data retrieval becomes a seamless process. For instance, an e-commerce platform can leverage this server to fetch up-to-date product inventories or customer purchase histories directly from the database.
# Example Python code snippet for fetching tables
def get_tables():
with connect_database() as conn:
cursor = conn.cursor()
cursor.execute("SELECT table_name FROM information_schema.tables")
return cursor.fetchall()
Automating data analytics tasks is crucial in today’s fast-paced business environment. With the CockroachDB MCP Server, an AI application can perform automated queries to generate meaningful insights from large datasets stored in CockroachDB.
CockroachDB MCP Server supports compatibility with a variety of MCP clients, including:
Note that while Cursor currently does not fully support MCP servers, users can still utilize the server for tools and resources.
The compatibility matrix below highlights supported features across different AI applications:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
These features ensure a smooth and reliable integration process, catering to a wide range of AI workflow requirements.
{
"mcpServers": {
"cockroachdb-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/directory",
"run",
"server.py"
],
"jdbc_url": "jdbc:postgresql://localhost:26257/defaultdb",
"username": "root",
"password": "root"
}
}
}
logs/cockroachdb_mcp.log
and feature automatic rotation for maintaining optimal disk usage.Is the CockroachDB MCP Server compatible with other MCP clients?
How does the auto-reconnection mechanism work in the server?
Can special characters in database credentials be handled by the CockroachDB MCP Server?
psycopg2
for connections, which handles special characters without requiring additional URL encoding.What are the TCP keep-alive settings configured on the server?
How can I troubleshoot issues with CockroachDB MCP Server logs?
logs/cockroachdb_mcp.log
for detailed logs and error messages that help in identifying and addressing issues related to the server's operational status.Contributions are welcome! Developers interested in improving or expanding the CockroachDB MCP Server can follow these guidelines:
For more information on the Model Context Protocol (MCP) ecosystem and related resources:
By leveraging this CockroachDB MCP Server, AI application developers can enhance their workflows, ensuring efficient data access and robust integrations.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration