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

@yurdeth/mysql-pro-mcp

v1.0.0

Published

MySQL/MariaDB MCP server with statement-class split: query (read-only: SELECT/SHOW/DESCRIBE/EXPLAIN/ANALYZE) / execute (DML+DDL). Dynamic per-call connection params (host/port/user/password/database) with env-var defaults. Works great with per-tool permis

Downloads

51

Readme

mysql-pro-mcp — MCP MySQL/MariaDB con separación por clase de sentencia

Servidor MCP (stdio, Node) con dos herramientas separadas por clase de sentencia, pensado para que un hook de permisos (o el modo del cliente) pueda aprobar las lecturas y confirmar las escrituras:

| Herramienta | Acepta | Uso típico en allowlist | |---|---|---| | query | SELECT, WITH (CTE de lectura), SHOW, DESCRIBE/DESC, EXPLAIN (y EXPLAIN ANALYZE), ANALYZE (MariaDB ANALYZE SELECT), TABLE | ✅ auto-aprobada | | execute | INSERT, UPDATE, DELETE, REPLACE, CREATE, ALTER, DROP, TRUNCATE, RENAME | ❌ pide confirmación |

Instalación vía npx (registrado)

"mysql-pro": {
  "type": "stdio",
  "command": "npx",
  "args": ["-y", "@yurdeth/mysql-pro-mcp"],
  "env": {
    "MYSQL_HOST": "localhost",
    "MYSQL_PORT": "3306",
    "MYSQL_USER": "tu_usuario",
    "MYSQL_PASSWORD": "tu_password"
  }
}

Sin MYSQL_DATABASE: la base es dinámica (ver abajo). Herramientas resultantes: mcp__mysql-pro__query y mcp__mysql-pro__execute.

Diseño

  • Clasificación por prefijo (primera palabra clave de la sentencia), NO parser gramatical. Esto evita de raíz los bugs de los paquetes con parser estricto (DESCRIBE db.tabla y ANALYZE SELECT fallaban en @benborla29).
  • Guardas extra en query (defensa en profundidad):
    • INTO OUTFILE / INTO DUMPFILE rechazados (un SELECT puede escribir archivos).
    • ANALYZE TABLE rechazado (actualiza estadísticas = escritura).
    • WITH ... INSERT/UPDATE/DELETE/REPLACE rechazado (CTE que modifica datos).
    • multipleStatements: false en el driver (bloqueo duro contra ; DROP ...).
  • Conexión dinámica: las variables de entorno dan los defaults, y cada llamada puede sobreescribir host, port, user, password, database. Sin MYSQL_DATABASE en el env no hay base por defecto: se usa nombre calificado (oswa_inv.products) o el parámetro database por llamada.
  • Pools por tupla de conexión (host, port, user, database): cambiar de base o de usuario es simplemente otro pool. Máximo MYSQL_PRO_MAX_POOLS (default 8, se evicta el más viejo). Pool con credenciales malas se descarta solo para que el siguiente intento use las corregidas.
  • Resultados de query limitados a MYSQL_PRO_MAX_ROWS (default 1000) con aviso truncated. Fechas como strings (dateStrings: true, sin re-interpretación TZ).

Variables de entorno

| Var | Default | Uso | |---|---|---| | MYSQL_HOST | localhost | Host por defecto | | MYSQL_PORT | 3306 | Puerto por defecto | | MYSQL_USER | — | Usuario por defecto | | MYSQL_PASSWORD | — | Password por defecto | | MYSQL_DATABASE | (vacío) | Base por defecto. Dejar vacía = totalmente dinámico | | MYSQL_PRO_MAX_ROWS | 1000 | Tope de filas devueltas por query | | MYSQL_PRO_MAX_POOLS | 8 | Máximo de pools simultáneos |

Registro local (sin npx, ruta directa)

"mysql-pro": {
  "type": "stdio",
  "command": "node",
  "args": ["/ruta/al/checkout/mcp-servers/mysql-pro/index.mjs"],
  "env": {
    "MYSQL_HOST": "localhost",
    "MYSQL_PORT": "3306",
    "MYSQL_USER": "…",
    "MYSQL_PASSWORD": "…"
  }
}

En el hook de auto-aprobación de ZCode (~/.zcode/cli/hooks/mcp-autopass.js) está agregado SOLO mcp__mysql-pro__query; execute queda fuera para que pida confirmación.

Limitaciones conocidas (a propósito)

  • Una sentencia por llamada (sin multi-statements).
  • Sin CALL (procedimientos), SET, USE, LOCK/UNLOCK TABLES, GRANT, LOAD DATA.
  • ANALYZE TABLE no está en ninguna herramienta (es escritura de metadatos); si algún día hace falta, agregar 'analyze' con cuidado a WRITE_PREFIXES.
  • Un WITH de lectura cuyo texto contenga las palabras insert/update/delete/ replace (p.ej. en un literal de string) se rechaza por falso positivo: reescribir la consulta sin esa palabra.

Pruebas

node /home/angel/.zcode/cli/mcp-servers/mysql-pro/test-client.mjs

Corre la matriz completa: lecturas, nombres calificados, EXPLAIN, ANALYZE de MariaDB, DB dinámica, rechazos de seguridad y ciclo CREATE/DROP de una base scratch (mcp_pro_selftest). Última corrida: 2026-08-21, todo en verde.