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

agent-mysql

v1.0.0

Published

MySQL CLI tool designed for AI Agents

Downloads

138

Readme

agent-mysql

MySQL CLI tool designed for AI Agents. All commands output JSON for programmatic consumption.

Install

npm install -g agent-mysql

Quick Start

# Connect and query (full connection info required each time)
agent-mysql -h localhost -P 3306 -u root -p mypassword -d mydb query "SELECT * FROM users LIMIT 5"

# Use DSN
agent-mysql --dsn "mysql://root:mypassword@localhost:3306/mydb" tables

# Save a profile (config saved to ./.agent-mysql/config.json)
agent-mysql config set dev.host localhost
agent-mysql config set dev.user root
agent-mysql config set dev.password mypassword
agent-mysql config set dev.database mydb

# Use saved profile (no need to repeat host/user/pass each time)
agent-mysql --use dev query "SELECT COUNT(*) FROM users"

# Override database on the fly
agent-mysql --use dev -d other_db query "SELECT * FROM posts"

Connection

每条命令都是独立连接,用完即关闭。有三种方式指定连接信息:

方式一:命令行参数(每条命令都要传)

agent-mysql -h localhost -P 3306 -u root -p mypass -d mydb query "SELECT 1"

方式二:DSN 连接串

agent-mysql --dsn "mysql://root:mypass@localhost:3306/mydb" tables

方式三:配置文件 profile(推荐)

# 首次保存
agent-mysql config set dev.host localhost
agent-mysql config set dev.port 3306
agent-mysql config set dev.user root
agent-mysql config set dev.password mypass
agent-mysql config set dev.database mydb

# 之后使用
agent-mysql --use dev query "SELECT 1"
# 也可覆盖数据库
agent-mysql --use dev -d other_db query "SELECT 1"

Configuration

配置文件保存在当前项目目录的 .agent-mysql/config.json 中。

首次使用可以参考模板文件初始化:

cp .agent-mysql/config.example.json .agent-mysql/config.json
# 然后编辑 config.json 填入真实密码

或者通过命令行逐项设置:

agent-mysql config set dev.host localhost
agent-mysql config set dev.user root
agent-mysql config set dev.password mypassword
agent-mysql config set dev.database mydb

Commands

| Command | Description | |---------|-------------| | query <sql> | Execute any SQL (SELECT/INSERT/UPDATE/DELETE/DDL/etc) | | databases | List all databases | | tables | List tables in database | | desc <table> | Describe table (columns + indexes) | | schema <table> | Show CREATE TABLE DDL | | status | Connection status + ping | | status --all | All info: size, variables, slow queries | | insert <table> --data <json> | Insert data from JSON | | update <table> --set <json> --where <sql> | Update data with conditions | | delete <table> --where <sql> | Delete data with conditions | | export <table> | Export table data (json/csv/sql) | | import <file> | Import from JSON/CSV/SQL file | | config | Manage connection profiles |

Safety

  • DROP/TRUNCATE/ALTER require --force flag
  • DELETE/UPDATE without WHERE require --force flag
  • update/delete commands require --where parameter
  • Default --limit 200 on SELECT queries