Skip to content
Back to search

mcp-mysql-server

A Model Context Protocol server for MySQL database operations

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/f4ww4z--mcp-mysql-server/badge.svg)](/listings/f4ww4z--mcp-mysql-server)

HTML

<a href="/listings/f4ww4z--mcp-mysql-server"><img src="/api/listings/f4ww4z--mcp-mysql-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Installing via Smithery

To install MySQL Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@f4ww4z/mcp-mysql-server):

npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude

Manual Installation

npx @f4ww4z/mcp-mysql-server

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 194 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # @f4ww4z/mcp-mysql-server
  2. [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/f4ww4z/mcp-mysql-server)](https://archestra.ai/mcp-catalog/f4ww4z__mcp-mysql-server)
  3. [![smithery badge](https://smithery.ai/badge/@f4ww4z/mcp-mysql-server)](https://smithery.ai/server/@f4ww4z/mcp-mysql-server)
  4. A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface.
  5. <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>
  6. ## Installation
  7. ### Installing via Smithery
  8. To install MySQL Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@f4ww4z/mcp-mysql-server):
  9. ```bash
  10. npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude
  11. ```
  12. ### Manual Installation
  13. ```bash
  14. npx @f4ww4z/mcp-mysql-server
  15. ```
  16. ## Configuration
  17. The server requires the following environment variables to be set in your MCP settings configuration file:
  18. > recommended use
  19. ```json
  20. {
  21. "mcpServers": {
  22. "mysql": {
  23. "command": "npx",
  24. "args": ["-y", "@f4ww4z/mcp-mysql-server", "mysql://user:password@localhost:port/database"],
  25. }
  26. }
  27. }
  28. ```
  29. ```json
  30. {
  31. "mcpServers": {
  32. "mysql": {
  33. "command": "npx",
  34. "args": ["-y", "@f4ww4z/mcp-mysql-server"],
  35. "env": {
  36. "MYSQL_HOST": "your_host",
  37. "MYSQL_USER": "your_user",
  38. "MYSQL_PASSWORD": "your_password",
  39. "MYSQL_DATABASE": "your_database"
  40. }
  41. }
  42. }
  43. }
  44. ```
  45. ## codex
  46. ### mac
  47. 在 `~/.codex/config.toml`
  48. ```toml
  49. [mcp_servers.mcp-mysql-server]
  50. command = "npx"
  51. args = [
  52. "-y",
  53. "@f4ww4z/mcp-mysql-server",
  54. "mysql://user:password@127.0.0.1:3306/database"
  55. ]
  56. ```
  57. ### windows
  58. 在 `%USERPROFILE%\.codex\config.toml`
  59. ```toml
  60. [mcp_servers.mcp-mysql-server]
  61. command = "npx"
  62. args = [
  63. "-y",
  64. "@f4ww4z/mcp-mysql-server",
  65. "mysql://user:password@127.0.0.1:3306/database"
  66. ]
  67. ```
  68. ## Running evals
  69. The 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).
  70. ```bash
  71. OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts
  72. ```
  73. ## Available Tools
  74. ### 1. connect_db
  75. Establish connection to MySQL database using provided credentials.
  76. ```typescript
  77. use_mcp_tool({
  78. server_name: "mysql",
  79. tool_name: "connect_db",
  80. arguments: {
  81. host: "localhost",
  82. user: "your_user",
  83. password: "your_password",
  84. database: "your_database"
  85. }
  86. });
  87. ```
  88. ### 2. query
  89. Execute SELECT queries with optional prepared statement parameters.
  90. ```typescript
  91. use_mcp_tool({
  92. server_name: "mysql",
  93. tool_name: "query",
  94. arguments: {
  95. sql: "SELECT * FROM users WHERE id = ?",
  96. params: [1]
  97. }
  98. });
  99. ```
  100. ### 3. execute
  101. Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.
  102. ```typescript
  103. use_mcp_tool({
  104. server_name: "mysql",
  105. tool_name: "execute",
  106. arguments: {
  107. sql: "INSERT INTO users (name, email) VALUES (?, ?)",
  108. params: ["John Doe", "john@example.com"]
  109. }
  110. });
  111. ```
  112. ### 4. list_tables
  113. List all tables in the connected database.
  114. ```typescript
  115. use_mcp_tool({
  116. server_name: "mysql",
  117. tool_name: "list_tables",
  118. arguments: {}
  119. });
  120. ```
  121. ### 5. describe_table
  122. Get the structure of a specific table.
  123. ```typescript
  124. use_mcp_tool({
  125. server_name: "mysql",
  126. tool_name: "describe_table",
  127. arguments: {
  128. table: "users"
  129. }
  130. });
  131. ```
  132. ## Features
  133. - Secure connection handling with automatic cleanup
  134. - Prepared statement support for query parameters
  135. - Comprehensive error handling and validation
  136. - TypeScript support
  137. - Automatic connection management
  138. ## Security
  139. - Uses prepared statements to prevent SQL injection
  140. - Supports secure password handling through environment variables
  141. - Validates queries before execution
  142. - Automatically closes connections when done
  143. ## Error Handling
  144. The server provides detailed error messages for common issues:
  145. - Connection failures
  146. - Invalid queries
  147. - Missing parameters
  148. - Database errors
  149. ## Contributing
  150. Contributions are welcome! Please feel free to submit a Pull Request to https://github.com/f4ww4z/mcp-mysql-server
  151. ## License
  152. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.