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

@nilsir/mcp-server-mysql

v1.1.1

Published

MCP server for MySQL database operations

Readme

MCP Server MySQL

A Model Context Protocol (MCP) server that provides MySQL database operations. This server enables LLMs to interact with MySQL databases through a standardized protocol.

Features

  • Database Management: Create, drop, list, and switch databases
  • Table Operations: Create, alter, drop, describe, and list tables
  • Data Queries: Execute SELECT queries and retrieve results
  • Data Modification: Execute INSERT, UPDATE, DELETE statements
  • Index Management: Create and drop indexes

Installation

npm install
npm run build

Configuration

Set environment variables for database connection:

export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASSWORD=your-password
export MYSQL_DATABASE=your-database  # optional

Permission Controls

Control which write operations are allowed (all default to true):

export MYSQL_ALLOW_INSERT=true   # Set to "false" to disable INSERT
export MYSQL_ALLOW_UPDATE=true   # Set to "false" to disable UPDATE
export MYSQL_ALLOW_DELETE=false  # Set to "false" to disable DELETE

Or use the connect tool at runtime to specify connection parameters.

Supported AI Applications

This MCP server can be used with any application that supports the Model Context Protocol (MCP):

  • Claude Desktop - Anthropic's official desktop application
  • Claude Code - Anthropic's official CLI tool for developers
  • Cline - AI coding assistant VS Code extension
  • Zed - High-performance code editor with built-in AI
  • Any MCP-compatible application - MCP is an open protocol developed by Anthropic

Usage with Claude Desktop

Using npx (Recommended)

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@nilsir/mcp-server-mysql"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DATABASE": "your-database",
        "MYSQL_ALLOW_INSERT": "true",
        "MYSQL_ALLOW_UPDATE": "true",
        "MYSQL_ALLOW_DELETE": "false"
      }
    }
  }
}

Using Local Installation

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-mysql/dist/index.js"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DATABASE": "your-database",
        "MYSQL_ALLOW_INSERT": "true",
        "MYSQL_ALLOW_UPDATE": "true",
        "MYSQL_ALLOW_DELETE": "false"
      }
    }
  }
}

Available Tools

| Tool | Description | |------|-------------| | connect | Connect to a MySQL database | | query | Execute SELECT queries | | execute | Execute INSERT/UPDATE/DELETE queries | | list_databases | List all databases | | list_tables | List tables in a database | | describe_table | Get table structure | | create_table | Create a new table | | alter_table | Modify table structure | | drop_table | Drop a table | | create_database | Create a new database | | drop_database | Drop a database | | use_database | Switch to a database | | create_index | Create an index | | drop_index | Drop an index |

Examples

Query data

Use the query tool with sql: "SELECT * FROM users WHERE active = ?"
and params: [true]

Create a table

Use the create_table tool with:
- table: "users"
- columns: [
    {"name": "id", "type": "INT", "primaryKey": true, "autoIncrement": true},
    {"name": "email", "type": "VARCHAR(255)", "nullable": false},
    {"name": "created_at", "type": "TIMESTAMP", "default": "CURRENT_TIMESTAMP"}
  ]

Insert data

Use the execute tool with sql: "INSERT INTO users (email) VALUES (?)"
and params: ["[email protected]"]

License

MIT