MySQL MCP Server
Enables secure interaction with MySQL databases, allowing listing of tables, reading data, and executing SQL queries through a controlled interface for database exploration and analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MySQL MCP Servershow me the last 10 orders from the customers table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP Server
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
Features
List available MySQL tables as resources
Read table contents
Execute SQL queries with proper error handling
Secure database access through environment variables
Comprehensive logging
Related MCP server: MCP MySQL Server
Configuration
Set the following environment variables:
MYSQL_HOST=localhost # Database host
MYSQL_PORT=3306 # Optional: Database port (defaults to 3306 if not specified)
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_databaseUsage
With Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"mysql": {
"command": "python",
"args": [
"-m",
"src.mysql_mcp_server.server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}As a standalone server
# Clone the repository
git clone https://github.com/designcomputer/mysql_mcp_server.git
cd mysql_mcp_server
# Install dependencies
pip install -r requirements.txt
# Run the server
python -m src.mysql_mcp_server.serverDevelopment
# Clone the repository
git clone https://github.com/designcomputer/mysql_mcp_server.git
cd mysql_mcp_server
# Create virtual environment
python -m venv py-mcp-mysql_venv
source py-mcp-mysql_venv/bin/activate # or `py-mcp-mysql_venv\Scripts\activate` on Windows
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytestSecurity Considerations
Never commit environment variables or credentials
Use a database user with minimal required permissions
Consider implementing query whitelisting for production use
Monitor and log all database operations
Security Best Practices
This MCP server requires database access to function. For security:
Create a dedicated MySQL user with minimal permissions
Never use root credentials or administrative accounts
Restrict database access to only necessary operations
Enable logging for audit purposes
Regular security reviews of database access
See MySQL Security Configuration Guide for detailed instructions on:
Creating a restricted MySQL user
Setting appropriate permissions
Monitoring database access
Security best practices
⚠️ IMPORTANT: Always follow the principle of least privilege when configuring database access.
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceProvides secure access to MySQL databases for AI assistants, enabling safe SQL queries, table information retrieval, and data insertion with built-in security protections.Last updated9462MIT
- Alicense-qualityDmaintenanceEnables AI assistants to safely query MySQL databases with read-only access by default, supporting table listing, structure inspection, and SQL queries with optional write operation control.Last updated33MIT
- Alicense-quality-maintenanceEnables AI assistants to securely interact with MySQL databases through tools for query execution, schema inspection, and transaction management. It features built-in safety controls like row limits and query validation to ensure safe and standardized database access.Last updated946
- Flicense-qualityDmaintenanceEnables AI assistants to securely interact with MySQL databases, including listing tables, viewing schemas, and executing read-only SQL queries through natural language.Last updated6
Related MCP Connectors
Connect your AI assistants to Keboola and expose your data, transformations, SQL queries, ...
Generate realistic, FK-consistent synthetic test data for your databases from your AI assistant.
Runtime permission, approval, and audit layer for AI agent tool execution.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/amornpan/py-mcp-mysql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server