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

z-mcp-mysql

v1.1.7

Published

A MCP server for MySQL - Execute SQL queries via AI assistants

Downloads

737

Readme

前言

这是一个基于 @modelcontextprotocol/sdk 实现的 MCP stdio 服务,通过 MySQL 提供表结构查询工具能力。

使用

{
  "mcpServers": {
    "z-mcp-mysql": {
      "command": "npx",
      "args": [
        "-y",
        "z-mcp-mysql",
        "--stdio",
        "--mysql-host=127.0.0.1",
        "--mysql-port=3306",
        "--mysql-user=root",
        "--mysql-password=your_password",
        "--mysql-database=your_database"
      ]
    }
  }
}

提供的工具

| 工具名 | 说明 | |--------|------| | mysql_list_databases | 列出当前 MySQL 实例下当前用户可见的所有数据库。 | | mysql_list_tables | 获取表名及表注释列表。可选 schema 参数指定数据库,不传则使用连接时的 database。 | | mysql_list_views | 获取指定数据库下的视图名及视图注释列表。可选 schema 参数。 | | mysql_list_routines | 获取存储过程及函数列表。可选 schema、routine_type(PROCEDURE/FUNCTION)。 | | mysql_list_triggers | 获取触发器列表。可选 schema、table_name(按表筛选)。 | | mysql_list_columns | 获取表字段信息(列名、类型、是否可空、默认值、注释)。传入 table_name,可选 schema。 | | mysql_list_indexes | 获取表索引信息(索引名、索引类型、包含的列及顺序、是否唯一、索引注释)。传入 table_name,可选 schema。 | | mysql_table_stats | 获取表统计信息(行数、数据大小、索引大小、引擎、字符集等)。传入 table_name,可选 schema。 | | mysql_show_create_table | 获取表的完整建表语句(CREATE TABLE DDL)。传入 table_name,可选 schema。 | | mysql_list_foreign_keys | 获取表的外键关系(引用/被引用的表及列)。传入 table_name,可选 schema。 | | mysql_explain | 对 SELECT 查询执行 EXPLAIN 分析,返回执行计划。参数:sql(必填)、params(可选)。 | | mysql_query | 执行任意 SELECT 查询 SQL。支持 WHERE、JOIN、子查询、聚合等。仅允许 SELECT。参数:sql(必填)、params(可选,占位符参数)。 | | mysql_query_table | 根据表名分页查询表数据。参数:table_name(必填)、page(默认1)、page_size(默认10)、schema(可选)。 |

使用示例

库相关

列出有哪些数据库

表相关

获取数据库有那些表

获取各表的统计信息

跟用户有关的有哪些表

获取表 mp_user 的信息

获取表 sys_user 的索引信息

获取表 sys_user 的统计信息(行数、大小等)

获取表 sys_user 的建表语句

获取表 sys_user 的外键关系

数据相关

获取表 sys_user 第1页的数据

获取表 sys_user 前20条数据

获取表 sys_user 第1页的数据 每页100条

查询 sys_user 表中 status=1 的用户

统计各状态用户数量

其他

分析 SELECT * FROM sys_user 的执行计划

获取数据库有哪些视图

获取数据库的存储过程和函数

获取数据库的触发器