npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-mysql-multi-db

v2.1.1

Published

A Model Context Protocol (MCP) server for MySQL database with multi-database support

Downloads

451

Readme

mcp-mysql-multi-db

A Model Context Protocol (MCP) server for MySQL database with multi-database support.

Features

  • Multi-database support - Query multiple databases from a single MCP server
  • Custom port support - Connect to MySQL on any port (not just 3306)
  • Timezone support - Configure timezone for correct datetime display (default: China +08:00)
  • Auto-reconnect - Automatically reconnect when connection is lost (e.g., after sleep/hibernate)
  • BIGINT precision - Large numbers are returned as strings to avoid precision loss
  • ✅ Query execution (SELECT)
  • ✅ Data modification (INSERT, UPDATE, DELETE)
  • ✅ List all tables
  • ✅ Describe table structure

Installation

npx -y mcp-mysql-multi-db

Configuration

Windsurf / Cursor IDE

Add to your MCP configuration file:

Windsurf: ~/.codeium/windsurf/mcp_config.json

Cursor: ~/.cursor/mcp.json

Single Database (backward compatible)

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "mcp-mysql-multi-db"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

Multiple Databases (new feature)

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "mcp-mysql-multi-db"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASES": "clx_performance,purchase_manage"
      }
    }
  }
}

When multiple databases are configured, tools will be generated with database suffixes:

  • query_clx_performance, query_purchase_manage
  • execute_clx_performance, execute_purchase_manage
  • list_tables_clx_performance, list_tables_purchase_manage
  • describe_table_clx_performance, describe_table_purchase_manage

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | MYSQL_HOST | MySQL server hostname | localhost | | MYSQL_PORT | MySQL server port | 3306 | | MYSQL_USER | MySQL username | root | | MYSQL_PASSWORD | MySQL password | (empty) | | MYSQL_DATABASE | Single database name (backward compatible) | (empty) | | MYSQL_DATABASES | Multiple database names, comma-separated | (empty) | | MYSQL_TIMEZONE | Timezone for datetime fields (e.g., '+08:00', 'Asia/Shanghai') | +08:00 | | ALLOW_DDL | Allow DDL operations (CREATE, ALTER, DROP, TRUNCATE, RENAME) | false | | ALLOW_DML | Allow DML operations (INSERT, UPDATE, DELETE, REPLACE) | false |

Permission Control

By default, this MCP server runs in read-only mode. DDL and DML operations are disabled for safety.

To enable write operations, set the corresponding environment variables:

{
  "env": {
    "MYSQL_HOST": "localhost",
    "MYSQL_PORT": "3306",
    "MYSQL_USER": "root",
    "MYSQL_PASSWORD": "your_password",
    "MYSQL_DATABASE": "your_database",
    "ALLOW_DML": "true",
    "ALLOW_DDL": "true"
  }
}

Available Tools

query

Execute a SELECT query on the MySQL database.

SELECT * FROM users LIMIT 10

execute

Execute INSERT, UPDATE, or DELETE queries.

INSERT INTO users (name, email) VALUES ('John', '[email protected]')

list_tables

List all tables in the current database.

describe_table

Get the structure of a specific table.

Example Usage

After configuring the MCP server, you can use it in your AI assistant:

  • "Show me all tables in the database"
  • "Query the first 10 users"
  • "Describe the orders table structure"

Why This Package?

Most MySQL MCP packages don't support custom ports. This package was created to solve that problem - simply set MYSQL_PORT environment variable to connect to MySQL on any port.

License

MIT

Author

wejack639