mysql-ops-mcp

mysql-ops-mcp

Enables AI tools to interact with MySQL databases through natural language, including schema browsing, queries, CRUD operations, with destructive actions gated behind user approval.

Category
访问服务器

README

MySQL Ops MCP

English | 简体中文

npm version License: MIT Node.js MCP GitHub stars

A 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.

Features

  • 🗄️ Schema browsing: list databases, list tables, describe table structure, full table info (indexes, DDL, stats)
  • 🔍 Queries: run SELECT queries against any database
  • ✏️ CRUD: create tables, insert, update — with SQL-statement validation per tool
  • 🔐 Approval-gated destructive ops: delete_data and drop_table always require explicit user confirmation in the client
  • 🔌 Zero install: runs via npx, configured entirely through environment variables

Installation

Requires Node.js 18+. No clone or build needed — npx fetches and runs the published npm package on first use (see the config below).

To build from source instead (e.g. for development):

git clone https://github.com/GT-dinuo/mysql-ops-mcp.git
cd mysql-ops-mcp
npm install
npm run build

Build output goes to dist/; the entry point is dist/index.js.

Configuration

In each project where you want to use this tool, create (or append to) .mcp.json:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "mysql-ops-mcp"],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_USER": "root",
        "DB_PASSWORD": "your_password",
        "DB_DATABASE": "your_database"
      }
    }
  }
}

If you built from source, point the command at the local build instead: "command": "node", "args": ["/absolute/path/to/mysql-ops-mcp/dist/index.js"].

Environment Variables

Variable Required Description
DB_HOST No MySQL host, default localhost
DB_PORT No MySQL port, default 3306
DB_USER No MySQL user, default root
DB_PASSWORD No MySQL password
DB_DATABASE No Default database; if omitted, pass database per tool call

Usage

Once configured, just ask in natural language in your AI tool:

List all databases
Show the structure of the users table
Query the 10 most recent orders
Get full info for the users table — indexes and DDL included
Insert a test record into the users table
Delete the test record you just inserted   ← the client will ask for your approval first

Destructive operations (delete_data, drop_table) are always confirmed by the MCP client before execution — nothing irreversible happens silently.

Tool List

Tool Description
list_databases List all databases
list_tables List tables in a database
describe_table Show table columns and types
get_table_info Full table details: columns, indexes, DDL, stats
query Run a SELECT query
create_table Create a table (CREATE TABLE only)
insert Insert rows (INSERT only)
update Update rows (UPDATE only)
delete_data Delete rows — requires user approval
drop_table Drop a table — requires user approval
execute_sql Run any custom SQL statement

Security

  1. Destructive operations require approval: delete_data and drop_table are gated by the MCP client's tool-call confirmation — approve or reject each one.
  2. Statement validation: each write tool only accepts its own SQL verb (e.g. query rejects anything but SELECT).
  3. Use a least-privilege account: don't connect as root in production — create a MySQL user scoped to the databases the AI may touch.
  4. Never commit credentials: .env / .mcp.json with real passwords must stay out of version control (.gitignore already covers .env).

Testing the Connection

After configuring .env (copy from env.example), you can verify connectivity before wiring up the client:

cp env.example .env   # fill in real credentials
npm run test-connection

Development

npm run dev    # watch mode, recompiles on change
npm run build  # build to dist/
npm start      # run the built Server

License

MIT © 2026 mysql-ops-mcp

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选