Skip to main content
Glama

MySQL MCP Server

MySQL MCP Server

A Model Context Protocol server that provides read-only access to MySQL databases.

Features

Tools

  • query - Execute read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN)

    • All queries run within READ ONLY transactions

Resources

  • Table schemas - Automatic discovery of tables and columns with their types, keys, and constraints

Installation

Docker

docker build -t mcp/mysql . docker run -i --rm mcp/mysql mysql://user:password@host:3306/database

NPM

npm install -g @modelcontextprotocol/server-mysql mcp-server-mysql mysql://user:password@localhost:3306/database

NPX

npx -y @modelcontextprotocol/server-mysql mysql://user:password@localhost:3306/database

Usage with Claude Desktop

Add to claude_desktop_config.json:

Using Docker

{ "mcpServers": { "mysql": { "command": "docker", "args": [ "run", "-i", "--rm", "mcp/mysql", "mysql://root:password@host.docker.internal:3306/database" ] } } }

Using NPX

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

Note: When using Docker to connect to a MySQL server on your host machine, use host.docker.internal instead of localhost.

Connection String Format

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

Development

npm install npm run build node dist/index.js mysql://user:password@localhost:3306/database

License

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Enables read-only access to MySQL databases through natural language queries. Provides automatic table schema discovery and executes SELECT, SHOW, DESCRIBE, and EXPLAIN statements within secure read-only transactions.

  1. Features
    1. Tools
    2. Resources
  2. Installation
    1. Docker
    2. NPM
    3. NPX
  3. Usage with Claude Desktop
    1. Using Docker
    2. Using NPX
  4. Connection String Format
    1. Development
      1. License

        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/guido-marinho/mysql-mcp-server'

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