mcpField
M
MCP Server MySQL Database Explorer

MCP Server MySQL Database Explorer

Local
github.com/eth-ts-xDatabases1Updated 77w ago

About MCP Server MySQL Database Explorer

An MCP server that connects LLMs to MySQL schemas, tables, sample data, and read-only SQL query capabilities. It validates queries before execution.

Key features

  1. 01Connect to MySQL
  2. 02Expose schemas, table definitions, and sample data as resources
  3. 03Run validated read-only SQL queries

Use cases

  1. 01Explore database schemas and tables
  2. 02Inspect sample data
  3. 03Run read-only SQL queries

MCP support

The MCP server exposes schema, table-definition, and sample-data resources, along with read-only SQL querying for MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP Server MySQL Database Explorer

This MCP server connects to your MySQL database, providing seamless access to database schemas, tables, and query capabilities through LLMs.

Features

  • Connect to your MySQL database

  • Expose table schemas, create statement and Sample data as resources

  • Run read-only SQL queries with secure validation

Setup Instructions

  1. Install Dependencies

Project requires "uv" to be installed, here is "uv" installation instruction: https://docs.astral.sh/uv/getting-started/installation/#pypi


uv add "mcp[cli]" aiomysql

  1. Configure Environment Variables

Create a .env file at the project root path with your database credentials:


MYSQL_HOST=localhost

MYSQL_PORT=3306

MYSQL_USER=root

MYSQL_PASSWORD=YOUR_PASSWORD

MYSQL_DB=YOUR_DB

MYSQL_POOL_SIZE=10

Or set these variables directly in your environment.

  1. **Run in MCP interceptor

uv run mcp dev main.py

Navigate to http://127.0.0.1:6274/, then change the argument to this:

run --env-file=.env main.py

Click "Connect" to test the server

  1. **Install the MCP Server in MCP Client (e.g. Cline, Cursor)

Paste the JSON setting to your MCP Client:


{
    "mcpServers": {
        "mcp-server-mysql-pool": {
            "command": "uv",
            "args": [
                "--directory",
                "YOUR/PROJECT/ROOT/PATH",
                "run",
                "main.py"
            ],
            "env": {
                "MYSQL_HOST": "localhost",
                "MYSQL_PORT": "3306",
                "MYSQL_USER": "YOUR_USER",
                "MYSQL_PASSWORD": "YOUR_PASSWORD",
                "MYSQL_DB": "YOUR_DB",
                "MYSQL_POOL_SIZE": "10"
            },
            "autoApprove": [
                "query"
            ]
        }
    }
}

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.