
MCP MySQL Server
Enables full control database operations on MySQL through natural language commands. Supports querying, data manipulation, table management, backups, and system administration with comprehensive SQL execution capabilities.
README
🚀 MCP MySQL Server - Full Control Database Tool
⚠️ CẢNH BÁO: Tool này có thể làm mất dữ liệu! Hãy cẩn thận khi sử dụng!
MCP (Model Context Protocol) Server cho MySQL với quyền truy cập đầy đủ. Tool này được phát triển bởi AI và hướng dẫn bởi kami2k1.
📋 Tính năng
🔍 Truy vấn & Phân tích
- Xem danh sách bảng: Hiển thị tất cả bảng với thông tin chi tiết
- Mô tả cấu trúc bảng: Xem cột, kiểu dữ liệu, ràng buộc
- Phân tích bảng: Thống kê số hàng, kích thước, index
- Thực thi SQL: Chạy bất kỳ lệnh SQL nào
📝 Thao tác dữ liệu
- Thêm dữ liệu: Insert record mới
- Cập nhật dữ liệu: Update record theo điều kiện
- Xóa dữ liệu: Delete record theo điều kiện
- Truy vấn tùy chỉnh: SELECT với điều kiện phức tạp
🛠️ Quản trị hệ thống
- Xem biến hệ thống: SHOW VARIABLES
- Backup bảng: Tạo bản sao lưu
- Tối ưu bảng: OPTIMIZE TABLE
- Quản lý user: Tạo/xóa user MySQL
- Cấp quyền: GRANT/REVOKE permissions
⚙️ Cài đặt
1. Cài đặt dependencies
pip install -r requirements.txt
2. Cấu hình database
Tạo file .env
:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database
DEBUG=True
3. Cấu hình VS Code
Thêm vào mcp.json
:
{
"servers": {
"mysql-server": {
"command": "python",
"args": ["main_fastmcp_fixed.py"],
"cwd": "đường/dẫn/tới/thư/mục/này",
"env": {
"PYTHONPATH": "."
}
}
}
}
4. Khởi động server
python main_fastmcp_fixed.py
🎯 Cách sử dụng trong VS Code
Xem cấu trúc database
Hãy hiển thị tất cả bảng trong database
Truy vấn dữ liệu
Cho tôi xem 10 user đầu tiên trong bảng users
Thêm dữ liệu
Thêm user mới với tên 'john', email 'john@example.com'
Cập nhật dữ liệu
Cập nhật tên của user có id = 1 thành 'Jane Doe'
Backup dữ liệu
Tạo backup của bảng users với tên users_backup
⚠️ CẢNH BÁO QUAN TRỌNG
🚨 Rủi ro cao
- Tool này có quyền FULL ACCESS vào MySQL
- Có thể XÓA TOÀN BỘ DATABASE nếu sử dụng sai
- Có thể THAY ĐỔI CẤU TRÚC BẢNG không thể khôi phục
- Có thể XÓA USERS & PERMISSIONS của MySQL
🛡️ Biện pháp an toàn
- LUÔN BACKUP trước khi sử dụng
- KIỂM TRA KỸ các lệnh SQL trước khi thực thi
- SỬ DỤNG USER có quyền hạn chế, không dùng root
- TEST TRÊN DATABASE TEST trước khi dùng production
- GIÁM SÁT tất cả thay đổi được thực hiện
🚫 Không khuyến nghị
- Sử dụng trên database production quan trọng
- Để AI tự động thực thi lệnh mà không xem xét
- Cấp quyền root cho connection
- Sử dụng mà không hiểu SQL
🔧 Các tool có sẵn
Tool | Mô tả | Mức độ rủi ro |
---|---|---|
get_tables |
Xem danh sách bảng | ✅ An toàn |
describe_table |
Xem cấu trúc bảng | ✅ An toàn |
analyze_table |
Phân tích bảng | ✅ An toàn |
execute_query |
Thực thi SQL | ⚠️ Rủi ro cao |
insert_data |
Thêm dữ liệu | ⚠️ Rủi ro trung bình |
update_data |
Cập nhật dữ liệu | 🚨 Rủi ro cao |
delete_data |
Xóa dữ liệu | 🚨 Rủi ro rất cao |
backup_table |
Backup bảng | ✅ An toàn |
optimize_table |
Tối ưu bảng | ⚠️ Rủi ro trung bình |
show_variables |
Xem biến hệ thống | ✅ An toàn |
👨💻 Thông tin phát triển
- Được phát triển bởi: AI Assistant
- Hướng dẫn bởi: kami2k1
- Ngôn ngữ: Python 3.12+
- Framework: FastMCP (Model Context Protocol)
- Database: MySQL/MariaDB
📞 Hỗ trợ
Nếu gặp vấn đề:
- Kiểm tra logs trong terminal
- Xác nhận cấu hình
.env
đúng - Đảm bảo MySQL server đang chạy
- Kiểm tra quyền truy cập database
📜 License
Tool này được cung cấp "AS IS" không có bảo hành. Người sử dụng chịu trách nhiệm toàn bộ cho việc sử dụng tool.
🚨 LƯU Ý CUỐI: Tool này rất mạnh mẽ nhưng cũng rất nguy hiểm. Hãy sử dụng cẩn thận!
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.