mariadb
MCP Server for MariaDB
claude mcp add --transport stdio bretoreta-mariadb-mcp-server node /path/to/mariadb-mcp-server/dist/index.js \ --env MARIADB_HOST="your-host" \ --env MARIADB_PORT="3306" \ --env MARIADB_USER="your-user" \ --env MARIADB_DATABASE="your-default-database" \ --env MARIADB_PASSWORD="your-password" \ --env MARIADB_ROW_LIMIT="1000" \ --env MARIADB_TIMEOUT_MS="10000" \ --env MARIADB_ALLOW_DELETE="false" \ --env MARIADB_ALLOW_INSERT="false" \ --env MARIADB_ALLOW_UPDATE="false"
How to use
This MCP server provides read-only access to a MariaDB or MySQL database. It exposes tools to list databases, list tables within a database, describe table schemas, and execute SQL queries in a controlled, read-only fashion. The server enforces query validation, a timeout to prevent long-running operations, and a row limit to avoid returning excessive data. Clients interact with the server via the available tools (list_databases, list_tables, describe_table, execute_query) using JSON-RPC style requests as shown in the examples. By default, only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed, with insert/update/delete disallowed unless explicitly configured otherwise.
How to install
Prerequisites:
- Node.js installed on the host (version compatible with the server)
- Git installed
- Access to a running MariaDB/MySQL instance
Install 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
-
Prepare environment variables (example values shown below). Create a runtime environment or a .env file with these values: 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
-
Add to MCP settings (example configuration): { "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": [] } } }
Additional notes
Tips and caveats:
- The server is configured for read-only access by default; attempting to run INSERT, UPDATE, or DELETE queries will be blocked unless you explicitly adjust the environment variables.
- Ensure your MariaDB user has the necessary network access and privileges to list databases, show tables, and describe schemas.
- If you encounter timeouts, consider increasing MARIADB_TIMEOUT_MS or adjusting MARIADB_ROW_LIMIT to suit your data size.
- Use the execute_query tool with carefully constructed SELECT statements to fetch only the needed data and avoid excessive payloads.
- When deploying in production, consider securing the MCP endpoint and rotating credentials regularly.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.