MySQL Database Access MCP Server

SSE

by MCP-Mirror

2.7k downloads Not rated yet MIT license

About

This MCP server provides read-only access to MySQL databases. It allows listing databases, listing tables, describing table schemas, and executing read-only SQL queries. It is designed for developers who need safe, read-only database exploration and querying via the Model…

Details

Transport
SSE
License
MIT license

Explore

- Read-only access: Only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed
- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MySQL Database Access MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository


npm install -g mysql-mcp-server

npm install mysql-mcp-server

npm install
npm run build


The server requires the following environment variables:

- MYSQL_HOST: Database server hostname
- MYSQL_PORT: Database server port (default: 3306)
- MYSQL_USER: Database username
- MYSQL_PASSWORD: Database password
- MYSQL_DATABASE: Default database name (optional)

This script creates a test database, table, and sample data:

bash

export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=your_username
export MYSQL_PASSWORD=your_password

npm run test:setup
```

list_databases

List all accessible databases on the MySQL server

list_tables

List all tables in a specified database

describe_table

Show the schema for a specific table

execute_query

Execute a read-only SQL query

This script tests each of the MCP tools against the test database:

```bash

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mysql database access mcp server": {
            "mysql": {
                "command": "npx",
                "args": [
                    "mysql-mcp-server"
                ],
                "env": {
                    "MYSQL_HOST": "",
                    "MYSQL_PORT": "",
                    "MYSQL_USER": "",
                    "MYSQL_PASSWORD": "",
                    "MYSQL_DATABASE": ""
                }
            }
        }
    }
}

McpServers

{
    "mysql": {
        "command": "npx",
        "args": [
            "mysql-mcp-server"
        ],
        "env": {
            "MYSQL_HOST": "",
            "MYSQL_PORT": "",
            "MYSQL_USER": "",
            "MYSQL_PASSWORD": "",
            "MYSQL_DATABASE": ""
        }
    }
}

This MCP server provides read-only access to MySQL databases. It allows you to:

- List available databases
- List tables in a database
- Describe table schemas
- Execute read-only SQL queries

Security Features

- Read-only access: Only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed
- 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

Installation

Option 1: Install from NPM (Recommended)

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.