Skip to main content
Glama
ImRieul

MySQL MCP Server

by ImRieul

@imrieul/mysql-mcp-server

한국어 | 日本語 | 中文 | Español | Português | Français | Русский

A simple MySQL MCP server.

Features

  • LLM-friendly — compact column/row format, auto LIMIT, error hints with next-action suggestions

  • Bulk schemadescribe_all_tables returns entire DB schema in one call

  • Read-only mode — app-level prefix check + DB-level SET SESSION TRANSACTION READ ONLY

  • Query timeoutPromise.race() based timeout with guaranteed connection cleanup

  • SSL support — one env var to enable encrypted connections

  • Minimal — 3 dependencies, zero config required

Quick Start

Add to your MCP config (.mcp.json or claude_desktop_config.json):

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@imrieul/mysql-mcp-server"],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "your-password",
        "MYSQL_DATABASE": "your-database"
      }
    }
  }
}

Or with a connection string:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@imrieul/mysql-mcp-server", "mysql://root:password@localhost:3306/mydb"]
    }
  }
}

Read-only mode with SSL

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@imrieul/mysql-mcp-server", "--readonly"],
      "env": {
        "MYSQL_HOST": "db.example.com",
        "MYSQL_USER": "readonly_user",
        "MYSQL_PASSWORD": "password",
        "MYSQL_DATABASE": "production",
        "MYSQL_SSL": "true",
        "MYSQL_QUERY_TIMEOUT": "10000"
      }
    }
  }
}

Tools

Tool

Description

Read-only mode

query

Execute SELECT, SHOW, DESCRIBE, EXPLAIN

Allowed

execute

Execute INSERT, UPDATE, DELETE, DDL

Blocked

list_databases

List all databases

Allowed

list_tables

List tables in a database

Allowed

describe_table

Show table schema

Allowed

describe_all_tables

Show all table schemas at once

Allowed

Configuration

Environment variables

Variable

Required

Default

Description

MYSQL_HOST

Yes

MySQL host

MYSQL_USER

Yes

MySQL user

MYSQL_PASSWORD

Yes

MySQL password

MYSQL_PORT

No

3306

MySQL port

MYSQL_DATABASE

No

Default database

MYSQL_READONLY

No

false

Read-only mode

MYSQL_MAX_ROWS

No

100

Auto LIMIT for SELECT queries

MYSQL_QUERY_TIMEOUT

No

30000

Query timeout in ms (0 to disable)

MYSQL_SSL

No

false

Enable SSL connection

Connection string

mysql://user:password@host:port/database

Passed as the first CLI argument. Takes priority over environment variables.

License

MIT

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ImRieul/mysql-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server