Skip to main content
Glama
MySQL MCP Server

MySQL MCP Server

by Woodrose233

MySQL MCP Server (HTTP/SSE Edition)

A Model Context Protocol (MCP) server implementation for MySQL databases, featuring a stateless HTTP/SSE architecture.

This project is a modified version based on the original work by designcomputer/mysql_mcp_server.

Key Improvements

  • Stateless HTTP/SSE Support: Switched from stdio-based communication to an HTTP/SSE model using FastMCP, making it suitable for cloud deployment and remote access.

  • Enhanced Configuration: Added support for .env files using python-dotenv.

  • Improved Diagnostics: Detailed error messages when database environment variables are missing or incorrect.

  • Flexible Deployment: Can be run as a standalone server or managed by AI IDEs like Trae or Claude Desktop.

Related MCP server: MCP MySQL Server

Features

  • Tools: Execute custom SQL queries, list tables.

  • Resources: Access table data directly via mysql://{table}/data URIs.

  • Security: Database credentials managed via environment variables.

Installation

  1. Clone this repository:

    git clone <your-repository-url>
    cd mysql_mcp_server_http
  2. Install dependencies:

    pip install mcp mysql-connector-python python-dotenv uvicorn
  3. Create a .env file in the project root:

    MYSQL_HOST=localhost
    MYSQL_PORT=3306
    MYSQL_USER=root
    MYSQL_PASSWORD=your_password
    MYSQL_DATABASE=your_database

Usage

Manual Start (Standalone)

Run the server using the module command:

python -m mysql_mcp_server_http.server

The server will start on http://0.0.0.0:8000/mcp.

Integrating with AI IDEs (e.g., Trae)

Add the following JSON configuration to your mcpServers settings:

{
  "mcpServers": {
    "mysql_http": {
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Acknowledgements

This project is inspired by and modified from mysql_mcp_server by @designcomputer.

License

MIT License. See LICENSE for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.
      5
      290 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.
      7
      MIT
    • F
      license
      A
      quality
      Not graded
      maintenance
      A Model Context Protocol server that enables agents to execute SQL queries against a MySQL database, supporting operations like SELECT, CREATE TABLE, INSERT, UPDATE, and DELETE with results returned in JSON format.
      6
      798 npm
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with MySQL databases through the Model Context Protocol, allowing users to execute SQL queries and check connection status. It provides tools for seamless database management and built-in SQL query examples.
      1
      ISC