MariaDB / MySQL Database Access MCP Server
rjsalgado/mariadb-mcp-server · 14 stars · JavaScript · MIT
MCP server An MCP server that provides access to MariaDB ou MySQL databases.
Install
The repo has no one-line install. Follow its README.
Files
MariaDB / MySQL MCP Server
This MCP server exposes MariaDB and MySQL databases to MCP clients such as Claude Desktop, VS Code, and other compatible tools.
It provides tools to:
- list available databases
- list tables in a database
- describe table schemas
- execute SQL queries
Features
- Safe-by-default behavior: read-only access is enabled by default
- Query validation to block disallowed statements and reduce injection risk
- Configurable write permissions through environment variables
- Timeout and row-limit protection
- Numeric safety for insert IDs and BIGINT values returned by the MariaDB driver
Installation
Option 1: Install from npm
npm install -g mariadb-mcp-server
Option 2: Install locally
npm install mariadb-mcp-server
Option 3: Build from source
git clone https://github.com/rjsalgado/mariadb-mcp-server.git cd mariadb-mcp-server npm install npm run build
Configuration
Set the following environment variables before starting the server:
MARIADB_HOST: Database hostMARIADB_PORT: Database port (default:3306)MARIADB_USER: Database usernameMARIADB_PASSWORD: Database passwordMARIADB_DATABASE: Default database name (optional)MARIADB_ALLOW_INSERT: EnableINSERTstatements (true/false)MARIADB_ALLOW_UPDATE: EnableUPDATEstatements (true/false)MARIADB_ALLOW_DELETE: EnableDELETEstatements (true/false)MARIADB_TIMEOUT_MS: Query timeout in milliseconds (default:10000)MARIADB_ROW_LIMIT: Maximum number of rows returned (default:1000)
Example:
export MARIADB_HOST=localhost export MARIADB_PORT=3306 export MARIADB_USER=myuser export MARIADB_PASSWORD=mypassword export MARIADB_DATABASE=mydb export MARIADB_ALLOW_INSERT=false export MARIADB_ALLOW_UPDATE=false export MARIADB_ALLOW_DELETE=false export MARIADB_TIMEOUT_MS=10000 export MARIADB_ROW_LIMIT=1000
MCP configuration
Using npm package
{
"mcpServers": {
"mariadb": {
"command": "npx",
"args": ["mariadb-mcp-server"],
"env": {
"MARIADB_HOST": "your-host",
"MARIADB_PORT": "3306",
"MARIADB_USER": "your-user",
"MARIADB_PASSWORD": "your-password",
"MARIADB_DATABASE": "your-database",
"MARIADB_ALLOW_INSERT": "false",
"MARIADB_ALLOW_UPDATE": "false",
"MARIADB_ALLOW_DELETE": "false",
"MARIADB_TIMEOUT_MS": "10000",
"MARIADB_ROW_LIMIT": "1000"
},
"disabled": false,
"autoApprove": []
}
}
}
Using a built local server
{
"mcpServers": {
"mariadb": {
"command": "node",
"args": ["/absolute/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-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
The server registers the following MCP tools:
list_databases
Lists all databases accessible to the configured user.
list_tables
Lists tables from a specific database.
Parameters:
database(optional): database name to inspect
describe_table
Returns the schema of a specific table.
Parameters:
database(optional): database nametable(required): table name
execute_query
Executes a SQL query.
Parameters:
database(optional): database namequery(required): SQL statement to run
Testing
The repository includes scripts to validate the server against a MariaDB or MySQL instance.
npm run test:setup npm run test:tools
Or run everything together:
npm test
Notes
- The server is safe-by-default and only allows read-only operations unless the write flags are explicitly enabled.
- Write operations are still subject to query validation and runtime limits.
Troubleshooting
If you encounter issues:
- Check the server logs for error messages
- Verify your MariaDB/MySQL credentials and connection details
- Ensure your MariaDB/MySQL user has appropriate permissions
- Check that your query is read-only and properly formatted
Inspiration https://github.com/dpflucas/mysql-mcp-server
License
This project is licensed under the MIT License - see the LICENSE file for details.
Facts
- Kind
- MCP server
- Group
- Uncategorized
- Stars
- 14
- License
- MIT
- Language
- JavaScript
- Last push
- 2026-07-17
- Forks
- 8
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k