home / mcp / mariadb mcp server

MariaDB MCP Server

An mcp server that provides read-only access to MariaDB.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "abel9851-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}"
      ],
      "env": {
        "MARIADB_HOST": "DB_HOST_PLACEHOLDER",
        "MARIADB_PORT": "DB_PORT_PLACEHOLDER",
        "MARIADB_USER": "DB_USER_PLACEHOLDER",
        "MARIADB_DATABASE": "DB_NAME_PLACEHOLDER",
        "MARIADB_PASSWORD": "DB_PASSWORD_PLACEHOLDER"
      }
    }
  }
}

You can run an MCP server that retrieves and exposes data from a MariaDB database. This server lets you query MariaDB data through the MCP protocol, enabling client tools to read data efficiently and securely from your database. It supports running in local development or via an MQTT-like MCP runtime with a configured host, port, and credentials.

How to use

You will interact with the MariaDB MCP server from an MCP client. Start the server locally or remotely, provide your database connection details, and then connect your MCP client to the server using the MCP URL or the local stdio entry. Once connected, you can query your MariaDB schema to retrieve data and expose available resources such as the database schema list to the client.

How to install

Prerequisites: you need Python to run the server and a MariaDB client stack installed. If you will run a local development server, you may also need the MariaDB Connector/C on macOS.

Install MariaDB and the connector on macOS to avoid common installation errors.

Follow these steps to prepare the environment on macOS:

# Install MariaDB Connector/C to satisfy build-time dependency
brew install mariadb-connector-c

# Ensure the connector binaries are in your PATH
echo 'export PATH="/opt/homebrew/opt/mariadb-connector-c/bin:$PATH"' >> ~/.bashrc

# Point the build system to the mariadb_config utility
export MARIADB_CONFIG=$(brew --prefix mariadb-connector-c)/bin/mariadb_config

# Re-run the MCP server addition for MariaDB after satisfying the dependency
uv add mariadb

Additional setup notes

If you are running on macOS and encounter an OSError: mariadb_config not found, install MariaDB Connector/C and set the MARIADB_CONFIG variable to the mariadb_config path, then retry adding the MCP server.

Available tools

query_database

Execute read-only operations against MariaDB to retrieve data and expose results to MCP clients.