Data as of

MySQL MCP Server for Cursor: Setup & Config

Cursor: Expose MySQL schema inspection, data samples, and SQL execution to MCP assistants.

What you can do with MySQL in Cursor

Choose it for focused MySQL exploration with schemas, bounded samples, and explicit SQL access.

  • Query multiple databases using qualified table names.
  • Reach a MySQL instance through a configured SSH tunnel.

Before you start: MySQL in Cursor

  • uv for the documented uvx launch
  • An accessible MySQL instance
  • MySQL credentials with the required permissions
  • An MCP-compatible client

This is the README's VS Code stdio launch. Put database values in the client's env block rather than assuming the project's .env will be discovered. Network SSE deployments require an authentication proxy outside localhost.

MySQL Cursor configuration

  1. Choose Cursor configuration scope

    For MySQL MCP Server, open Project: .cursor/mcp.json User: ~/.cursor/mcp.json. Merge into mcpServers at project or user scope.

  2. Add MySQL MCP Server to Cursor

    Use the mysql_mcp_server entry below in mcpServers. Keep MySQL MCP Server's documented stdio connection fields and your other Cursor entries.

  3. Check MySQL MCP Server in Cursor

    MySQL MCP Server: Enable in Cursor’s MCP settings; inspect tools.

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

JSON
{
  "mcpServers": {
    "mysql_mcp_server": {
      "command": "uvx",
      "args": [
        "--from",
        "mysql-mcp-server",
        "mysql_mcp_server"
      ],
      "env": {
        "MYSQL_HOST": "<MySQL hostname>",
        "MYSQL_PORT": "<MySQL port, default 3306>",
        "MYSQL_USER": "<dedicated least-privilege MySQL username>",
        "MYSQL_PASSWORD": "<MySQL account password>",
        "MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
      }
    }
  }
}

MySQL tools available to Cursor

MySQL's stored tool list documents 3 tools; compare it with Cursor's connected tool list, because the stored list is not a live check.

execute_sql

Find execute_sql under MySQL in Cursor's MCP settings; inspect its arguments when the agent requests a call.

Run one SQL statement, including reads and permitted data-modification operations.

get_schema_info

Find get_schema_info under MySQL in Cursor's MCP settings; inspect its arguments when the agent requests a call.

get_table_sample

Find get_table_sample under MySQL in Cursor's MCP settings; inspect its arguments when the agent requests a call.

Read a table sample capped at 20 rows, including cross-database targets.

MySQL: full stored tool descriptions

Troubleshooting MySQL in Cursor

  • Cursor must find uvx --from (from uv, for Python tools) for MySQL MCP Server. Enable the project/user entry in MCP settings and inspect its tools.
  • Review MYSQL_DATABASE, MYSQL_HOST, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_USER for MySQL MCP Server before sharing project .cursor/mcp.json; project scope travels with the repository.
  • MySQL MCP Server uses stdio here: Cursor must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
  • Known limitation: SQL execution includes writes when database permissions allow them.
  • Known limitation: Only single-statement SQL calls are supported.
  • Known limitation: SSE mode needs external authentication when exposed beyond localhost.
  • General Cursor troubleshooting lives in the /clients/cursor guide.

MySQL MCP Server — details. Cursor guide

Frequently asked questions

Cursor's MySQL MCP Server entry belongs under mcpServers in .cursor/mcp.json (project) or ~/.cursor/mcp.json (user). Confirm the active scope in MCP settings.

Cursor's mysql_mcp_server example uses stdio.

MySQL MCP Server's Cursor configuration invokes uvx --from (from uv, for Python tools).

Cursor's MySQL MCP Server example references MYSQL_DATABASE, MYSQL_HOST, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_USER. Check these names if startup or authentication fails; the example alone does not distinguish required from optional values.

MySQL MCP Server's stored list contains 3 tools, including execute_sql, get_schema_info, get_table_sample. Compare those names with Cursor's connected tool list; the stored list is not a live check.

No. The README limits each SQL call to a single statement.

Clients can launch the process from a different directory. The README recommends putting MYSQL_* settings directly in the MCP environment configuration.