Execute read-only SQL operations against a MariaDB database
The MariaDB Connector provides a secure interface for AI assistants to interact with MariaDB databases. It enables read-only access to database schemas and tables, allowing for data retrieval and analysis without risking data modification. This MCP server implementation exposes database schemas as resources and provides tools for executing SQL queries against MariaDB instances. It's designed with security in mind, limiting operations to read-only access to protect your data while still enabling powerful database interactions.
The MariaDB Connector MCP server allows AI assistants to connect to and query MariaDB databases in a secure, read-only manner. This enables data analysis and information retrieval while protecting your database from modifications.
Before installing the MariaDB Connector, ensure you have:
uv
package manager (recommended)If you're on macOS and encounter issues with MariaDB dependencies, you may need to install the MariaDB Connector/C:
brew install mariadb-connector-c
echo 'export PATH="/opt/homebrew/opt/mariadb-connector-c/bin:$PATH"' >> ~/.bashrc
export MARIADB_CONFIG=$(brew --prefix mariadb-connector-c)/bin/mariadb_config
Install the package using uv
:
uv add mcp-server-mariadb
To configure the MariaDB Connector in Claude Desktop, you'll need to modify the configuration file located at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Add the following configuration to your Claude Desktop config file, replacing the placeholders with your actual database credentials:
{
"mcpServers": {
"mcp_server_mariadb": {
"command": "/PATH/TO/uvx",
"args": [
"mcp-server-mariadb",
"--host",
"${DB_HOST}",
"--port",
"${DB_PORT}",
"--user",
"${DB_USER}",
"--password",
"${DB_PASSWORD}",
"--database",
"${DB_NAME}"
]
}
}
}
Replace /PATH/TO/uvx
with the full path to your uvx
executable, and replace the database placeholders with your actual database connection details.
If you're working with an unpublished or development version, use this configuration instead:
{
"mcpServers": {
"mcp_server_mariadb": {
"command": "/PATH/TO/uv",
"args": [
"--directory",
"/YOUR/SOURCE/PATH/mcp-server-mariadb/src/mcp_server_mariadb",
"run",
"server.py"
],
"env": {
"MARIADB_HOST": "127.0.0.1",
"MARIADB_USER": "YOUR_USERNAME",
"MARIADB_PASSWORD": "YOUR_PASSWORD",
"MARIADB_DATABASE": "YOUR_DATABASE",
"MARIADB_PORT": "3306"
}
}
}
}
Replace the paths and database credentials with your actual values.
Once configured, the MariaDB Connector will be available to your AI assistant. You can ask the assistant to:
The connector enforces read-only access, so operations that would modify the database (INSERT, UPDATE, DELETE, etc.) are not permitted.
If you encounter issues with the MariaDB Connector: