MySQL MCP Server

by vitalyDV

4 stars
352 downloads
Not rated
GitHub

About

MySQL MCP Server is an MCP (Model Context Protocol) server that integrates with MySQL databases. It allows AI assistants and MCP-compatible clients to execute read-only SQL queries, explore database schemas, and retrieve table data. The server is intended for developers who want…

Details

Author
vitalyDV
GitHub stars
4
Downloads
352
Categories
Database

- Execute read‑only SQL queries (SELECT, SHOW, EXPLAIN, DESCRIBE)
- Retrieve the structure (schema) of any table
- List all tables in the connected database
- Access table data via the resource table://{name} (up to 100 rows)
- Simple environment‑variable based configuration

Clone the repository from GitHub, install dependencies with npm install, and add the server configuration to your mcp.json file under mcpServers. The configuration requires setting environment variables for the MySQL connection (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB). The server is started with the command node ./mysql-mcp/index.js.

MySQL MCP Server

This project implements an MCP (Model Context Protocol) server for working with MySQL database.

Repository

This project is available on GitHub:
https://github.com/vitalyDV/mysql-mcp

Clone the repository

git clone https://github.com/vitalyDV/mysql-mcp.git
cd mysql-mcp
npm install

add config to mcp.json

{
  "mcpServers": {
    "mysql_mcp_readonly": {
      "command": "node",
      "args": [
        "./mysql-mcp/index.js"
      ],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "",
        "MYSQL_DB": "db",
      }
    }
  }
}

Environment Variables

- MYSQL_HOST - MySQL server host
- MYSQL_PORT - MySQL server port
- MYSQL_USER - MySQL username
- MYSQL_PASS - MySQL password
- MYSQL_DB - MySQL database name

Available MCP tools

- query - execute SQL queries (only SELECT, SHOW, EXPLAIN, DESCRIBE)
- table-schema - get table structure
- list-tables - get list of all tables in the database

Available MCP resources

- table://{name} - get data from the specified table (up to 100 rows)

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.