
A Model Context Protocol (MCP) server for MySQL databases with support for AWS RDS. Enables AI assistants to execute queries, inspect schemas, and manage MySQL databases securely through the MCP...
概览
A Model Context Protocol (MCP) server for MySQL databases, including support for AWS RDS and other cloud MySQL instances. This server provides comprehensive database management capabilities through a standardized MCP interface. 📋 See VSCODE_SETUP.md for step-by-step VS Code and GitHub Copilot integration instructions. - ✅ : Connect to local MySQL or cloud instances (AWS RDS, Google Cloud SQL, etc.) - ✅ : Execute SQL queries with prepared statement support - ✅ : List databases, tables, and describe table structures - ✅ : View table indexes and statistics - ✅ : Secure connection handling with SSL support - ✅ : Comprehensive error reporting and connection management Or run ad‑hoc without global install using npx (shown later in config). Create (or update) .vscode/mcp.json in your project or in your global VS Code user settings folder. Use the published package via npx so you always invoke the correct version. Then: 1.
README
以下为原文 README 节选,完整内容请查看原文。
MCP MySQL Server
A Model Context Protocol (MCP) server for MySQL databases, including support for AWS RDS and other cloud MySQL instances. This server provides comprehensive database management capabilities through a standardized MCP interface.
📋 Quick Start for VS Code Users: See VSCODE_SETUP.md for step-by-step VS Code and GitHub Copilot integration instructions.
Features
- ✅ Database Connection Management: Connect to local MySQL or cloud instances (AWS RDS, Google Cloud SQL, etc.)
- ✅ Query Execution: Execute SQL queries with prepared statement support
- ✅ Schema Inspection: List databases, tables, and describe table structures
- ✅ Index Management: View table indexes and statistics
- ✅ Security: Secure connection handling with SSL support
- ✅ Error Handling: Comprehensive error reporting and connection management
Installation
From NPM (Recommended)
npm install -g @sajithrw/[email protected]
Or run ad‑hoc without global install using npx (shown later in config).
From Source
git clone https://github.com/sajithrw/mcp-mysql.git
cd mcp-mysql
npm install
npm run build
Configuration
VS Code (mcp.json) Setup (Recommended)
Create (or update) .vscode/mcp.json in your project or in your global VS Code user settings folder. Use the published package via npx so you always invoke the correct version.
{
"servers": {
"mcp-mysql": {
"type": "stdio",
"command": "npx",
"args": [
"@sajithrw/[email protected]"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
Then:
- Reload VS Code window (Command Palette: “Developer: Reload Window”).
- Open Command Palette and run: “MCP: Start Server” (pick
mcp-mysql). - Use Copilot / MCP clients to call tools (e.g., ask to list tables).
Previous
settings.jsonbasedgithub.copilot.advanced.mcpconfiguration is deprecated in favor ofmcp.jsondiscovery.
Alternative: Local Build Path
If working from a local clone/build instead of the published package:
{
"servers": {
"mcp-mysql": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/mcp-mysql/build/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password"
}
}
}
}
Using with Claude Desktop
Add the server to your Claude Desktop configuration:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["@sajithrw/[email protected]"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password"
}
}
}
}
Using with MCP Inspector
For testing and development:
安装
npx @sajithrw/[email protected]配置
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["@sajithrw/[email protected]"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password"
}
}
}
}