Get the FREE Ultimate OpenClaw Setup Guide →

mysql -sse

MySQL query server based on the MCP sse.Multi-level SQL risk control & injection protection Docker support for quick deployment

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mangooer-mysql-mcp-server-sse docker run -d --name mysql-mcp-server-sse -e HOST=0.0.0.0 -e PORT=3000 -e MYSQL_HOST=your_mysql_host -e MYSQL_PORT=3306 -e MYSQL_USER=your_mysql_user -e MYSQL_PASSWORD=your_mysql_password -e MYSQL_DATABASE=your_database -p 3000:3000  mangooer/mysql-mcp-server-sse:latest \
  --env HOST="0.0.0.0" \
  --env PORT="3000" \
  --env MYSQL_HOST="your_mysql_host" \
  --env MYSQL_PORT="3306" \
  --env MYSQL_USER="your_mysql_user" \
  --env MYSQL_DATABASE="your_database" \
  --env MYSQL_PASSWORD="your_mysql_password"

How to use

This MCP server provides a MySQL query interface over SSE (Server-Sent Events), built on the FastMCP framework. It exposes a real-time, high-concurrency gateway to a MySQL database with built-in security features, logging, and multi-level access control. You can use the SSE endpoints to perform metadata queries, schema lookups, and transactional SQL operations via the provided tooling inside the server, while benefiting from automatic isolation and sensitive data masking. To start, deploy the Docker image (or run via Python) and point clients to the server endpoint. The bundled environment supports configuring the MySQL connection and access policies via environment variables and the .env file, enabling you to tailor pool sizes, timeouts, risk checks, and allowed data visibility. The server offers metadata queries, structure queries, and information queries against MySQL, along with safeguards like SQL risk analysis and cross-database isolation.

How to install

Prerequisites:

  • Docker installed on the host (recommended method)
  • Optional: Python environment if you prefer running from source

Installation steps (Docker method):

  1. Pull the image: docker pull mangooer/mysql-mcp-server-sse:latest
  2. Run the container with required environment variables: docker run -d
    --name mysql-mcp-server-sse
    -e HOST=0.0.0.0
    -e PORT=3000
    -e MYSQL_HOST=your_mysql_host
    -e MYSQL_PORT=3306
    -e MYSQL_USER=your_mysql_user
    -e MYSQL_PASSWORD=your_mysql_password
    -e MYSQL_DATABASE=your_database
    -p 3000:3000
    mangooer/mysql-mcp-server-sse:latest

如果你偏好本地源码运行(Python 版本):

  1. 安装依赖: pip install -r requirements.txt
  2. 复制并编辑环境变量模板,例如:.env -> .env
  3. 启动服务: python -m src.server

注意:默认监听地址为 http://127.0.0.1:3000/sse,请确保相应端口在防火墙中开放。

Additional notes

Tips and considerations:

  • 使用 Docker 方式部署时,请将 MYSQL_HOST/PORT/USER/PASSWORD/DATABASE 设置为你实际的数据库连接信息。
  • 启用数据库隔离时,配置项包括 ENABLE_DATABASE_ISOLATION、DATABASE_ACCESS_LEVEL,确保选定的模式符合你的部署风险需求。
  • Environment variables 及 .env 文件可覆盖大多数运行时配置,密钥与敏感信息应通过环境变量或安全凭证管理。
  • 若遇到连接池相关问题,可调整 DB_POOL_MIN_SIZE、DB_POOL_MAX_SIZE、DB_POOL_ACQUIRE_TIMEOUT 等参数。
  • 该服务支持日志级别设置(LOG_LEVEL),在调试阶段可设置为 DEBUG,生产阶段通常使用 INFO 或 WARN。
  • 如果在 MySQL 8.0 上遇到认证问题,请确保 DB_AUTH_PLUGIN 与服务器配置匹配,必要时安装 cryptography 依赖。

Related MCP Servers

Sponsor this space

Reach thousands of developers