A minimal, token-efficient MCP server that lets AI clients query and explore PostgreSQL, MySQL, SQL Server, Oracle, MariaDB and SQLite databases.
benborla/mcp-server-mysql
An MCP server giving LLMs like Claude read-only access to MySQL databases, with optional write operations behind flags.
- Stars
- 2,175
- Forks
- 260
- Open issues
- 51
- Last commit
- 3 months ago
What is it?
This project implements the Model Context Protocol (MCP) for MySQL, letting an LLM client such as Claude Code or Claude Desktop inspect database schemas and run SQL queries against a MySQL server. It is designed so the model can explore data without changing it: read-only mode is the default, and insert, update, and delete operations must each be enabled through environment flags.
Beyond basic querying, it adds several safeguards and conveniences. It supports SSH tunnels for reaching remote databases, a multi-database mode for querying across several databases without reconnecting, and per-database read/write permissions. Automatic PII redaction masks sensitive values in results, and SSL/TLS connections with an optional mTLS setup are supported. A remote mode exposes the server over HTTP with bearer token authentication.
The server is installed through npx and configured with MYSQL_* environment variables. It requires Node.js 20 or later and MySQL 5.7 or newer, with 8.0 recommended.
Key features
- 01Read-only by default, with insert, update, and delete enabled through separate flags.
- 02Schema inspection and SQL query execution exposed as MCP tools and resources.
- 03SSH tunnel support for remote databases.
- 04Multi-database mode for querying several databases without reconnecting.
- 05Automatic PII redaction of sensitive values in query results.
- 06SSL/TLS connections with optional mTLS, plus HTTP remote mode with bearer token auth.
Use cases
- Letting Claude Code or Claude Desktop explore a MySQL schema and answer data questions.
- Giving an AI assistant safe, read-only analytical access to production-like data.
- Querying a remote MySQL instance through an SSH tunnel from a local AI client.
- Running cross-database analysis from a single LLM session.
Quick start
- 1
Requires Node.js v20+ and a MySQL user with appropriate privileges
- 2
Register the server with Claude Code, setting your MySQL connection environment variables
claude mcp add mcp_server_mysql -e MYSQL_HOST="127.0.0.1" -e MYSQL_PORT="3306" -e MYSQL_USER="root" -e MYSQL_PASS="your_password" -e MYSQL_DB="your_database" -- npx @benborla29/mcp-server-mysql
Things to know
- Requires Node.js v20+ and a MySQL 5.7+ database (8.0+ recommended).
- Write operations are disabled by default and must be enabled with separate environment flags.
In collections
Topics
FAQ
- What is mcp-server-mysql?
- An MCP server giving LLMs like Claude read-only access to MySQL databases, with optional write operations behind flags. This project implements the Model Context Protocol (MCP) for MySQL, letting an LLM client such as Claude Code or Claude Desktop inspect database schemas and run SQL queries against a MySQL server. It is designed so the model can explore data without changing it: read-only mode is the default, and insert, update, and delete operations must each be enabled through environment flags.
- Is mcp-server-mysql free to use? What license does it have?
- mcp-server-mysql is open source under the MIT license. Check the license terms before using it in commercial products.
- Is mcp-server-mysql still maintained?
- Updated within 6 months. The last commit to mcp-server-mysql was on Jul 27, 2026.
- What can I use mcp-server-mysql for?
- Letting Claude Code or Claude Desktop explore a MySQL schema and answer data questions. Giving an AI assistant safe, read-only analytical access to production-like data. Querying a remote MySQL instance through an SSH tunnel from a local AI client. Running cross-database analysis from a single LLM session.
- How do I install mcp-server-mysql?
- Requires Node.js v20+ and a MySQL user with appropriate privileges Register the server with Claude Code, setting your MySQL connection environment variables: claude mcp add mcp_server_mysql -e MYSQL_HOST="127.0.0.1" -e MYSQL_PORT="3306" -e MYSQL_USER="root" -e MYSQL_PASS="your_password" -e MYSQL_DB="your_database" -- npx @benborla29/mcp-server-mysql
- Where can I get mcp-server-mysql?
- The source code and installation instructions are on GitHub: https://github.com/benborla/mcp-server-mysql
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Native database IDE for macOS, Windows and Linux supporting PostgreSQL, MySQL, SQLite, Redis, MongoDB, SQL Server and ClickHouse, with a built-in MCP server and AI chat.
AI-powered database client and MCP server for desktop and web, supporting Postgres, MySQL, MariaDB, SQL Server, ClickHouse and SQLite.
A free, local-first, AI-assisted database client and SQL workspace supporting 40+ databases across desktop, web, Docker and CLI.
A TypeScript framework for building MCP servers, MCP Apps with React views, and clients, with a built-in Inspector and CLI.
An MCP proxy server that aggregates multiple MCP servers behind a single HTTP endpoint for clients such as Claude.