Back to MCP Catalog

MariaDB Connector MCP Server

DatabasesPython
Access and query MariaDB databases with read-only operations
Available Tools

query_database

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.

Overview

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.

Installation

Prerequisites

Before installing the MariaDB Connector, ensure you have:

  1. A working MariaDB installation
  2. Python 3.10 or higher
  3. The 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

Installing the Package

Install the package using uv:

uv add mcp-server-mariadb

Configuration

For Claude Desktop

To configure the MariaDB Connector in Claude Desktop, you'll need to modify the configuration file located at:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Option 1: Using the published package

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.

Option 2: Using the development version

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.

Usage

Once configured, the MariaDB Connector will be available to your AI assistant. You can ask the assistant to:

  1. List available schemas in the database
  2. Execute read-only SQL queries against the database
  3. Analyze and interpret the returned data

The connector enforces read-only access, so operations that would modify the database (INSERT, UPDATE, DELETE, etc.) are not permitted.

Troubleshooting

If you encounter issues with the MariaDB Connector:

  1. Verify your database credentials are correct
  2. Ensure the MariaDB server is running and accessible
  3. Check that the user has appropriate permissions to access the specified database
  4. Confirm that the paths in your configuration file are correct

Related MCPs

Milvus Vector Database
DatabasesPython

Connect to Milvus vector database for semantic search and vector operations

MotherDuck DuckDB
DatabasesPython

SQL analytics with DuckDB and MotherDuck for AI assistants

Alibaba Cloud Tablestore
DatabasesJava, Python

Connect to Alibaba Cloud Tablestore for vector search and RAG applications

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.