mcp-mysql-server is a Model Context Protocol server for providing MySQL database operations. It enables AI models to interact with MySQL databases through a standardized interface. The project repository address is https://github.com/f4ww4z/mcp-mysql-server。
Purpose: This project serves as an MCP server, providing a standardized channel for interaction between AI models and MySQL databases.
Main capabilities:
- Establish a connection to a MySQL database using the provided credentials.
- Execute SELECT queries, with optional prepared statement parameters.
- Execute INSERT, UPDATE, or DELETE queries, with optional prepared statement parameters.
- List all tables in the connected database.
- Get the structure of a specific table.
Security and functional features:
- Secure connection handling and automatic cleanup.
- Query parameters supporting prepared statements.
- Comprehensive error handling and validation.
- TypeScript support.
- Automatic connection management.
- Use prepared statements to prevent SQL injection.
- Support secure password handling through environment variables.
- Validate queries before execution.
- Automatically close the connection after completion.
Usage: MySQL Server for Claude Desktop can be installed automatically via Smithery. It can also be installed manually, which requires setting environment variables in the MCP settings configuration file. Recommended usage includes configuring in ~/.codex/config.toml or %USERPROFILE%.codex\config.toml. The evals package loads an mcp client and then runs the index.ts file, so there is no need to rebuild between tests. Environment variables can be loaded by adding a prefix before the npx command.
Available tools:
- Connection tool: Establish a connection to a MySQL database using the provided credentials.
- SELECT query tool: Execute SELECT queries, with optional prepared statement parameters.
- Data modification tool: Execute INSERT, UPDATE, or DELETE queries, with optional prepared statement parameters.
- List tool: List all tables in the connected database.
- describe_table tool: Get the structure of a specific table.
Error handling: The server provides detailed error information for common issues, including connection failures, invalid queries, missing parameters, and database errors.
Limitations: The current information does not provide details regarding fees, pricing, platform compatibility, specific performance, or effectiveness.