Data as of

MySQL MCP Server for VS Code: Setup & Config

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

What you can do with MySQL in VS Code

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

  • Explore an unfamiliar database's tables and column types.
  • Query multiple databases using qualified table names.

Before you start: MySQL in VS Code

  • 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 VS Code configuration

  1. Choose VS Code configuration scope

    For MySQL MCP Server, open Workspace: .vscode/mcp.json. Merge into servers; preserve existing inputs.

  2. Add MySQL MCP Server to VS Code

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

  3. Check MySQL MCP Server in VS Code

    MySQL MCP Server: Start in VS Code’s MCP controls; inspect output and trust prompts.

Config file · Workspace: .vscode/mcp.json

JSON
{
  "servers": {
    "mysql_mcp_server": {
      "type": "stdio",
      "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 VS Code

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

execute_sql

Look for execute_sql among VS Code's agent-mode tools after starting MySQL through the MCP controls.

get_schema_info

Look for get_schema_info among VS Code's agent-mode tools after starting MySQL through the MCP controls.

Inspect columns, types, defaults, nullability, and comments for database tables.

get_table_sample

Look for get_table_sample among VS Code's agent-mode tools after starting MySQL through the MCP controls.

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

MySQL: full stored tool descriptions

Troubleshooting MySQL in VS Code

  • Make uvx --from (from uv, for Python tools) available in the workspace, container, or remote environment hosting MySQL MCP Server. Start through VS Code's MCP controls; inspect output and trust prompts.
  • For MySQL MCP Server, keep MYSQL_DATABASE, MYSQL_HOST, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_USER out of version control; VS Code documents input variables and secret handling.
  • MySQL MCP Server uses stdio here: VS Code 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 VS Code troubleshooting lives in the /clients/vscode guide.

MySQL MCP Server — details. VS Code guide

Frequently asked questions

For MySQL MCP Server, edit workspace .vscode/mcp.json. VS Code requires servers rather than mcpServers; preserve the displayed type on each entry.

VS Code's mysql_mcp_server example uses stdio.

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

VS Code'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 VS Code's connected tool list; the stored list is not a live check.

No. execute_sql supports SELECT and inspection statements as well as INSERT, UPDATE, and DELETE, subject to the database user's permissions.

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