$git clone https://github.com/designcomputer/mysql_mcp_server> Note: MySQL MCP Server supports both standard input/output (STDIO) and Streamable HTTP (SSE) transport modes. The SSE mode is recommended for remote/self-hosted deployments.
| 1 | [](https://github.com/designcomputer/mysql_mcp_server/actions) |
| 2 | [](https://pypi.org/project/mysql-mcp-server/) |
| 3 | [](https://www.agentaudit.dev/packages/mysql-mcp-server) |
| 4 | # MySQL MCP Server |
| 5 | A Model Context Protocol (MCP) implementation that enables secure interaction with MySQL databases. This server component facilitates communication between AI applications (hosts/clients) and MySQL databases, making database exploration and analysis safer and more structured through a controlled interface. |
| 6 | |
| 7 | > **Note**: MySQL MCP Server supports both standard input/output (STDIO) and Streamable HTTP (SSE) transport modes. The SSE mode is recommended for remote/self-hosted deployments. |
| 8 | |
| 9 | ## Deployment options |
| 10 | - **Hosted** — [Fronteir AI](https://fronteir.ai/mcp/designcomputer-mysql-mcp-server) runs the server for you; no local setup required. |
| 11 | - **Local** — [Smithery](https://smithery.ai/server/designcomputer/mysql-mcp-server) installs and runs the server on your own machine. |
| 12 | |
| 13 | ## Features |
| 14 | - List available MySQL tables as resources |
| 15 | - Read table contents |
| 16 | - Execute SQL queries with proper error handling |
| 17 | - **Multi-database mode** (Optional `MYSQL_DATABASE`) |
| 18 | - **SSE/HTTP transport support** (`MCP_TRANSPORT=sse`) |
| 19 | - **SSH Tunneling support** |
| 20 | - **Comprehensive schema information** |
| 21 | - **Table data sampling** |
| 22 | - Secure database access through environment variables |
| 23 | - Comprehensive logging |
| 24 | |
| 25 | ## Installation |
| 26 | ### Manual Installation |
| 27 | ```bash |
| 28 | pip install mysql-mcp-server |
| 29 | ``` |
| 30 | |
| 31 | ### Installing via Smithery |
| 32 | To install MySQL MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/designcomputer/mysql-mcp-server): |
| 33 | ```bash |
| 34 | npx -y @smithery/cli install designcomputer/mysql-mcp-server --client claude |
| 35 | ``` |
| 36 | |
| 37 | ### Installing via Claude Code CLI |
| 38 | ```bash |
| 39 | claude mcp add --transport stdio designcomputer-mysql_mcp_server uvx mysql_mcp_server |
| 40 | ``` |
| 41 | |
| 42 | ## Configuration |
| 43 | Set the following environment variables: |
| 44 | ```bash |
| 45 | MYSQL_HOST=localhost # Database host |
| 46 | MYSQL_PORT=3306 # Optional: Database port (defaults to 3306 if not specified) |
| 47 | MYSQL_USER=your_username |
| 48 | MYSQL_PASSWORD=your_password |
| 49 | MYSQL_DATABASE=your_database # Optional: Omit for multi-database mode |
| 50 | |
| 51 | # Advanced Configuration |
| 52 | MYSQL_SSL_MODE=DISABLED # DISABLED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY |
| 53 | MYSQL_CONNECT_TIMEOUT=10 # Timeout in seconds |
| 54 | |
| 55 | # Connection behaviour (Optional) |
| 56 | MYSQL_SQL_MODE=TRADITIONAL # SQL mode applied to the connection (default: TRADITIONAL) |
| 57 | |
| 58 | # Compatibility (Optional) |
| 59 | MYSQL_CHARSET=utf8mb4 |
| 60 | MYSQL_COLLATION=utf8mb4_unicode_ci |
| 61 | MYSQL_AUTH_PLUGIN= # e.g., mysql_native_password for older MySQL versions |
| 62 | MYSQL_USE_PURE=false # Force the pure-Python connector (default: false) |
| 63 | MYSQL_RAISE_ON_WARNINGS=false # Raise on SQL warnings (default: false) |
| 64 | |
| 65 | # SSE Transport (Optional) |
| 66 | MCP_TRANSPORT=stdio # stdio or sse |
| 67 | MCP_SSE_HOST=0.0.0.0 # Listen on all interfaces (required for Docker/hosting) |
| 68 | PORT=8000 # HTTP port (fallback for MCP_SSE_PORT) |
| 69 | MCP_SSE_ALLOWED_HOSTS= # Comma-separated allowed Host headers (default: localhost:{port},127.0.0.1:{port}) |
| 70 | |
| 71 | # SSH Tunneling (Optional) |
| 72 | MYSQL_SSH_ENABLE=false # Set to true to enable |
| 73 | MYSQL_SSH_HOST= # SSH jump host |
| 74 | MYSQL_SSH_PORT=22 # SSH port |
| 75 | MYSQL_SSH_USER= # SSH username |
| 76 | MYSQL_SSH_KEY_PATH= # Path to SSH private key |
| 77 | MYSQL_SSH_REMOTE_HOST=localhost # Host from the perspective of the jump host |
| 78 | MYSQL_SSH_REMOTE_PORT=3306 |
| 79 | MYSQL_LOCAL_PORT=3330 |
| 80 | ``` |
| 81 | |
| 82 | ### `.env` file loading |
| 83 | |
| 84 | On startup the server automatically loads a `.env` file via `python-dotenv`, so for local use you can simply: |
| 85 | |
| 86 | ```bash |
| 87 | cp .env.example .env # then edit with your credentials |
| 88 | ``` |
| 89 | |
| 90 | The file is read from the **process working directory** (and parent directories), which wo |