MySQL MCP Server
A Model Context Protocol (MCP) server that provides MySQL database access through standardized tools.
Features
- Query Execution: Execute arbitrary SQL queries
Power your agent
पब्लिशर का इंस्टॉल। PlugMCP एंडपॉइंट नहीं।
Host a copy with our keys and logs.
रजिस्ट्री में अभी कोई पैकेज्ड रिलीज़ नहीं है। रिपॉज़िटरी का README देखें.
रिमोट URL या आपकी मशीन पर कमांड? दोनों इंस्टॉल में क्या अंतर है
PlugMCP पर चलाएँ
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
लॉन्चपब्लिशर से
A Model Context Protocol (MCP) server that provides MySQL database access through standardized tools.
A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases. Query execution, schema inspection, and seamless integration with Claude, Cursor, and VSCode.
Download the latest release for your platform:
Linux (amd64):
curl -L https://github.com/koh/mysql-mcp-server/releases/latest/download/mysql-mcp-server-linux-amd64.tar.gz | tar xz
chmod +x mysql-mcp-server
sudo mv mysql-mcp-server /usr/local/bin/
macOS (Apple Silicon):
curl -L https://github.com/koh/mysql-mcp-server/releases/latest/download/mysql-mcp-server-darwin-arm64.tar.gz | tar xz
chmod +x mysql-mcp-server
mv mysql-mcp-server /usr/local/bin/
macOS (Intel):
curl -L https://github.com/koh/mysql-mcp-server/releases/latest/download/mysql-mcp-server-darwin-amd64.tar.gz | tar xz
chmod +x mysql-mcp-server
mv mysql-mcp-server /usr/local/bin/
Windows:
# Download from https://github.com/koh/mysql-mcp-server/releases/latest
# Extract mysql-mcp-server-windows-amd64.zip
# Add to PATH or move mysql-mcp-server.exe to a directory in PATH
git clone https://github.com/koh/mysql-mcp-server.git
cd mysql-mcp-server
make build
# Or use make setup for full development setup
After installation, verify the server is accessible:
mysql-mcp-server --version
The server uses environment variables for MySQL connection configuration:
MYSQL_HOST: MySQL server host (default: localhost)MYSQL_PORT: MySQL server port (default: 3306)MYSQL_USER: MySQL usernameMYSQL_PASSWORD: MySQL passwordMYSQL_DATABASE: Database name to connect toYou can copy .env.example to .env and modify it with your credentials:
cp .env.example .env
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-server",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
Run the server directly:
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASSWORD=password
export MYSQL_DATABASE=testdb
./mysql-mcp-server
Execute SELECT queries to retrieve data from MySQL database. This tool is restricted to SELECT statements only for safety. Use the execute tool for data modification operations.
Parameters:
query (required): SELECT statement onlyformat (optional): Output format - json, table, csv, or markdown (default: table)Example:
{
"name": "query",
"arguments": {
"query": "SELECT * FROM users WHERE status = 'active' LIMIT 10",
"format": "csv"
}
}
Execute INSERT, UPDATE, DELETE queries with safety checks. This tool implements a two-step execution process for safety:
dry_run=true to preview affected rowsdry_run=false and the confirmation token to executeParameters:
sql (required): INSERT, UPDATE, or DELETE statementdry_run (optional): If true, shows affected rows without executing (default: true)confirm_token (optional): Token from dry-run response, required when dry_run=falseExample - Step 1 (Dry Run):
{
"name": "execute",
"arguments": {
"sql": "UPDATE users SET status = 'inactive' WHERE last_login < '2024-01-01'",
"dry_run": true
}
}
Response:
{
"content": [
{"type": "text", "text": "DRY RUN - Operation: UPDATE"},
{"type": "text", "text": "This operation will affect 42 rows"},
{"type": "text", "text": "To execute this query, run again with dry_run=false and the confirmation token below:"},
{"type": "text", "text": "confirm_token: abc123def456"}
],
"affected_rows": 42,
"operation": "UPDATE",
"confirm_token": "abc123def456"
}
Example - Step 2 (Execute):
{
"name": "execute",
"arguments": {
"sql": "UPDATE users SET status = 'inactive' WHERE last_login < '2024-01-01'",
"dry_run": false,
"confirm_token": "abc123def456"
}
}
Get the schema of a MySQL table.
Parameters:
table (required): The name of the tableExample:
{
"name": "schema",
"arguments": {
"table": "users"
}
}
List all tables in the database.
Example:
{
"name": "tables",
"arguments": {}
}
Analyze the execution plan of a MySQL query to understand performance. Supports both EXPLAIN and EXPLAIN ANALYZE.
Parameters:
query (required): The SQL query to analyzeanalyze (optional): If true, runs EXPLAIN ANALYZE to get actual execution statistics (default: false)Example - Basic EXPLAIN:
{
"name": "explain",
"arguments": {
"query": "SELECT * FROM users WHERE email = '[email protected]'"
}
}
Example - EXPLAIN ANALYZE:
{
"name": "explain",
"arguments": {
"query": "SELECT * FROM users WHERE age > 25",
"analyze": true
}
}
Note: EXPLAIN ANALYZE actually executes the query to gather real execution statistics, including actual row counts and timing information. Use with caution on queries that modify data or take a long time to execute.
Configure in VSCode settings.json:
{
"mcp.servers": {
"mysql": {
"command": "/path/to/mysql-mcp-server",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "mydb"
}
}
}
}
Create a custom extension that spawns the MCP server. See INTEGRATION.md for implementation details.
Cursor supports MCP servers through its configuration:
{
"mysql": {
"command": "/path/to/mysql-mcp-server",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "mydb"
}
}
}
GitHub Copilot doesn't directly support MCP servers, but you can create a bridge through VSCode extensions. See INTEGRATION.md for detailed implementation.
For any tool that supports subprocess communication:
const { spawn } = require('child_process');
class MCPClient {
constructor(serverPath, env) {
this.server = spawn(serverPath, [], { env });
// ... handle communication
}
async callTool(name, arguments) {
return this.request('tools/call', { name, arguments });
}
}
// Usage
const client = new MCPClient('/path/to/mysql-mcp-server', {
MYSQL_HOST: 'localhost',
MYSQL_USER: 'root',
MYSQL_PASSWORD: 'password',
MYSQL_DATABASE: 'mydb'
});
For complete integration examples and troubleshooting, see INTEGRATION.md.
For detailed testing instructions, see TESTING.md.
Quick start:
# Setup and run interactive test client
make setup
make test-client
Run tests:
make test
Run the server:
make run
query tool is restricted to SELECT statements only to prevent accidental data modificationexecute tool requires a two-step confirmation process for all data modification operationsMIT
A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases. Query execution, schema inspection, and seamless integration with Claude, Cursor, and VSCode.
टूल
अभी टूल सूची नहीं है। रिमोट सर्वर को पहले हेल्थ चेक के बाद सूची मिलती है।
FAQ
इस पेज पर Cursor, Claude Desktop, Claude Code या VS Code के लिए stdio कॉन्फ़िग कॉपी करें। यह पब्लिशर का इंस्टॉल इस्तेमाल करता है, PlugMCP प्रॉक्सी नहीं।
इस रिकॉर्ड में कोई ज़रूरी एनवायरनमेंट वेरिएबल दर्ज नहीं है।
Mysql stdio पर लोकल चलता है।
पिछली जाँच 2026-10-28 को हुई। A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases. Query execution, schema inspection, and seamless integration with Claude, Cursor, and VSCode.