MCP Mysql Server MCP Server

一个提供MySQL数据库操作的模型上下文协议服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。支持对数据库的所有操作。

Local serverstdioTypeScript

What is the MCP Mysql Server MCP server?

Connect MCP Mysql Server to Claude, Cursor or any other MCP client and it stops being a tab you switch to. 一个提供MySQL数据库操作的模型上下文协议服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。支持对数据库的所有操作。. The mcp mysql server mcp server is what makes that connection.

What the server does

A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface.

  • Secure connection handling with automatic cleanup
  • Prepared statement support for query parameters
  • Comprehensive error handling and validation
  • TypeScript support
  • Automatic connection management

Installation

@smithery/cli on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

Credentials and setup notes

Configuration is passed through the environment: MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, OPENAI_API_KEY. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Where it fits

Among the database access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. It is maintained by huangfeng19820712; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

How to install the MCP Mysql Server MCP server

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@fhuang/mcp-mysql-server", "mysql://user:password@localhost:port/database"],
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
MYSQL_HOSTEndpoint or connection string the server talks to.Optional
MYSQL_USERConfiguration value read at startup.Optional
MYSQL_PASSWORDConfiguration value read at startup.Optional
MYSQL_DATABASEConfiguration value read at startup.Optional
OPENAI_API_KEYCredential the server authenticates with.Yes

Frequently asked questions

It uses prepared statements for all parameterized queries, ensuring user input is safely escaped.