Get the FREE Ultimate OpenClaw Setup Guide →

mcp -mariadb

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio abel9851-mcp-server-mariadb uvx mcp-server-mariadb \
  --env MARIADB_HOST="host of MariaDB database" \
  --env MARIADB_PORT="port of MariaDB database" \
  --env MARIADB_USER="username for MariaDB" \
  --env MARIADB_DATABASE="database name" \
  --env MARIADB_PASSWORD="password for MariaDB"

How to use

This MCP server implementation provides an interface to retrieve data from a MariaDB database and exposes a tool named query_database for executing read-only operations against MariaDB. The server is designed to be run via UV (uvx) or UV in development mode, and it can connect to a MariaDB instance using environment variables such as MARIADB_HOST, MARIADB_PORT, MARIADB_USER, MARIADB_PASSWORD, and MARIADB_DATABASE. Once running, you can query the database schema and perform read-only data retrieval through the exposed MCP commands. To use, start the server with UV and point it at the mcp-server-mariadb entry, then invoke query_database to fetch data from MariaDB according to the MCP protocol.

How to install

  • Prerequisites:

    • MariaDB server or accessible MariaDB instance
    • MariaDB Connector/C installed (needed for some environments)
    • UV toolchain (uvx or uv) installed and available in PATH
  • Install MariaDB Connector/C if requested by your OS package manager (example for macOS):

    brew install mariadb-connector-c
    
  • Ensure mariadb_config is available or set MARIADB_CONFIG to the path of mariadb_config:

    export MARIADB_CONFIG=$(brew --prefix mariadb-connector-c)/bin/mariadb_config
    
  • Install or set up UV/uvx tooling if not already installed. The project expects UV to run the MCP server:

    • UVX usage (example):
      # If you have a local install of the MCP server package, you can run it with uvx
      uvx mcp-server-mariadb --host <host> --port <port> --user <user> --password <password> --database <database>
      
  • Start the MCP server via UV/uvx with appropriate environment variables (example):

    export MARIADB_HOST=127.0.0.1
    export MARIADB_PORT=3306
    export MARIADB_USER=root
    export MARIADB_PASSWORD=secret
    export MARIADB_DATABASE=mydb
    uvx mcp-server-mariadb
    

Additional notes

  • Environment variables:

    • MARIADB_HOST: host where MariaDB is running
    • MARIADB_PORT: port of MariaDB (default 3306)
    • MARIADB_USER: username to connect
    • MARIADB_PASSWORD: password for the user
    • MARIADB_DATABASE: default database to connect to
  • If you encounter issues related to MariaDB Connector/C not found, ensure the connector is installed and that mariadb_config is discoverable, or set MARIADB_CONFIG to the full path of mariadb_config.

  • The server exposes a tool named query_database to perform read-only operations against MariaDB. Use this for schema exploration and data retrieval without modifying data.

  • For development/unpublished servers, you can run the server from source by pointing UV to your local path and using a directory run for server.py as shown in the README example, adjusting paths to your environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers