Skip to content

Commit c17b211

Browse files
authored
Update README.md
1 parent 9d1fdc6 commit c17b211

File tree

1 file changed

+139
-115
lines changed

1 file changed

+139
-115
lines changed

README.md

Lines changed: 139 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,75 @@
1-
# MySQL MCP Server
1+
# 🚀 MySQL MCP Server — AI-Driven MySQL Control & Diagnostics for LLMs
22

3-
A comprehensive Model Context Protocol (MCP) server for MySQL databases, designed to empower AI assistants and LLMs with advanced database access, management, and diagnostic capabilities.
3+
A fully featured **Model Context Protocol (MCP) server for MySQL** designed to empower **AI assistants, LLMs (like ChatGPT, Claude, Gemini)**, and automation tools with deep **MySQL database access**, diagnostics, and intelligent control.
44

5-
## Repository
5+
> ⚡ Ideal for building **AI-powered database agents**, DevOps automation, or managing **MySQL with natural language**.
66
7-
- **GitHub**: [https://github.com/mukul975/mysql-mcp-server](https://github.com/mukul975/mysql-mcp-server)
8-
- **Author**: mukul975
9-
- **License**: MIT
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8+
[![Python](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://python.org)
9+
[![MySQL Support](https://img.shields.io/badge/MySQL-5.7%20%7C%208.x-blue.svg)](https://www.mysql.com/)
10+
[![Open Source](https://img.shields.io/badge/Open%20Source-Yes-brightgreen.svg)](https://github.com/mukul975/mcp-mysql-server)
1011

11-
## Core Features
12+
---
1213

13-
- **Execute SQL Queries**: Support for safe execution of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and other commands with read-only validation.
14-
- **Database Introspection**: List tables, view schemas, fetch sample data, and explore indexes and constraints.
15-
- **Advanced Diagnostics**: Comprehensive analysis tools covering fragmentation, slow queries, deadlocks, buffer pool usage, partitioning, and query performance.
16-
- **Security and User Management**: Tools for auditing user privileges, managing users and roles, SSL/TLS configuration audit, and monitoring audit logs.
17-
- **Backup and Replication Monitoring**: Backup health status, binary log and replication status, replication lag monitoring, and recovery readiness.
18-
- **Server and System Monitoring**: View system variables, process lists, query cache stats, memory usage breakdowns, and plugin/component status.
19-
- **Performance Insights**: Adaptive index and query optimizer analyses, event scheduler management, and resource consumption evaluations.
14+
## 📆 Repository Info
2015

21-
## Installation
16+
* **GitHub**: [mcp-mysql-server](https://github.com/mukul975/mcp-mysql-server)
17+
* **Author**: [@mukul975](https://github.com/mukul975)
18+
* **License**: MIT
19+
* **Keywords**: `MySQL`, `MCP Server`, `AI MySQL interface`, `LLM database tool`, `MySQL automation`, `chatbot SQL`
2220

23-
Install required packages:
21+
---
2422

25-
```bash
26-
pip install -r requirements.txt
27-
```
23+
## 🧠 Key Features
2824

29-
Or install key dependencies separately:
25+
This MySQL MCP Server provides **LLMs and AI tools** with:
3026

31-
```bash
32-
pip install "mcp[cli]"
33-
pip install mysql-connector-python
34-
```
35-
36-
## Configuration
37-
38-
Configure via environment variables:
27+
***Secure Query Execution**: Handles `SELECT`, `INSERT`, `UPDATE`, `DELETE`, etc. with read-only validation.
28+
* 🔍 **Schema Introspection**: List tables, inspect structures, indexes, keys.
29+
* 📊 **Performance Diagnostics**: Analyze fragmentation, slow queries, buffer pool stats.
30+
* 🛡️ **Security Auditing**: Manage users, audit SSL, monitor roles & privileges.
31+
* 🧩 **Backup & Replication Monitor**: View replication lag, log status, recovery readiness.
32+
* ⚙️ **System Monitoring**: Get process list, memory usage, plugin state.
33+
* 📈 **Query Insights**: Index recommendations, event scheduler overview.
3934

40-
| Variable | Description | Default |
41-
| ---------------- | ---------------------- | --------- |
42-
| `MYSQL_HOST` | MySQL server host | `localhost` |
43-
| `MYSQL_PORT` | MySQL server port | `3306` |
44-
| `MYSQL_USER` | MySQL username | `root` |
45-
| `MYSQL_PASSWORD` | MySQL password | (empty) |
46-
| `MYSQL_DATABASE` | Default database name | (empty) |
35+
---
4736

48-
Example (Linux/macOS):
37+
## 🛠️ Installation
4938

5039
```bash
51-
export MYSQL_HOST=localhost
52-
export MYSQL_PORT=3306
53-
export MYSQL_USER=myuser
54-
export MYSQL_PASSWORD=mypassword
55-
export MYSQL_DATABASE=mydatabase
56-
```
57-
58-
Example (Windows PowerShell):
59-
60-
```powershell
61-
$env:MYSQL_HOST = "localhost"
62-
$env:MYSQL_PORT = "3306"
63-
$env:MYSQL_USER = "myuser"
64-
$env:MYSQL_PASSWORD = "mypassword"
65-
$env:MYSQL_DATABASE = "mydatabase"
40+
pip install -r requirements.txt
41+
# Or install manually:
42+
pip install "mcp[cli]"
43+
pip install mysql-connector-python
6644
```
6745

68-
## Usage
46+
---
6947

70-
Run the server:
48+
## ⚙️ Environment Configuration
7149

72-
- Default stdio transport:
50+
| Variable | Description | Default |
51+
| ---------------- | --------------------- | ----------- |
52+
| `MYSQL_HOST` | MySQL server hostname | `localhost` |
53+
| `MYSQL_PORT` | MySQL port | `3306` |
54+
| `MYSQL_USER` | Username | `root` |
55+
| `MYSQL_PASSWORD` | Password | (empty) |
56+
| `MYSQL_DATABASE` | Target DB | (empty) |
7357

74-
```bash
75-
python mysql_server.py
76-
```
58+
> 💡 Use `.env` or export variables manually
7759
78-
- SSE transport (for web clients):
60+
---
7961

80-
```bash
81-
python mysql_server.py --transport sse
82-
```
83-
84-
Get help:
62+
## ▶️ Run & Usage
8563

8664
```bash
87-
python mysql_server.py --help
65+
python mysql_server.py # Default (stdin transport)
66+
python mysql_server.py --transport sse # For web clients (SSE)
67+
python mysql_server.py --help # Command help
8868
```
8969

90-
## Integration
70+
---
9171

92-
To integrate with Claude Desktop, update your config file (`%APPDATA%/Claude/claude_desktop_config.json` on Windows or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
72+
## 🔗 Claude Desktop Integration
9373

9474
```json
9575
{
@@ -100,77 +80,121 @@ To integrate with Claude Desktop, update your config file (`%APPDATA%/Claude/cla
10080
"env": {
10181
"MYSQL_HOST": "localhost",
10282
"MYSQL_PORT": "3306",
103-
"MYSQL_USER": "your_username",
104-
"MYSQL_PASSWORD": "your_password",
105-
"MYSQL_DATABASE": "your_database"
83+
"MYSQL_USER": "your_user",
84+
"MYSQL_PASSWORD": "your_pass",
85+
"MYSQL_DATABASE": "your_db"
10686
}
10787
}
10888
}
10989
}
11090
```
11191

112-
## Example Workflows
92+
---
11393

114-
- List all tables: use `list_tables` tool or access `mysql://tables` resource.
115-
- Inspect table schema: use `describe_table` tool or `mysql://schema/{table_name}`.
116-
- Execute queries: use `execute_sql` for select or data modification queries.
117-
- Analyze slow queries and deadlocks.
118-
- Audit user privileges and monitor SSL/TLS connections.
119-
- Monitor replication lag and binary logs for health.
94+
## 🧪 Example Workflows
12095

121-
## Included Tools
96+
* `list_tables`: Lists all tables
97+
* `describe_table`: Schema of a specific table
98+
* `execute_sql`: Run select or data modification queries
99+
* `mysql_slow_query_analysis`: Detect slow queries
100+
* `mysql_user_privileges`: Audit user access
101+
* `mysql_replication_lag_monitoring`: Check lag in replication
122102

123-
The server includes a rich set of tools such as:
103+
---
124104

125-
- mysql_query, list_mysql_tables, mysql_table_schema, mysql_table_data
126-
- mysql_table_indexes, mysql_table_size, mysql_table_status
127-
- mysql_fragmentation_analysis, mysql_index_optimization_suggestions, mysql_slow_query_analysis
128-
- mysql_deadlock_detection, mysql_buffer_pool_cache_diagnostics
129-
- mysql_user_privileges, mysql_create_user, mysql_drop_user, mysql_change_user_password
130-
- mysql_backup_health_check, mysql_replication_lag_monitoring, mysql_ssl_tls_configuration_audit
131-
- mysql_server_health_dashboard, mysql_performance_recommendations
132-
- mysql_event_scheduler, mysql_partition_management_recommendations
133-
- And many more diagnostic, operational, and security tools.
105+
## 🧰 Toolset Highlights
134106

135-
## Security Considerations
107+
> Access tools via code or LLM prompts:
136108
137-
- Use secure connections when possible.
138-
- Store credentials in environment variables.
139-
- Only use the server in trusted environments or behind network security.
140-
- All queries are validated for safety, but always review for injection risks.
141-
- The server includes comprehensive privilege auditing tools.
109+
* `mysql_query`, `list_mysql_tables`, `mysql_table_schema`
110+
* `mysql_index_optimization_suggestions`, `mysql_deadlock_detection`
111+
* `mysql_ssl_tls_configuration_audit`, `mysql_backup_health_check`
112+
* `mysql_server_health_dashboard`, `mysql_event_scheduler`, and **dozens more**
142113

143-
## Error Handling
114+
---
144115

145-
- Robust error reporting for connection, syntax, permission, and network errors.
146-
- Structured error response format for easy automated handling.
116+
## 🔐 Security Considerations
147117

148-
## Development
118+
* Store secrets in env vars or vault
119+
* Do not expose server publicly
120+
* Privilege validation and SSL audit included
149121

150-
Project structure:
122+
---
151123

152-
```
124+
## 🧪 Error Handling
125+
126+
* Connection errors
127+
* SQL syntax issues
128+
* Network timeouts
129+
* Returns structured error response
130+
131+
---
132+
133+
## 💡 Development Structure
134+
135+
```text
153136
mcp-mysql-server/
154-
├── mysql_server.py # Core server code with tools and protocols
155-
├── requirements.txt # Python dependencies
156-
├── README.md # This documentation
157-
└── pyproject.toml # Optional project metadata
137+
├── mysql_server.py # Entry point
138+
├── requirements.txt # Dependencies
139+
├── README.md # Docs
140+
└── pyproject.toml # Project metadata (optional)
158141
```
159142

160-
### Testing
143+
---
144+
145+
## ✅ Testing Steps
146+
147+
1. Ensure MySQL is running
148+
2. Set environment vars
149+
3. Run `python mysql_server.py`
150+
4. Try with `mcp dev mysql_server.py` (if using MCP CLI)
151+
152+
---
153+
154+
## 🤝 Contributing
155+
156+
* Fork the repo
157+
* Create feature/bug branches
158+
* Submit PRs with description & tests
159+
160+
---
161+
162+
## 📄 FAQ
163+
164+
**Q: What is MCP?**
165+
A: Model Context Protocol (MCP) is an interface to give LLMs access to structured tools like databases, APIs, and system utilities.
166+
167+
**Q: Can I use this with ChatGPT or Claude?**
168+
Yes! It's designed for direct integration with AI/LLM tools that support tool-use or system-level automation.
169+
170+
**Q: Is it safe to run this in production?**
171+
It depends on your environment. Always restrict access, use read-only roles, and monitor logs.
172+
173+
---
174+
175+
## 📄 License
176+
177+
MIT License — Open source and free to use.
178+
179+
---
180+
181+
## 🔎 GitHub SEO Tips (apply on GitHub)
182+
183+
1. **Repo Settings**:
184+
185+
* **Description**: `AI-powered MySQL server for LLMs, diagnostics, and automation`
186+
* **Tags**: `mysql`, `ai`, `mcp`, `automation`, `llm`, `chatgpt`, `database`, `sql`, `devops`
187+
188+
2. **Topics**: Add GitHub topics like `mysql`, `llm`, `mcp`, `chatgpt-plugin`, `openai`, `ai-tools`
161189

162-
- Ensure MySQL server running and reachable.
163-
- Configure environment variables.
164-
- Run `python mysql_server.py`
165-
- Optionally test with `mcp dev mysql_server.py`
190+
---
166191

167-
## Contributing
192+
## 📣 Promote It
168193

169-
- Fork repository
170-
- Create branches for features or fixes
171-
- Add tests and documentation
172-
- Submit pull requests for review
194+
* Share on [Reddit r/MachineLearning](https://www.reddit.com/r/MachineLearning/)
195+
* Post to LinkedIn or Twitter with GIF or screenshots
196+
* Submit to [awesome-LLM](https://github.com/Hannibal046/Awesome-LLM) or similar curated lists
173197

174-
## License
198+
---
175199

176-
MIT License — Open source and free to use
200+
Let me know if you need an HTML version, web preview, or GitHub Pages site for this!

0 commit comments

Comments
 (0)