YDB Model Context Protocol Server
YDB Model Context Protocol (MCP) server allows you to work with YDB databases from any Large Language Model (LLM) that supports MCP using any of the MCP clients. This integration enables AI-powered database operations and natural language interactions with your YDB instances.
Getting Started
Prerequisites
- Install an MCP client that supports MCP tools (most do). The configuration examples below use a common format supported by several popular MCP clients (Claude Desktop, Cursor, etc.), but you may need to adjust the format to meet your client's requirements.
- The YDB MCP server is a Python application that is typically co-hosted with the MCP client. There are several options for installing and running the YDB MCP server explained below, but all of them require a pre-installed Python 3.10+ environment.
Anonymous Authentication
uvx allows you to run Python applications without explicitly installing them.
Configure YDB MCP in your MCP client settings:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136/local"
]
}
}
}
pipx allows you to run applications from PyPI without explicit installation (pipx itself must be installed first).
Configure YDB MCP in your MCP client settings:
{
"mcpServers": {
"ydb": {
"command": "pipx",
"args": [
"run", "ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136/local"
]
}
}
}
Optionally, create and activate a Python virtual environment. Install YDB MCP using pip:
pip install ydb-mcp
Configure YDB MCP in your MCP client settings:
{
"mcpServers": {
"ydb": {
"command": "python3",
"args": [
"-m", "ydb_mcp",
"--ydb-endpoint", "grpc://localhost:2136/local"
]
}
}
}
Login-Password Authentication
Configure login/password authentication with uvx
:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136/local",
"--ydb-auth-mode", "login-password",
"--ydb-login", "<your-username>",
"--ydb-password", "<your-password>"
]
}
}
}
Configure login/password authentication with pipx
:
{
"mcpServers": {
"ydb": {
"command": "pipx",
"args": [
"run", "ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136/local",
"--ydb-auth-mode", "login-password",
"--ydb-login", "<your-username>",
"--ydb-password", "<your-password>"
]
}
}
}
Configure login/password authentication with pip
-installed YDB MCP:
{
"mcpServers": {
"ydb": {
"command": "python3",
"args": [
"-m", "ydb_mcp",
"--ydb-endpoint", "grpc://localhost:2136/local",
"--ydb-auth-mode", "login-password",
"--ydb-login", "<your-username>",
"--ydb-password", "<your-password>"
]
}
}
}
Run Queries
Ask your LLM questions regarding the data stored in YDB using the MCP client configured above. The language model will see the tools available to it via MCP and will use them to execute YQL queries and other YDB API calls. An example of how it might look:
Available Tools
YDB MCP provides the following tools for interacting with YDB databases:
-
ydb_query
: Run a SQL query against a YDB database- Parameters:
sql
: SQL query string to execute
- Parameters:
-
ydb_query_with_params
: Run a parameterized SQL query with JSON parameters- Parameters:
sql
: SQL query string with parametersparams
: JSON string containing parameter values
- Parameters:
-
ydb_list_directory
: List directory contents in YDB- Parameters:
path
: YDB directory path to list
- Parameters:
-
ydb_describe_path
: Get detailed information about a scheme object (table, directory, etc) located at the specified YDB path- Parameters:
path
: YDB path to describe
- Parameters:
-
ydb_status
: Get the current status of the YDB connection
Command-line arguments and environment variables
The following table describes the command-line arguments and environment variables for the YDB MCP server:
Arguments | Environment variable | Default | Description |
---|---|---|---|
--ydb-endpoint |
YDB_ENDPOINT |
— | YDB endpoint consisting of protocol, hostname, port, and database name |
--ydb-login |
YDB_LOGIN |
— | YDB login |
--ydb-password |
YDB_PASSWORD |
— | YDB password |
--ydb-auth-mode |
YDB_AUTH_MODE |
anonymous |
YDB authentication mode. Valid values: anonymous , login-password |
--log-level |
— | INFO |
Logging level. Valid values: DEBUG , INFO , WARNING , ERROR , CRITICAL |
Note
Command-line arguments override the corresponding environment variables.
Learn More
For more information visit the YDB MCP GitHub repository.