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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mcp-server-mysql

v1.0.42

Published

MCP server for interacting with MySQL databases (READ-ONLY) with optimized caching

Downloads

2,158

Readme

MCP Server MySQL

MCP server for interacting with MySQL databases with read-only query support.

Requirements

  • Node.js 20 or higher is required
  • MySQL database connection

Quick Start

Step 1: Install Node.js 20

You need Node.js 20 or higher. Choose one of the following methods:

Option A: Using nvm (Recommended)

If you have nvm installed:

nvm install 20
nvm use 20

If you don't have nvm, install it first:

  • macOS/Linux: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
  • Windows: Use nvm-windows

Option B: Direct Installation

Download and install Node.js 20 from nodejs.org

Step 2: Verify Node.js Version

node --version

Should show v20.x.x or higher.

Step 3: Configure MCP in Cursor

Add to your ~/.cursor/mcp.json:

Single Database Configuration

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "mcp-server-mysql@latest"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "your_password",
        "MYSQL_DB": "your_database"
      }
    }
  }
}

Step 4: Restart Cursor

After configuring, restart Cursor to load the MCP server.

Troubleshooting

Error: "This package requires Node.js 20 or higher"

Solution:

  1. If using nvm:

    nvm install 20
    nvm use 20

    Then restart Cursor.

  2. If not using nvm:

    • Install Node.js 20 from nodejs.org
    • Make sure Node.js 20 is in your PATH
    • Restart your terminal and Cursor
  3. Verify installation:

    node --version

    Should show v20.x.x or higher.

Server closes immediately

  • Check MySQL connection settings in your MCP config
  • Ensure MySQL server is running
  • Verify database credentials are correct

Environment Variables

Database Connection

  • MYSQL_HOST - MySQL host (default: 127.0.0.1)
  • MYSQL_PORT - MySQL port (default: 3306)
  • MYSQL_USER - MySQL username (default: root)
  • MYSQL_PASS - MySQL password
  • MYSQL_DB - MySQL database name (optional, enables multi-DB mode if not set)
  • MYSQL_SOCKET_PATH - Unix socket path (alternative to host/port)
  • MYSQL_SSL - Enable SSL (set to "true" to enable)

Multi-Instance Support

  • MCP_DB_NAME - Database identifier/name for multi-instance setups (optional)
    • Used to identify which database instance is active
    • Appears in tool descriptions and logs
    • Defaults to MYSQL_DB value or "default"
    • Recommended when using multiple database configurations

Cache Configuration

  • TABLE_LIST_CACHE_TTL_MS - Cache TTL in milliseconds (default: 18000000 = 5 hours)
  • ENABLE_TABLE_LIST_CACHE - Enable/disable caching (default: true, set to "false" to disable)

Other Configuration

  • ENABLE_LOGGING - Enable debug logging (set to "true" to enable)
  • MYSQL_DISABLE_READ_ONLY_TRANSACTIONS - Disable read-only transactions (set to "true" to disable)

Features

  • Read-only SELECT queries
  • Multi-database mode support
  • Automatic dependency installation via npx
  • Node.js 20+ requirement with clear error messages

License

MIT