by abel9851
An MCP server that provides read-only access to MariaDB, enabling secure and controlled database interactions within the Model Context Protocol (MCP) framework.
mcp-server-mariadb is an MCP (Model Context Protocol) server implementation designed to provide read-only access to MariaDB databases. It allows other applications and services, particularly those integrated with Claude Desktop, to securely query and retrieve data from a MariaDB instance.
To use mcp-server-mariadb, you need to install MariaDB Connector/C and configure it within your Claude Desktop environment. The README provides detailed instructions for installation, including troubleshooting common OSError: mariadb_config not found
by installing mariadb-connector-c
via brew
and setting environment variables. For Claude Desktop integration, you need to add specific JSON configurations to your claude_desktop_config.json
file, either for published or development servers, specifying the command, arguments, and environment variables for connecting to your MariaDB instance.
query_database
Tool: Provides a dedicated tool for executing database queries.Q: What should I do if I encounter OSError: mariadb_config not found
during installation?
A: This error indicates that MariaDB Connector/C is not found. You can resolve this by installing mariadb-connector-c
(e.g., brew install mariadb-connector-c
on macOS) and then setting the MARIADB_CONFIG
environment variable to the location of the mariadb_config
utility. The README provides specific commands for this.
Q: How do I configure mcp-server-mariadb with Claude Desktop?
A: You need to modify your claude_desktop_config.json
file. The README provides two examples: one for published servers and another for development/unpublished servers. You will need to specify the command to run the server, arguments for database connection details (host, port, user, password, database), and potentially environment variables.
Q: Is mcp-server-mariadb read-only? A: Yes, mcp-server-mariadb is specifically designed to provide read-only access to MariaDB, ensuring data integrity and security.
An MCP server implementation for retrieving data from mariadb
Expose schema list in database
OSError: mariadb_config not found.
This error typically indicates that MariaDB Connector/C, a dependency which
must be preinstalled, is not found.
If MariaDB Connector/C is not installed, see installation instructions
If MariaDB Connector/C is installed, either set the environment variable
MARIADB_CONFIG or edit the configuration file 'site.cfg' to set the
'mariadb_config' option to the file location of the mariadb_config utility.
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
uv add mariadb
again.Paths to Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"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}"
]
}
}
}
Note: Replace these placeholders with actual paths:
/PATH/TO/uvx
: Full path to uvx executable{
"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": "USER",
"MARIADB_PASSWORD": "PASSWORD",
"MARIADB_DATABASE": "DATABASE",
"MARIADB_PORT": "3306"
}
}
}
}
Note: Replace these placeholders with actual paths:
/PATH/TO/uv
: Full path to UV executable/YOUR/SOURCE/PATH/mcp-server-mariadb/src/mcp_server_mariadb
: Path to server source codeThis mcp server is licensed under the MIT license. please see the LICENSE file in the repository.
Reviews feature coming soon
Stay tuned for community discussions and feedback