- Home
- MCP servers
- MySQL
MySQL
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"mcp-mirror-f4ww4z_mcp-mysql-server": {
"command": "npx",
"args": [
"-y",
"@f4ww4z/mcp-mysql-server"
],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_USER": "your_user",
"MYSQL_DATABASE": "your_database",
"MYSQL_PASSWORD": "your_password"
}
}
}
}You can run an MCP server that exposes MySQL database operations, enabling AI models to securely connect, query, and modify MySQL data through a standardized interface. This server handles secure connections, prepared statements, error handling, and automatic cleanup so you can focus on building reliable AI-enabled data workflows.
How to use
Connect your MCP client to the MySQL MCP server using the configured server entry. Establish a connection with the provided credentials, then send database operations through the predefined tool endpoints. You can create a connection, run SELECT queries with parameters, perform INSERT/UPDATE/DELETE actions, and inspect database schemas by listing tables and describing specific tables. The server ensures prepared statements are used to prevent SQL injection and manages connections automatically, so you don’t have to manually open or close them.
How to install
Prerequisites you need before installing:
- Node.js and npm (or another Node-based runtime with npx available).
- A MySQL server reachable with host, user, password, and database values you will provide in configuration.
npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude
# Or manual installation (start the server directly)
npx @f4ww4z/mcp-mysql-server
Additional configuration and notes
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@f4ww4z/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
The server uses secure password handling via environment variables, validates queries before execution, and will automatically close connections when finished. It supports prepared statements for query parameters and provides detailed error messages for connection failures, invalid queries, missing parameters, and database errors.
Configuration details
To enable the MySQL MCP server, set up the MCP settings configuration to point to the server entry named mysql. The environment variables provide the host, user, password, and database name that the server will connect to.
Security and error handling
Security is enforced through prepared statements to prevent SQL injection and through secure handling of password values via environment variables. The server validates queries before execution and automatically closes connections when operations are complete.
Troubleshooting and notes
If you encounter connection failures, verify that the MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DATABASE values are correct and that the MySQL server is reachable from your MCP environment. If queries fail, check the SQL syntax and ensure the target tables exist. Readable error messages will indicate whether issues are related to connections, invalid queries, or database errors.
Tools and capabilities overview
The MySQL MCP server provides a set of tools to manage and interact with the database: connect_db to establish a connection, query to run SELECT statements with optional parameters, execute to run INSERT/UPDATE/DELETE statements with optional parameters, list_tables to enumerate tables in the current database, and describe_table to inspect the structure of a specific table.
Available tools
connect_db
Establish a connection to the MySQL database using the provided host, user, password, and database.
query
Execute a SELECT query with optional prepared statement parameters.
execute
Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.
list_tables
List all tables in the connected database.
describe_table
Get the structure and columns of a specific table.