mcp-registry/mcp-server-mysql

    ==================
      
       /// MCP ///
      /// MCP ///
        
    ==================
        
    [server:online]
    [protocol:ready]

mcp-server-mysql

by benborla

A Model Context Protocol (MCP) server that lets LLMs inspect MySQL schemas and execute SQL queries (read-only by default, writable when enabled). Built with Node.js.

679
91
Open Source

01

mysql_query

Execute SQL queries against the connected MySQL database (read-only by default, with optional INSERT, UPDATE and DELETE support when enabled).

Installation

1. Prerequisites:
• Node.js ≥ 18 and npm ≥ 9
• An existing MySQL server that the MCP instance can connect to (read-only user recommended).
2. Clone the repository:
git clone https://github.com/benborla/mcp-server-mysql.git cd mcp-server-mysql
3. Install dependencies:
npm install # or yarn install
4. Configuration:
Create a `.env` file (or export the variables some other way) with at least the following keys:
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USER=readonly_user MYSQL_PASSWORD=strong_password MYSQL_DATABASE=my_db # Optional server settings SERVER_PORT=8080 # HTTP port the MCP server will listen on ALLOW_ORIGINS=* # CORS origins, comma-separated
5. Start the server:
npm run start # or: node src/index.js
6. Verify:
The server should print something similar to:
``MCP MySQL server listening on http://localhost:8080``. Hit `/schema` or `/healthz` endpoints to confirm it is up.
7. (Optional) Docker:
If a Dockerfile is present you can run:
docker build -t mcp-mysql . docker run -d -p 8080:8080 \ -e MYSQL_HOST=host.docker.internal \ -e MYSQL_USER=readonly_user \ -e MYSQL_PASSWORD=strong_password \ -e MYSQL_DATABASE=my_db \ mcp-mysql

Documentation

License: MIT License
Updated 7/30/2025

Table of Contents