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

@maksimer/mysql-mcp

v1.0.2

Published

Model Context Protocol (MCP) server for MySQL via Unix socket. Perfect for Local WP

Downloads

12

Readme

MySQL MCP Server (Unix Socket Connection)

A Model Context Protocol (MCP) server that allows LLMs to connect to MySQL databases using Unix sockets. This server provides read-only access to MySQL databases with comprehensive analysis tools.

Features

  • Connect to MySQL databases via Unix socket
  • Execute SQL queries directly from LLM tools (SELECT queries only - read-only)
  • List tables in a database
  • Describe table structures
  • Get index information for tables
  • View foreign key relationships
  • Analyze query execution plans
  • Retrieve table statistics and metrics
  • Profile query performance
  • Secure connection using local Unix socket
  • Protection against SQL injection and data modification

Installation

Option 1: Install from npm (recommended)

npm install @maksimer/mysql-mcp

Option 2: Install from source

  1. Clone this repository
  2. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

The server uses the following environment variables for configuration:

  • MYSQL_SOCKET_PATH: Path to the MySQL Unix socket (default: /tmp/mysql.sock)
  • MYSQL_USER: MySQL username (default: root)
  • MYSQL_PASSWORD: MySQL password (default: empty)
  • MYSQL_DATABASE: Default database to use (optional)

For LocalWP MySQL connections, the socket path is typically in a format like: /Users/username/Library/Application Support/Local/run/SITE_ID/mysql/mysqld.sock

Usage

As a standalone MCP server

Start the server:

npx maksimer-mysql-mcp

Or with custom environment variables:

MYSQL_SOCKET_PATH=/path/to/socket MYSQL_USER=myuser MYSQL_PASSWORD=mypassword MYSQL_DATABASE=mydb npx maksimer-mysql-mcp

In a Node.js project

// ESM import
import { startMysqlMcpServer } from '@maksimer/mysql-mcp';

// Start the server with custom configuration
startMysqlMcpServer({
  socketPath: '/path/to/mysql.sock',
  user: 'root',
  password: 'password',
  database: 'wordpress'
});

Integrating with Claude for Desktop

To use this MCP server with Claude for Desktop:

  1. Edit the Claude for Desktop configuration file at:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %AppData%\Claude\claude_desktop_config.json
  2. Add the following configuration:

{
  "mcpServers": {
    "maksimer-mysql-mcp": {
      "command": "npx",
      "args": [
        "@maksimer/mysql-mcp"
      ],
      "env": {
        "MYSQL_SOCKET_PATH": "/path/to/mysql.sock",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}
  1. Restart Claude for Desktop

Available Tools

Once connected, the following tools will be available to your LLM:

  1. execute-query: Run SQL SELECT queries against the MySQL database (read-only)
  2. list-tables: List all tables in a database
  3. describe-table: Get the structure of a specific table
  4. get-indexes: View index information for a table
  5. get-foreign-keys: Explore foreign key relationships
  6. explain-query: Analyze the execution plan for a query
  7. table-stats: Get comprehensive statistics about a table
  8. profile-query: Execute a query with detailed performance metrics

Security Features

This MCP server implements several security features:

  • Strict validation of queries to ensure they are SELECT statements only
  • Pattern matching to prevent SQL injection attacks
  • Blocking of all data modification operations (INSERT, UPDATE, DELETE, etc.)
  • Parameterized queries for secure data access
  • Clear error messages that don't expose sensitive information

WordPress Integration

The server works especially well with WordPress databases, providing insights into:

  • Posts, pages, and custom post types
  • Database structure and relationships
  • Query performance and optimization opportunities

License

ISC