mysql-mcp-server

SuMiaoALi/mysql-mcp-server

3.3

If you are the rightful owner of mysql-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that provides secure MySQL database operations for AI assistants and other MCP clients.

The MySQL MCP Server is a specialized server designed to facilitate secure and efficient interactions with MySQL databases through the Model Context Protocol (MCP). It is tailored for AI assistants and other MCP clients, ensuring that database operations are conducted safely and effectively. The server supports a range of operations, including executing SQL queries, retrieving table information, and inserting data, all while maintaining a strong focus on security. By leveraging parameterized queries and automatic LIMIT clauses, the server mitigates risks such as SQL injection and large data dumps. Additionally, connection pooling is employed to manage database connections efficiently, preventing resource exhaustion. The server is easily configurable through environment variables, allowing users to customize their database connections according to their needs. With its robust feature set and security measures, the MySQL MCP Server is an ideal solution for applications requiring reliable database interactions.

Features

  • Execute safe SQL queries (SELECT, INSERT, SHOW, DESCRIBE)
  • Get detailed table structure information
  • Convenient data insertion with automatic parameterization
  • List all tables in the database
  • SQL Injection Protection with parameterized queries

Usages

usage with Claude Desktop

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["mysql-mcp-server"],
      "env": {
        "MYSQL_HOST": "your-mysql-host",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "your-username",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DB": "your-database"
      }
    }
  }
}

usage with other MCP clients

bash
npx mysql-mcp-server

Tools

  1. execute_query

    Execute safe SQL queries (SELECT, INSERT, SHOW, DESCRIBE)

  2. get_table_info

    Get detailed table structure information

  3. insert_data

    Convenient data insertion with automatic parameterization

  4. list_tables

    List all tables in the database