Supports configuration through environment variables stored in .env files, allowing secure database connection details to be managed outside the codebase.
Allows direct interaction with YugabyteDB (PostgreSQL-compatible) databases, providing tools for listing tables with schemas and row counts, and executing read-only SQL queries with results returned as JSON.
YugabyteDB MCP Server
An MCP server implementation for YugabyteDB that allows LLMs to directly interact with your database.
Features
- List all tables in the database, including schema and row counts
- Run read-only SQL queries and return results as JSON
- Designed for use with FastMCP and compatible with MCP clients like Claude Desktop, Cursor, and Windsurf Editor
Prerequisites
- Python 3.10 or higher
- uv installed to manage and run the server
- A running YugabyteDB database
- An MCP client such as Claude Desktop or Cursor
Installation
Clone this repository and install dependencies:
Configuration
The server is configured using the following environment variable:
YUGABYTEDB_URL
: The connection string for your YugabyteDB database (e.g.,dbname=database_name host=hostname port=5433 user=username password=password
)
Example .env
file:
Usage
Running the Server
You can run the server using uv:
MCP Client Configuration
To use this server with an MCP client (e.g., Claude Desktop, Cursor), add it to your MCP client configuration. Example for Cursor:
- Replace
/path/to/cloned/yugabytedb-mcp-server/
with the path to your cloned repository. - Set the correct database URL in the
env
section.
Claude Desktop
- Edit the configuration file. Go to Claude -> Settings -> Developer -> Edit Config
- Add the above configuration under
mcpServers
. - Restart Claude Desktop.
Claude Desktop Logs
The logs for Claude Desktop can be found in the following locations:
- MacOS: ~/Library/Logs/Claude
- Windows: %APPDATA%\Claude\Logs
The logs can be used to diagnose connection issues or other problems with your MCP server configuration. For more details, refer to the official documentation.
Cursor
- Install Cursor on your machine.
- Go to Cursor > Settings > Cursor Settings > MCP > Add a new global MCP server.
- Add the configuration as above.
- Save the configuration.
- You will see yugabytedb-mcp-server as an added server in MCP servers list. Refresh to see if server is enabled.
Cursor Logs
In the bottom panel of Cursor, click on "Output" and select "Cursor MCP" from the dropdown menu to view server logs. This can help diagnose connection issues or other problems with your MCP server configuration.
Windsurf Editor
- Install Windsurf Editor on your machine.
- Go to Windsurf > Settings > Windsurf Settings > Cascade > Model Context Protocol (MCP) Servers > Add server > Add custom server.
- Add the configuration as above.
- Save and refresh.
Tools Provided
- summarize_database: Lists all tables in the database, including schema and row counts.
- run_read_only_query: Runs a read-only SQL query and returns the results as JSON.
Example Usage
Once connected via an MCP client, you can:
- Ask for a summary of the database tables and schemas
- Run SELECT queries and get results in JSON
Environment Variables
YUGABYTEDB_URL
: (required) The connection string for your YugabyteDB/PostgreSQL database
Troubleshooting
- Ensure the
YUGABYTEDB_URL
is set and correct - Verify your database is running and accessible
- Check that your user has the necessary permissions
- Make sure
uv
is installed and available in your PATH. Note: If claude is unable to access uv, giving the error:spawn uv ENOENT
, try symlinking the uv for global access:
- Review logs in your MCP client for connection or query errors
Development
- Project dependencies are managed in
pyproject.toml
- Main server logic is in
src/server.py
This server cannot be installed
An MCP server implementation that allows Large Language Models to directly interact with YugabyteDB databases, supporting table listing and read-only SQL queries.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that enables large language models to interact directly with MongoDB databases, allowing them to query collections, inspect schemas, and manage data through natural language.Last updated -340MIT License
- -security-license-qualityA server that enables communication with multiple unichat-based MCP servers simultaneously, allowing users to query different language models and combine their responses for more comprehensive results.Last updated -JavaScript
- -securityAlicense-qualityAn MCP server implementation that enables Claude to execute read-only queries against MariaDB databases and explore database schemas through natural language.Last updated -5PythonMIT License
- -security-license-qualityAn MCP server that enables natural language interaction with Apache Iceberg data lakehouses, allowing users to query table metadata, schemas, and properties through Claude, Cursor, or other MCP clients.Last updated -31PythonApache 2.0