MySQL MCP Server

MySQL MCP server project

Local serverstdio

What is the MySQL MCP server?

Connect MySQL to Claude, Cursor or any other MCP client and it stops being a tab you switch to. MySQL MCP server project. The mysql mcp server is what makes that connection.

What the server does

This is a Model Context Protocol (MCP) server that provides access to a MySQL database. It allows agent to execute SQL queries against a MySQL database.

  • Execute SQL queries against a MySQL database:
  • Read data (SELECT statements)
  • Create tables (CREATE TABLE statements)
  • Insert data (INSERT INTO statements)
  • Update data (UPDATE statements)
  • Delete data (DELETE FROM statements)

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • run_sql_query — Executes a read-only SQL query (SELECT statements only) against the MySQL database
  • create_table — Parameters: - query: The SQL CREATE TABLE query to execute
  • insert_data — Parameters: - query: The SQL INSERT INTO query to execute
  • update_data — Example: json { "query": "UPDATE products SET price = 899.99 WHERE name = 'Laptop'" }
  • delete_data — Parameters: - query: The SQL DELETE FROM query to execute

Installation

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client.

Credentials and setup notes

Configuration is passed through the environment: MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

  • Node.js (v14 or higher) - MySQL server - MCP SDK

Where it fits

Among the database access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. MySQL's toolset — run_sql_query, create_table, insert_data and 2 more — is a fair guide to whether it matches your workflow. It is maintained by michael7736; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
run_sql_queryExecutes a read-only SQL query (SELECT statements only) against the MySQL database.
create_tableParameters: - query: The SQL CREATE TABLE query to execute.
insert_dataParameters: - query: The SQL INSERT INTO query to execute.
update_dataExample: json { "query": "UPDATE products SET price = 899.99 WHERE name = 'Laptop'" }
delete_dataParameters: - query: The SQL DELETE FROM query to execute.

Configuration

  • Node.js (v14 or higher) - MySQL server - MCP SDK
VariableDescriptionRequired
MYSQL_HOSTEndpoint or connection string the server talks to.Optional
MYSQL_PORTConfiguration value read at startup.Optional
MYSQL_USERConfiguration value read at startup.Optional
MYSQL_PASSWORDConfiguration value read at startup.Optional
MYSQL_DATABASEConfiguration value read at startup.Optional

Example prompts to try

  • Use MySQL to run sql query.
  • Use MySQL to create table.
  • Use MySQL to insert data.

Frequently asked questions

It is an MCP server that allows AI agents to execute SQL queries against a MySQL database, supporting SELECT, CREATE, INSERT, UPDATE, and DELETE operations.