Skip to main content
Glama
MariaDB MCP Server

MariaDB MCP Server

by bretoreta

MariaDB / MySQL Database Access MCP Server

This MCP server provides access to MariaDB / MySQL databases.

It allows you to:

  • List available databases

  • List tables in a database

  • Describe table schemas

  • Execute SQL queries

Security Features

  • Read-only access Default: SELECT, SHOW, DESCRIBE, and EXPLAIN

  • Query validation: Prevents SQL injection and blocks any data modification attempts

  • Query timeout: Prevents long-running queries from consuming resources

  • Row limit: Prevents excessive data return

Related MCP server: MySQL MCP Server

Installation

Option 1: Build from Source

# Clone the repository
git clone https://github.com/bretoreta/mariadb-mcp-server.git
cd mariadb-mcp-server

# Install dependencies and build
pnpm install
pnpm run build

2. Configure environment variables

The server requires the following environment variables:

  • MARIADB_HOST: Database server hostname

  • MARIADB_PORT: Database server port (default: 3306)

  • MARIADB_USER: Database username

  • MARIADB_PASSWORD: Database password

  • MARIADB_DATABASE: Default database name (optional)

  • MARIADB_ALLOW_INSERT: false

  • MARIADB_ALLOW_UPDATE: false

  • MARIADB_ALLOW_DELETE: false

  • MARIADB_TIMEOUT_MS: 10000

  • MARIADB_ROW_LIMIT: 1000

3. Add to MCP settings

Add the following configuration to your MCP settings file:

If you built from source:

{
  "mcpServers": {
    "mariadb": {
      "command": "node",
      "args": ["/path/to/mariadb-mcp-server/dist/index.js"],
      "env": {
        "MARIADB_HOST": "your-host",
        "MARIADB_PORT": "3306",
        "MARIADB_USER": "your-user",
        "MARIADB_PASSWORD": "your-password",
        "MARIADB_DATABASE": "your-default-database",
        "MARIADB_ALLOW_INSERT": "false",
        "MARIADB_ALLOW_UPDATE": "false",
        "MARIADB_ALLOW_DELETE": "false",
        "MARIADB_TIMEOUT_MS": "10000",
        "MARIADB_ROW_LIMIT": "1000",
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Available Tools

list_databases

Lists all accessible databases on the MariaDB / MySQL server. Parameters: None

Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "sessionId": "session_id from /sse call",
    "name": "list_databases"
  }
}

list_tables

Lists all tables in a specified database.

Parameters:

  • database (optional): Database name (uses default if not specified)

Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "sessionId": "session_id from /sse call",
    "name": "list_tables",
    "database": "my_database_name"
  }
}

describe_table

Shows the schema for a specific table.

Parameters:

  • database (optional): Database name (uses default if not specified)

  • table (required): Table name

Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "sessionId": "session_id from /sse call",
    "name": "describe_table",
    "database": "my_database_name",
    "table": "my_table_name"
  }
}

execute_query

Executes a SQL query.

Parameters:

  • query (required): SQL query

  • database (optional): Database name (uses default if not specified)

Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "sessionId": "session_id from /sse call",
    "name": "execute_query",
    "query": "SELECT * FROM my_table LIMIT 10"
  }
}

Testing

The server automatically tests MariaDB to verify functionality with your MariaDB setup:

Troubleshooting

If you encounter issues:

  1. Check the server logs for error messages

  2. Verify your MariaDB credentials and connection details

  3. Ensure your MariaDB user has appropriate permissions

  4. Check that your query is read-only and properly formatted

Inspiration https://github.com/rjsalgado/mariadb-mcp-server

License

This project is licensed under the MIT License - see the LICENSE file for details.

Available Tools

4 tools
describe_tableB

Show the schema for a specific table

Inputs: table (required), database.

execute_queryC

Execute a SQL query

Inputs: query (required), database.

list_databasesB

List all accessible databases on the MariaDB server

Inputs: no named parameters.

list_tablesC

List all tables in a specified database

Inputs: database.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: describe_table shows table schemas, execute_query runs SQL queries, list_databases enumerates databases, and list_tables lists tables within a database. The boundaries are well-defined, preventing agent misselection.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (describe_table, execute_query, list_databases, list_tables) with clear, descriptive verbs. There are no deviations in style or convention, making the set predictable and readable.

    Tool Count4/5

    Four tools is reasonable for a MariaDB server, covering core operations like listing databases/tables, describing schemas, and executing queries. It feels slightly thin as it lacks CRUD operations (e.g., create_table, insert_data), but it's well-scoped for basic database inspection and query execution.

    Completeness3/5

    The tools provide good coverage for database inspection and query execution, but there are notable gaps in CRUD operations (e.g., no create_table, update_data, or delete_table). Agents can work around this using execute_query, but the surface is incomplete for full database management workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables interaction with MariaDB databases through secure read-only operations. Supports database exploration, schema inspection, and SQL query execution with comprehensive logging and connection pooling.
      5
      2
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables read-only MySQL database access, allowing listing databases, tables, describing schemas, and executing SELECT/SHOW/DESCRIBE/EXPLAIN queries.
      7
      30 npm
      4
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides read-only MySQL query execution, database/table browsing, and table structure inspection with SQL safety validation.
      5
      9 npm
      MIT