home / mcp / mysql mcp server

MySQL MCP Server

Provides a lightweight MCP server to manage MySQL connections, execute queries, and inspect schemas with persistent storage.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "araxiaonline-mysql-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "/path/to/config:/app/config",
        "mysql-mcp"
      ],
      "env": {
        "MCP_CONFIG_PATH": "/app/config",
        "MYSQL_CONNECTIONS": "[{\"name\": \"prod\", \"host\": \"mysql.example.com\", \"port\": 3306, \"user\": \"admin\", \"password\": \"secret\", \"database\": \"myapp\"}]"
      }
    }
  }
}

You run a lightweight MCP server that manages multiple MySQL connections, executes parameterized queries, and inspects schemas. It stores connection configs locally for persistence and runs in a minimal Docker container for easy deployment and portability.

How to use

You interact with the MySQL MCP Server by starting the MCP container and then issuing operations through your MCP client. You can add named connections, list them, run SQL queries on a specific connection, and inspect databases and tables. All connection configurations are stored locally so they survive container restarts, and you can pre-load them via environment variables when starting the server.

Key workflows you will perform frequently include:

  • Add a new MySQL connection with a unique name and the host, port, user, password, and default database you want to use.
  • List all active connections to see which ones are available for querying.
  • Execute SQL queries on a chosen connection, using parameter placeholders to prevent injection.
  • List databases and tables for a connection and describe table structures to understand schemas.
  • Persist your configuration by mounting a directory so changes survive container restarts.

Available tools

add_connection

Add a new MySQL connection with a unique name.

remove_connection

Remove an existing MySQL connection.

list_connections

List all active MySQL connections.

execute_query

Execute SQL queries on a named connection with optional parameters.

list_databases

List databases available on a specific connection.

list_tables

List tables within a selected database.

describe_table

Describe the schema of a specified table.