A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface. To install MySQL Server for Claude Desktop automatically via Smithery: The server requires the following environment variables to be set in your MCP settings configuration file: 在 ~/.codex/config.toml 在 %USERPROFILE%\.codex\config
Add this skill
npx mdskills install f4ww4z/mcp-mysql-serverWell-documented MySQL MCP server with comprehensive tool set and security features
1# @f4ww4z/mcp-mysql-server2[](https://archestra.ai/mcp-catalog/f4ww4z__mcp-mysql-server)3[](https://smithery.ai/server/@f4ww4z/mcp-mysql-server)45A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface.67<a href="https://glama.ai/mcp/servers/qma33al6ie"><img width="380" height="200" src="https://glama.ai/mcp/servers/qma33al6ie/badge" alt="mcp-mysql-server MCP server" /></a>89## Installation1011### Installing via Smithery1213To install MySQL Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@f4ww4z/mcp-mysql-server):1415```bash16npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude17```1819### Manual Installation20```bash21npx @f4ww4z/mcp-mysql-server22```2324## Configuration2526The server requires the following environment variables to be set in your MCP settings configuration file:2728> recommended use2930```json31{32 "mcpServers": {33 "mysql": {34 "command": "npx",35 "args": ["-y", "@f4ww4z/mcp-mysql-server", "mysql://user:password@localhost:port/database"],36 }37 }38}39```4041```json42{43 "mcpServers": {44 "mysql": {45 "command": "npx",46 "args": ["-y", "@f4ww4z/mcp-mysql-server"],47 "env": {48 "MYSQL_HOST": "your_host",49 "MYSQL_USER": "your_user",50 "MYSQL_PASSWORD": "your_password",51 "MYSQL_DATABASE": "your_database"52 }53 }54 }55}56```57## codex5859### mac6061在 `~/.codex/config.toml`6263```toml64[mcp_servers.mcp-mysql-server]65command = "npx"66args = [67 "-y",68 "@f4ww4z/mcp-mysql-server",69 "mysql://user:password@127.0.0.1:3306/database"70]71```7273### windows7475在 `%USERPROFILE%\.codex\config.toml`7677```toml78[mcp_servers.mcp-mysql-server]79command = "npx"80args = [81 "-y",82 "@f4ww4z/mcp-mysql-server",83 "mysql://user:password@127.0.0.1:3306/database"84]85```868788## Running evals8990The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found [here](https://www.mcpevals.io/docs).9192```bash93OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts94```95## Available Tools9697### 1. connect_db98Establish connection to MySQL database using provided credentials.99100```typescript101use_mcp_tool({102 server_name: "mysql",103 tool_name: "connect_db",104 arguments: {105 host: "localhost",106 user: "your_user",107 password: "your_password",108 database: "your_database"109 }110});111```112113### 2. query114Execute SELECT queries with optional prepared statement parameters.115116```typescript117use_mcp_tool({118 server_name: "mysql",119 tool_name: "query",120 arguments: {121 sql: "SELECT * FROM users WHERE id = ?",122 params: [1]123 }124});125```126127### 3. execute128Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.129130```typescript131use_mcp_tool({132 server_name: "mysql",133 tool_name: "execute",134 arguments: {135 sql: "INSERT INTO users (name, email) VALUES (?, ?)",136 params: ["John Doe", "john@example.com"]137 }138});139```140141### 4. list_tables142List all tables in the connected database.143144```typescript145use_mcp_tool({146 server_name: "mysql",147 tool_name: "list_tables",148 arguments: {}149});150```151152### 5. describe_table153Get the structure of a specific table.154155```typescript156use_mcp_tool({157 server_name: "mysql",158 tool_name: "describe_table",159 arguments: {160 table: "users"161 }162});163```164165## Features166167- Secure connection handling with automatic cleanup168- Prepared statement support for query parameters169- Comprehensive error handling and validation170- TypeScript support171- Automatic connection management172173## Security174175- Uses prepared statements to prevent SQL injection176- Supports secure password handling through environment variables177- Validates queries before execution178- Automatically closes connections when done179180## Error Handling181182The server provides detailed error messages for common issues:183- Connection failures184- Invalid queries185- Missing parameters186- Database errors187188## Contributing189190Contributions are welcome! Please feel free to submit a Pull Request to https://github.com/f4ww4z/mcp-mysql-server191192## License193194MIT195
Full transparency — inspect the skill content before installing.