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

@yevlakhov/mysql-mcp

v1.0.0

Published

MCP server for MySQL/MariaDB database queries

Downloads

20

Readme

MySQL MCP Server

MCP (Model Context Protocol) server for MySQL/MariaDB that allows LLMs in AI IDEs (Cursor, VS Code with Copilot, etc.) to execute SQL queries against the database.

Installation

npm install -g @yevlakhov/mysql-mcp

Or run via npx without installation:

npx @yevlakhov/mysql-mcp

Configuration in Cursor

Add to MCP servers settings (~/.cursor/mcp.json or in project settings):

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@yevlakhov/mysql-mcp"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database",
        "ALLOW_INSERT_OPERATION": "false",
        "ALLOW_UPDATE_OPERATION": "false",
        "ALLOW_DELETE_OPERATION": "false"
      }
    }
  }
}

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | MYSQL_HOST | MySQL server host | 127.0.0.1 | | MYSQL_PORT | MySQL server port | 3306 | | MYSQL_USER | Username | root | | MYSQL_PASSWORD | Password | empty string | | MYSQL_DATABASE | Database name | empty string | | ALLOW_INSERT_OPERATION | Allow INSERT queries | false | | ALLOW_UPDATE_OPERATION | Allow UPDATE queries | false | | ALLOW_DELETE_OPERATION | Allow DELETE queries | false |

Available Tools

mysql_query

Execute SELECT queries to read data.

Example: SELECT * FROM users WHERE id = ?

mysql_insert

Execute INSERT queries (requires ALLOW_INSERT_OPERATION=true).

Example: INSERT INTO users (name, email) VALUES (?, ?)

mysql_update

Execute UPDATE queries (requires ALLOW_UPDATE_OPERATION=true).

Example: UPDATE users SET name = ? WHERE id = ?

mysql_delete

Execute DELETE queries (requires ALLOW_DELETE_OPERATION=true).

Example: DELETE FROM users WHERE id = ?

mysql_describe

Get table structure (columns, types, keys).

mysql_list_tables

List all tables in the current database.

Security

  • By default, INSERT, UPDATE and DELETE operations are disabled
  • Each query is shown to the user and requires confirmation in the IDE
  • Prepared statements are used for SQL injection protection
  • It is recommended to use a database user with minimal required privileges

Usage Examples

After configuration, you can ask the AI in chat:

  • "Show all tables in the database"
  • "What is the structure of the users table?"
  • "Select all users registered in the last month"
  • "Add a new user with name John and email [email protected]"

The AI will automatically generate the SQL query and send it via MCP. Before executing the query, the IDE will display it and ask for confirmation.

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build
npm run build

# Run built version
npm start

License

MIT