mcp -mysql
A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
claude mcp add --transport stdio benborla-mcp-server-mysql npx -y @benborla29/mcp-server-mysql \ --env MYSQL_DB="your_database" \ --env MYSQL_HOST="your_host" \ --env MYSQL_PASS="your_password" \ --env MYSQL_PORT="3306" \ --env MYSQL_USER="your_user" \ --env ALLOW_DELETE_OPERATION="false" \ --env ALLOW_INSERT_OPERATION="false" \ --env ALLOW_UPDATE_OPERATION="false" \ --env MYSQL_DISABLE_READ_ONLY_TRANSACTIONS="false"
How to use
This MCP server provides secure access to a MySQL database through SSH tunnels and exposes the database via the MCP protocol for use with Claude Code and other LLM-driven workflows. It supports multiple databases and project configurations, along with tunnel management hooks that integrate with Claude start/stop events. With this server, Claude can inspect schemas, run read queries, and perform controlled write operations according to the environment variable permissions you enable. The included SSH tunnel support helps you securely connect to remote databases without exposing them publicly. To get started, configure the required environment variables for your MySQL instance, install the MCP server package, and run it through your preferred runner (npx, local repo, or a global installation). Once running, you can add this MCP server to Claude Code, verify its status, and begin issuing SQL-related prompts and operations through the MCP interface.
How to install
Prerequisites:
- Node.js v20 or higher
- npm (comes with Node.js) or pnpm
- Access credentials to the MySQL database you will expose through MCP
Installation options:
- Quick start with npx (no local install):
- Ensure you have credentials for your MySQL instance and SSH tunnel (if remote).
- Run in your project or Claude environment:
npx -y @benborla29/mcp-server-mysql
- Global installation (preferred if you plan to reuse across projects):
npm install -g @benborla29/mcp-server-mysql
Then add the server to Claude Code (examples assume default local host and database):
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" \
-e ALLOW_INSERT_OPERATION="false" \
-e ALLOW_UPDATE_OPERATION="false" \
-e ALLOW_DELETE_OPERATION="false" \
-- npx @benborla29/mcp-server-mysql
If you are developing locally from a repository, you can run the server with a direct node path once you build/run the dist or src entry point, for example:
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" \
-- /path/to/node /full/path/to/mcp-server-mysql/dist/index.js
- Using a package.json script (optional):
"scripts": {
"start-mcp-mysql": "npx -y @benborla29/mcp-server-mysql"
}
Then run:
npm run start-mcp-mysql
Prerequisites for SSH tunnels and multi-database setups are covered in the README and configuration sections of the project. Ensure your environment variables reflect the desired access controls and that SSH keys or port forwarding are properly configured for your remote MySQL instances.
Additional notes
- This MCP server leverages SSH tunnels for remote databases; ensure your SSH keys, agents, and tunnel commands are accessible in the execution environment.
- For multi-database setups, omit the MYSQL_DB variable to enable multi-database mode.
- You can adjust permissions at runtime by setting ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, and ALLOW_DELETE_OPERATION to true/false as needed.
- If using Claude Code, you can import the server configuration via Claude Desktop or add it using the Claude Code CLI as shown in the README examples.
- If you encounter path issues when running from a local repository, ensure PATH and NODE_PATH are correctly set to your Node.js installation.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.