{
  "markdown": "# MySQL Ops MCP\n\n**English** | [简体中文](./README.zh-CN.md)\n\n[![npm version](https://img.shields.io/npm/v/mysql-ops-mcp.svg)](https://www.npmjs.com/package/mysql-ops-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)\n[![MCP](https://img.shields.io/badge/MCP-Server-blue)](https://modelcontextprotocol.io)\n[![GitHub stars](https://img.shields.io/github/stars/GT-dinuo/mysql-ops-mcp?style=social)](https://github.com/GT-dinuo/mysql-ops-mcp)\n\nA MySQL database MCP Server. Let AI tools like Claude Code / Cursor / Codex talk to your MySQL databases in natural language — **browse databases and tables, inspect schemas, run queries, and perform CRUD operations**, with destructive operations (DELETE / DROP) gated behind explicit user approval.\n\n## Features\n\n- 🗄️ **Schema browsing**: list databases, list tables, describe table structure, full table info (indexes, DDL, stats)\n- 🔍 **Queries**: run `SELECT` queries against any database\n- ✏️ **CRUD**: create tables, insert, update — with SQL-statement validation per tool\n- 🔐 **Approval-gated destructive ops**: `delete_data` and `drop_table` always require explicit user confirmation in the client\n- 🔌 **Zero install**: runs via `npx`, configured entirely through environment variables\n\n## Installation\n\nRequires Node.js 18+. No clone or build needed — `npx` fetches and runs the published npm package on first use (see the config below).\n\nTo build from source instead (e.g. for development):\n\n```bash\ngit clone https://github.com/GT-dinuo/mysql-ops-mcp.git\ncd mysql-ops-mcp\nnpm install\nnpm run build\n```\n\nBuild output goes to `dist/`; the entry point is `dist/index.js`.\n\n## Configuration\n\nIn each project where you want to use this tool, create (or append to) `.mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mysql-ops-mcp\"],\n      \"env\": {\n        \"DB_HOST\": \"localhost\",\n        \"DB_PORT\": \"3306\",\n        \"DB_USER\": \"root\",\n        \"DB_PASSWORD\": \"your_password\",\n        \"DB_DATABASE\": \"your_database\"\n      }\n    }\n  }\n}\n```\n\nIf you built from source, point the command at the local build instead: `\"command\": \"node\"`, `\"args\": [\"/absolute/path/to/mysql-ops-mcp/dist/index.js\"]`.\n\n### Environment Variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `DB_HOST` | No | MySQL host, default `localhost` |\n| `DB_PORT` | No | MySQL port, default `3306` |\n| `DB_USER` | No | MySQL user, default `root` |\n| `DB_PASSWORD` | No | MySQL password |\n| `DB_DATABASE` | No | Default database; if omitted, pass `database` per tool call |\n\n## Usage\n\nOnce configured, just ask in natural language in your AI tool:\n\n```\nList all databases\nShow the structure of the users table\nQuery the 10 most recent orders\nGet full info for the users table — indexes and DDL included\nInsert a test record into the users table\nDelete the test record you just inserted   ← the client will ask for your approval first\n```\n\nDestructive operations (`delete_data`, `drop_table`) are always confirmed by the MCP client before execution — nothing irreversible happens silently.\n\n## Tool List\n\n| Tool | Description |\n|------|-------------|\n| `list_databases` | List all databases |\n| `list_tables` | List tables in a database |\n| `describe_table` | Show table columns and types |\n| `get_table_info` | Full table details: columns, indexes, DDL, stats |\n| `query` | Run a SELECT query |\n| `create_table` | Create a table (CREATE TABLE only) |\n| `insert` | Insert rows (INSERT only) |\n| `update` | Update rows (UPDATE only) |\n| `delete_data` | Delete rows — requires user approval |\n| `drop_table` | Drop a table — requires user approval |\n| `execute_sql` | Run any custom SQL statement |\n\n## Security\n\n1. **Destructive operations require approval**: `delete_data` and `drop_table` are gated by the MCP client's tool-call confirmation — approve or reject each one.\n2. **Statement validation**: each write tool only accepts its own SQL verb (e.g. `query` rejects anything but `SELECT`).\n3. **Use a least-privilege account**: don't connect as `root` in production — create a MySQL user scoped to the databases the AI may touch.\n4. **Never commit credentials**: `.env` / `.mcp.json` with real passwords must stay out of version control (`.gitignore` already covers `.env`).\n\n## Testing the Connection\n\nAfter configuring `.env` (copy from `env.example`), you can verify connectivity before wiring up the client:\n\n```bash\ncp env.example .env   # fill in real credentials\nnpm run test-connection\n```\n\n## Development\n\n```bash\nnpm run dev    # watch mode, recompiles on change\nnpm run build  # build to dist/\nnpm start      # run the built Server\n```\n\n## License\n\n[MIT](./LICENSE) © 2026 mysql-ops-mcp\n",
  "bytes": 4819,
  "sha": "6ef83dd13461d6b5503acb5f28fd5c8e3f5ac7837ad2d8203786002bbd58a9e8",
  "repo_slug": "gt-dinuo/mysql-ops-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_gt_dinuo_mysql_ops_mcp_e73be3fa/readme"
}