Server facts
MCP Server for MySQL
Project
- Author
- benborla
- Repository
- github.com/benborla/mcp-server-mysql
- License
- MIT
- Category
- Databases
Tech
- Runtime / language
- node
- Transports
- stdio
- Remote available
- No
- Authentication
- Not specified
Activity
- GitHub stars
- 2,166
- Last commit
- Data as of
Tags
- Database Security
- Mysql
- Read Only
- Schema Inspection
- Sql
Overview
MCP Server for MySQL connects Claude and other language-model clients to MySQL databases for schema inspection and SQL execution. Its named query tool runs SQL, while a separate resource presents table and column metadata. Read-only behavior is the default: insert, update, and delete operations each require an explicit environment flag. This gives the integration a clearer separation between exploratory database access and workflows that modify records. The README also highlights per-database permissions and multi-database operation without reconnecting, which are useful when a single assistant needs to work across more than one schema.
The documented feature set includes built-in SSH tunneling for remote databases, automatic masking of sensitive result data, and encrypted database connections with an optional mutual-TLS setup. A remote HTTP mode with bearer authentication is listed, while the quick-start client examples launch the npm package locally. Those examples supply host, port, username, password, and database through environment variables. Requirements are Node.js 20 or newer and MySQL 5.7 or newer, with MySQL 8.0 or newer recommended. A database user must have privileges appropriate to the intended operations. Detailed remote deployment, redaction behavior, and advanced configuration are delegated to linked documentation rather than fully described in the supplied README. Users can therefore start with the documented read-only local configuration before deliberately enabling broader permissions.
Install & configure
Requirements
- Node.js 20 or newer
- MySQL 5.7 or newer; 8.0 or newer recommended
- A MySQL account with suitable privileges
- An MCP-compatible client
npx -y @benborla29/mcp-server-mysqlThe local quick-start remains read-only unless write flags are enabled. ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, and ALLOW_DELETE_OPERATION opt into the corresponding writes. HTTP remote mode is listed but its setup is delegated to other documentation.
Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mcp-server-mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MySQL server hostname or address>",
"MYSQL_PORT": "<MySQL server port>",
"MYSQL_USER": "<MySQL username with appropriate privileges>",
"MYSQL_PASS": "<MySQL user password>",
"MYSQL_DB": "<Target database name>"
}
}
}
}Config file · Project: .cursor/mcp.json
User: ~/.cursor/mcp.json
The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mcp-server-mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MySQL server hostname or address>",
"MYSQL_PORT": "<MySQL server port>",
"MYSQL_USER": "<MySQL username with appropriate privileges>",
"MYSQL_PASS": "<MySQL user password>",
"MYSQL_DB": "<Target database name>"
}
}
}
}Config file · Workspace: .vscode/mcp.json
For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.
{
"servers": {
"mcp-server-mysql": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MySQL server hostname or address>",
"MYSQL_PORT": "<MySQL server port>",
"MYSQL_USER": "<MySQL username with appropriate privileges>",
"MYSQL_PASS": "<MySQL user password>",
"MYSQL_DB": "<Target database name>"
}
}
}
}Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mcp-server-mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MySQL server hostname or address>",
"MYSQL_PORT": "<MySQL server port>",
"MYSQL_USER": "<MySQL username with appropriate privileges>",
"MYSQL_PASS": "<MySQL user password>",
"MYSQL_DB": "<Target database name>"
}
}
}
}Config file · Project scope: .mcp.json at the repository root
The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"mcp-server-mysql": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MySQL server hostname or address>",
"MYSQL_PORT": "<MySQL server port>",
"MYSQL_USER": "<MySQL username with appropriate privileges>",
"MYSQL_PASS": "<MySQL user password>",
"MYSQL_DB": "<Target database name>"
}
}
}
}Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Tools
Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.
| Tool | What it does |
|---|---|
| mysql_query | Execute SQL with read-only defaults and individually enabled write operations. |
Names, permissions, and defaults can change. Check the current upstream documentation before granting access.
Use cases
- Inspect table and column metadata from an AI client.
- Run read-only SQL for database exploration.
- Enable selected data modifications through explicit operation flags.
- Query multiple databases or reach a remote database through SSH.
Strengths
- Keeps write operations disabled by default.
- Documents schema-specific permissions and automatic PII masking.
- Supports SSH tunneling and SSL/TLS with an mTLS option.
Limitations
- Requires Node.js 20 or newer and MySQL 5.7 or newer.
- Advanced remote-mode and redaction configuration are delegated to separate documentation.
Frequently asked questions
Independent listing, not an affiliation or security review. Grant the least access needed and verify the upstream instructions before running code.