{"type":"mcp_server","name":"mysql_mcp_server","description":"The MySQL MCP Server enables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface. This facilitates safer database","category":"Database","language":"Python","stars":1316,"forks":54,"owner":"designcomputer","github_url":"https://github.com/designcomputer/mysql_mcp_server","homepage":null,"setup":"## Setup\n\n**Manual Installation**\n```bash\npip install mysql-mcp-server\n```\n\n**Installing via Smithery**\n\nTo install MySQL Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mysql-mcp-server):\n\n```bash\nnpx -y @smithery/cli install mysql-mcp-server --client claude\n```\n\n**Configuration**\n\nSet the following environment variables:\n\n```bash\nMYSQL_HOST=localhost     # Database host\nMYSQL_PORT=3306         # Optional: Database port (defaults to 3306 if not specified)\nMYSQL_USER=your_username\nMYSQL_PASSWORD=your_password\nMYSQL_DATABASE=your_database\n```\n\n**With Claude Desktop**\n\nAdd this to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mysql\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\", \n        \"path/to/mysql_mcp_server\",\n        \"run\",\n        \"mysql_mcp_server\"\n      ],\n      \"env\": {\n        \"MYSQL_HOST\": \"localhost\",\n        \"MYSQL_PORT\": \"3306\",\n        \"MYSQL_USER\": \"your_username\",\n        \"MYSQL_PASSWORD\": \"your_password\",\n        \"MYSQL_DATABASE\": \"your_database\"\n      }\n    }\n  }\n}\n```\n\n**As a standalone server**\n\n```bash\n# Install dependencies\npip install -r requirements.txt\n\n# Run the server\npython -m mysql_mcp_server\n```\n\n**Development**\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/mysql_mcp_server.git\ncd mysql_mcp_server\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # or `venv\\Scripts\\activate` on Windows\n\n# Install development dependencies\npip install -r requirements-dev.txt\n\n# Run tests\npytest\n```","tools":"## Available Tools\n\n1. List available MySQL tables as resources (Allows AI assistants to list tables).\n2. Read table contents (Allows AI assistants to read data).\n3. Execute SQL queries with proper error handling (Allows AI assistants to execute SQL queries).\n4. Secure database access through environment variables (Provides secure database access).\n5. Comprehensive logging (Provides comprehensive logging).","faq":null,"created_at":"2024-12-03T20:53:52+00:00","updated_at":"2025-03-28T21:46:55+00:00","source_url":"https://model-context-protocol.com/servers/mysql-secure-database-interaction-model-context","related_articles":[]}