
mcp-mysql-server
MCP server giving AI assistants query and schema access to MySQL databases
mcp-mysql-server is an open-source MCP server for databases. It is available on CLI and Self-hosted.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- What it can do
- Can change data (1 tool)
- GitHub stars
- 171
- Last commit
- Language
- JavaScript
Similar MCP servers
About mcp-mysql-server
This server bridges MySQL and any Model Context Protocol client, so an assistant can connect to a database, read table layouts, run SELECT statements and perform writes without leaving the chat. It is started with npx and configured through a connection URL or separate host, user, password and database environment variables.
Queries accept optional placeholder parameters, which keeps user-supplied values out of the raw SQL text. Connections are opened and closed by the server, so clients do not have to manage them manually. Setup instructions are included for Claude Desktop via Smithery and for the Codex configuration file on macOS and Windows.
It suits developers and data analysts who want an assistant to explore a MySQL schema or pull figures from a database they already run. Because it can also execute INSERT, UPDATE and DELETE statements, it is best pointed at a database account with limited privileges.
Tools this server provides (5)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 5 tools changes data; 1 name doesn't say.
From the server's own tool labels and tool names; not verified by us.
- connect_db
- Establish connection to MySQL database using provided credentials.
- queryName suggests: reads
- Execute SELECT queries with optional prepared statement parameters.
- executeName suggests: changes
- Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.
- list_tablesName suggests: reads
- List all tables in the connected database.
- describe_tableName suggests: reads
- Get the structure of a specific table.
What it does
- Schema exploration
- Lists the tables in the connected database and shows the structure of any chosen table.
- Parameterised SELECT queries
- Runs read queries with placeholder values passed separately from the SQL text.
- Write operations
- Executes INSERT, UPDATE and DELETE statements with optional bound parameters.
- Flexible connection setup
- Accepts a single MySQL connection URL or individual host, user, password and database variables.
- Automatic connection handling
- Opens database connections as needed and closes them when work is finished.
- Client configuration examples
- Provides ready-to-copy config snippets for Claude Desktop and Codex on macOS and Windows.
Good for
- Letting an assistant answer questions about data stored in a MySQL database
- Inspecting an unfamiliar schema by listing tables and their columns
- Generating reports by running read-only SELECT queries from a chat
- Adding or updating rows in a development database during prototyping
- Testing SQL statements interactively before using them in an application
Pricing
Open source
Free and open source under the MIT license.
More servers for the same service
mcp-mysql-server FAQ
What license is mcp-mysql-server released under?
It is released under the MIT license.
How is the server installed?
It can be installed through Smithery for Claude Desktop, or run directly with npx using the package name @f4ww4z/mcp-mysql-server.
How are database credentials supplied?
They can be passed as a MySQL connection URL in the server arguments, or as MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE environment variables.
Does mcp-mysql-server protect against SQL injection?
Queries can use prepared statement parameters, which the server describes as its protection against SQL injection.
Is mcp-mysql-server free?
Yes. mcp-mysql-server is open source, so you can use and self-host it for free.
What are the best alternatives to mcp-mysql-server?
The closest alternatives to mcp-mysql-server are mysql_mcp_server, mcp-server-mysql, mysql-mcp-server, postgres_mcp and MySQL Ops MCP.
Where this comes from
- Description: written from the project's README.



