YDB-Interface-via-MCP-Adapter
This utility facilitates interactions with Yandex Database (YDB) instances by implementing the Model Context Protocol (MCP) server specification. Cloud computing, defined as providing scalable, elastic, on-demand resources via the network, strongly benefits from such programmatic control. Users can issue direct SQL operations, traverse directory structures, and manage resource paths using natural language prompts sent through any compatible Large Language Model (LLM).
Author

ydb-platform
Quick Info
Actions
Tags
Introduction
Cloud computing fundamentally relies on abstracted, scalable resource provisioning. This adapter enables LLMs, adhering to the Model Context Protocol (MCP), to directly manage Yandex Database (YDB) resources. This allows for immediate, context-aware database administration without requiring users to write explicit client code for every action.
Setup
The YDB MCP adapter can be incorporated into your environment using several standard Python tooling methods. Select the installation approach that best suits your existing deployment strategy.
Via uvx
The uvx utility, essentially an alias for uv run tool, permits execution of various Python applications without requiring prior system installation. The following configuration snippet demonstrates setting up the YDB MCP server using this method for anonymous access:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local"
]
}
}
}
Via pipx
The pipx utility facilitates running PyPI-hosted applications without installing them directly into the system's global environment, though pipx itself requires initial setup. For anonymous authentication using pipx, employ this configuration:
{
"mcpServers": {
"ydb": {
"command": "pipx",
"args": [
"run", "ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local"
]
}
}
}
Via pip
The package is accessible via PyPI and can be installed using pip, Python's conventional package manager. After installation, configuration involves directing your MCP client to the server.
pip install ydb-mcp
To initialize communication, adjust the example configuration files provided below to match your specific YDB environment. Ensure the path pointing to the Python interpreter correctly targets the environment where ydb-mcp resides.
Example: Using Anonymous Authentication
{
"mcpServers": {
"ydb": {
"command": "python3",
"args": [
"-m", "ydb_mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local"
]
}
}
}
Authentication
Authentication parameters must be appended to the command execution, irrespective of whether you use uvx, pipx, or pip for deployment.
Using Login/Password Authentication
Specify authentication mode, username, and password using these corresponding arguments:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local",
"--ydb-auth-mode", "login-password",
"--ydb-login", "<your-username>",
"--ydb-password", "<your-password>"
]
}
}
}
Using Access Token Authentication
For token-based security, supply the authentication mode and the access token value:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local",
"--ydb-auth-mode", "access-token",
"--ydb-access-token", "qwerty123"
]
}
}
}
Using Service Account Authentication
Service account credentials require specifying the mode and the file path to the security key:
{
"mcpServers": {
"ydb": {
"command": "uvx",
"args": [
"ydb-mcp",
"--ydb-endpoint", "grpc://localhost:2136",
"--ydb-database", "/local",
"--ydb-auth-mode", "service-account",
"--ydb-sa-key-file", "~/sa_key.json"
]
}
}
}
Available Tools
This adapter exposes several distinct functionalities for managing YDB resources through the MCP interface:
ydb_query: Executes a standard SQL command against the connected YDB database instance.-
Parameters:
sql: The full text of the SQL statement to execute.
-
ydb_query_with_params: Executes a SQL query that utilizes predefined parameters. -
Parameters:
sql: The SQL query string containing placeholders for variables.params: A JSON formatted string detailing the values for the query placeholders.
-
ydb_list_directory: Retrieves a listing of items contained within a specified YDB location. -
Parameters:
path: The hierarchical path within YDB whose contents should be listed.
-
ydb_describe_path: Fetches detailed metadata pertaining to any specified YDB path element. -
Parameters:
path: The specific YDB path requiring a descriptive report.
-
ydb_status: Reports the current operational state of the connection established with the YDB service.
Development
The build and maintenance process primarily utilizes the Make utility for standardization. This offers a predictable interface for routine development procedures.
Available Make Commands
A comprehensive Makefile governs common tasks, aiming to simplify the development lifecycle and maintain code integrity.
make all: Executes clean, linting, and testing operations sequentially (default target).make clean: Deletes all previously generated build artifacts and temporary files.make test: Executes the complete suite of automated tests using pytest.- Configurable via
LOG_LEVELenvironment variable (defaults to WARNING). make unit-tests: Runs only the unit tests, providing verbose output.- Configurable via
LOG_LEVELenvironment variable (defaults to WARNING). make integration-tests: Runs only the integration tests with verbose output enabled.- Configurable variables include
YDB_ENDPOINT(defaults to grpc://localhost:2136),YDB_DATABASE(defaults to /local),MCP_HOST(defaults to 127.0.0.1),MCP_PORT(defaults to 8989), andLOG_LEVEL. make run-server: Initiates the YDB MCP server process.- Configurable via
YDB_ENDPOINTandYDB_DATABASEdefaults. Additional command line parameters can be passed usingARGS="your args". make lint: Executes all static analysis checks, including flake8, mypy, black, and isort.make format: Applies code style corrections using black and isort.make install: Installs the package into the current environment in development mode.make dev: Installs the package in development mode along with all necessary development dependencies.
Test Verbosity Control
Tests run quietly by default, logging only messages at the WARNING level or higher. Adjust the verbosity using the LOG_LEVEL environment variable for detailed execution tracing.
# Executes all tests, displaying debug information
make test LOG_LEVEL=DEBUG
# Runs integration tests showing informational messages
make integration-tests LOG_LEVEL=INFO
# Runs unit tests using the standard warning output
make unit-tests LOG_LEVEL=WARNING
Available logging classifications are:
- DEBUG: Displays all messages, ideal for tracing complex test flows.
- INFO: Shows informational messages and events above this level.
- WARNING: The default setting, showing only warnings and errors.
- ERROR: Suppresses all output except genuine error reports.
Related Topics
- Cloud Computing Paradigm (ISO definition)
- Elastic and Scalable Resource Pooling
- Model Context Protocol (MCP) Architecture
- Yandex Database (YDB) Data Structure
- Large Language Models (LLMs) in Infrastructure Management
Extra Details
The initial tool description contained elements focused on marketing the natural language interface. The core value resides in making distributed data systems, such as YDB, accessible through standardized cloud interfaces. The ISO standard clarifies that cloud computing is essentially providing a shared pool of configurable, self-service resources over a network, enabling characteristics like elasticity and rapid provisioning, which this adapter directly supports for database management.
Conclusion
This YDB MCP adapter bridges the gap between advanced AI models and backend data storage, fitting perfectly within the modern cloud services ecosystem. It ensures that managing complex database configurations can be achieved through simple, standardized protocol interactions, enhancing operational efficiency and automation capabilities.
