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

@hsbase/mysql-mcp

v1.0.0

Published

MCP Server for MySQL Database - Query MySQL databases directly from AI assistants like Cursor and Claude

Readme

MySQL MCP Server

一个强大的 MCP 服务器,提供对 MySQL 数据库的直接访问。该服务器使 AI 助手能够与 MySQL 数据库交互、执行 SQL 查询,并通过简单的接口管理数据库内容。

功能特性

资源 (Resources)

  • 通过 note:///{id} URI 访问数据库中存储的笔记
  • 每个笔记都有标题和内容
  • 纯文本 MIME 类型,便于内容访问

工具 (Tools)

  • create_note - 在数据库中创建新的文本笔记
    • 需要标题和内容作为必需参数
    • 将笔记存储在 MySQL 数据库中
  • list_tables - 列出连接数据库中的所有表
  • count_tables - 获取数据库中的表总数
  • search_tables - 使用 LIKE 模式搜索表
  • describe_table - 获取特定表的结构
  • execute_sql - 执行自定义 SQL 查询

前置要求

  • Node.js 18 或更高版本
  • MySQL 服务器已安装并运行
  • 具有适当权限的数据库

安装

通过 npm 安装

npm install -g @hsbase/mysql-mcp

或者使用 npx(推荐):

npx -y @hsbase/mysql-mcp

配置

在 Cursor 中使用

在 Cursor 的 MCP 配置文件中添加服务器配置:

配置文件位置: ~/.cursor/mcp.json

{
  "mcpServers": {
    "mysql-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@hsbase/mysql-mcp"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      },
      "timeout": 90
    }
  }
}

在 Claude Desktop 中使用

在 Claude Desktop 配置文件中添加服务器配置:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@hsbase/mysql-mcp"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "your_username",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}

使用示例

安装后,您可以在与 AI 助手的对话中使用 MySQL MCP 服务器:

列出数据库中的所有表

请列出我的 MySQL 数据库中的所有表。

执行 SQL 查询

运行这个 SQL 查询:SELECT * FROM users LIMIT 5

创建笔记

创建一个标题为"会议记录"的笔记,内容为"讨论了项目时间表并分配了任务。"

搜索表

搜索包含 'user' 的表名

查看表结构

显示 users 表的结构

环境变量

| 变量名 | 描述 | 必需 | |--------|------|------| | MYSQL_HOST | MySQL 服务器主机地址 | 是 | | MYSQL_USER | MySQL 用户名 | 是 | | MYSQL_PASSWORD | MySQL 密码 | 是 | | MYSQL_DATABASE | 要连接的数据库名 | 是 |

开发

本地开发

git clone <repository-url>
cd mysql-mcp-server-publish
npm install
npm start

许可证

MIT

作者

yupeng39678