Skip to main content
Glama

YugabyteDB MCP Server

Official
by yugabyte

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

Installation

Clone this repository and install dependencies:

git clone git@github.com:yugabyte/yugabytedb-mcp-server.git cd yugabytedb-mcp-server uv sync

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:

YUGABYTEDB_URL=postgresql://user:password@localhost:5433/yugabyte

Usage

Running the Server

You can run the server with STDIO transport using uv:

uv run src/server.py

or with Streamable-HTTP transport:

uv run src/server.py --transport http

Running the Server with Docker

Build the Docker image:

docker build -t mcp/yugabytedb .

Run the container with STDIO transport:

docker run -p 8080:8080 -e YUGABYTEDB_URL="your-db-url" mcp/yugabytedb

or with Streamable-HTTP transport:

docker run -p 8080:8080 -e YUGABYTEDB_URL="your-db-url" mcp/yugabytedb --transport=http

MCP Client Configuration

To use this server with an MCP client (e.g., Claude Desktop, Cursor), add it to your MCP client configuration.

Running via uv

Example configuration for Cursor:

{ "mcpServers": { "yugabytedb-mcp": { "command": "uv", "args": [ "--directory", "/path/to/cloned/yugabytedb-mcp-server/", "run", "src/server.py" ], "env": { "YUGABYTEDB_URL": "dbname=database_name host=hostname port=5433 user=username password=password load_balance=true topology_keys=cloud.region.zone1,cloud.region.zone2" } } } }
  • Replace /path/to/cloned/yugabytedb-mcp-server/ with the path to your cloned repository.
  • Set the correct database URL in the env section.
Running via Docker (e.g., in Claude)

After building the docker container, add the following to claude_config.json entry or equivalent json files for other editors:

{ "mcpServers": { "yugabytedb-mcp-docker": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "YUGABYTEDB_URL=dbname=yugabyte host=host.docker.internal port=5433 user=yugabyte password=yugabyte load_balance=false", "mcp/yugabytedb" ] } } }

Claude Desktop

  1. Edit the configuration file. Go to Claude -> Settings -> Developer -> Edit Config
  2. Add the above configuration under mcpServers.
  3. 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

  1. Install Cursor on your machine.
  2. Go to Cursor > Settings > Cursor Settings > MCP > Add a new global MCP server.
  3. Add the configuration as above.
  4. Save the configuration.
  5. 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

  1. Install Windsurf Editor on your machine.
  2. Go to Windsurf > Settings > Windsurf Settings > Cascade > Model Context Protocol (MCP) Servers > Add server > Add custom server.
  3. Add the configuration as above.
  4. Save and refresh.

Streamable-HTTP with MCP Inspector

  1. Start the server using Streamable-HTTP:
    uv run src/server.py --transport http
    Or with Docker:
    docker run -p 8080:8080 -e YUGABYTEDB_URL="..." mcp/yugabytedb --transport=http
  2. Launch the inspector:
    npx @modelcontextprotocol/inspector
  3. In the GUI, use the URL:
    http://localhost:8080/invocations/mcp
    • Change transport type to Streamable-HTTP
    • Add the proxy token from the terminal output

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:
sudo ln -s "$(which uv)" /usr/local/bin/uv
  • 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
-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

An MCP server implementation that allows Large Language Models to directly interact with YugabyteDB databases, supporting table listing and read-only SQL queries.

  1. Features
    1. Prerequisites
      1. Installation
        1. Configuration
          1. Usage
            1. Running the Server
            2. Running the Server with Docker
            3. MCP Client Configuration
            4. Claude Desktop
            5. Cursor
            6. Windsurf Editor
            7. Streamable-HTTP with MCP Inspector
            8. Tools Provided
            9. Example Usage
          2. Environment Variables
            1. Troubleshooting
              1. Development

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  An MCP server that integrates with MySQL databases, enabling secure read and write operations through LLM-driven interfaces with support for transaction handling and performance monitoring.
                  Last updated -
                  48
                  3
                  JavaScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  An MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.
                  Last updated -
                  JavaScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  An 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 -
                  340
                  MIT License
                  • Apple
                • -
                  security
                  -
                  license
                  -
                  quality
                  An MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.
                  Last updated -
                  1
                  JavaScript

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/yugabyte/yugabytedb-mcp-server'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server