mcp-server-mariadb
An MCP server implementation for retrieving data from mariadb
Features
Resources
Expose schema list in database
Tools
- query_database
- Execute read-only operations against MariDB
dependency
install mariadb
- mac
- when install mariadb, maybe raise os error below. you can resolve by installing mariadb-connector-c.
1 2OSError: mariadb_config not found. 3 4 This error typically indicates that MariaDB Connector/C, a dependency which 5 must be preinstalled, is not found. 6 If MariaDB Connector/C is not installed, see installation instructions 7 If MariaDB Connector/C is installed, either set the environment variable 8 MARIADB_CONFIG or edit the configuration file 'site.cfg' to set the 9 'mariadb_config' option to the file location of the mariadb_config utility. 10 11
- execute
brew install mariadb-connector-c
- execute
echo 'export PATH="/opt/homebrew/opt/mariadb-connector-c/bin:$PATH"' >> ~/.bashrc
- set environment variable
export MARIADB_CONFIG=$(brew --prefix mariadb-connector-c)/bin/mariadb_config
- execute
uv add mariadb
again.
Usage with Claude Desktop
Configuration File
Paths to Claude Desktop config file:
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this configuration to enable published servers
1 2{ 3 "mcpServers": { 4 "mcp_server_mariadb": { 5 "command": "/PATH/TO/uvx" 6 "args": [ 7 "mcp-server-mariadb", 8 "--host", 9 "${DB_HOST}", 10 "--port", 11 "${DB_PORT}", 12 "--user", 13 "${DB_USER}", 14 "--password", 15 "${DB_PASSWORD}", 16 "--database", 17 "${DB_NAME}" 18 ] 19 } 20 } 21} 22
Note: Replace these placeholders with actual paths:
/PATH/TO/uvx
: Full path to uvx executable
Add this configuration to enable development/unpublished servers
1{ 2 "mcpServers": { 3 "mcp_server_mariadb": { 4 "command": "/PATH/TO/uv", 5 "args": [ 6 "--directory", 7 "/YOUR/SOURCE/PATH/mcp-server-mariadb/src/mcp_server_mariadb", 8 "run", 9 "server.py" 10 ], 11 "env": { 12 "MARIADB_HOST": "127.0.0.1", 13 "MARIADB_USER": "USER", 14 "MARIADB_PASSWORD": "PASSWORD", 15 "MARIADB_DATABASE": "DATABASE", 16 "MARIADB_PORT": "3306" 17 } 18 } 19 } 20}
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 code
License
This mcp server is licensed under the MIT license. please see the LICENSE file in the repository.