MySQL Database

MySQL Database

burakdirin

Connects AI models to MySQL databases for running queries and managing database operations. Uses environment variables or connection strings for database authentication.

Enables direct SQL query execution and database connections to MySQL databases through a simple interface that returns results in JSON format.

81,148 views5Local (stdio)

What it does

  • Execute SELECT queries on MySQL databases
  • Run INSERT, UPDATE, DELETE operations
  • Manage database connections
  • Query database schema and table structure

Best for

Database administrators analyzing MySQL dataDevelopers building database-driven applicationsData analysts querying MySQL databases
Supports connection strings or environment variablesOne-command installation via npx

About MySQL Database

MySQL Database is a community-built MCP server published by burakdirin that provides AI assistants with tools and capabilities via the Model Context Protocol. Connect to MySQL databases, execute SQL queries, and get JSON results easily with our simple interface—ideal for MySQL a It is categorized under databases.

How to install

You can install MySQL Database in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

MySQL Database is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

mysqldb-mcp-server MCP server

smithery badge

A MySQL database MCP server project.

Installation

You can install the package using uv:

uv pip install mysqldb-mcp-server

Or using pip:

pip install mysqldb-mcp-server

Components

Tools

The server provides two tools:

  • connect_database: Connects to a specific MySQL database

    • database parameter: Name of the database to connect to (string)
    • Returns a confirmation message when connection is successful
  • execute_query: Executes MySQL queries

    • query parameter: SQL query/queries to execute (string)
    • Returns query results in JSON format
    • Multiple queries can be sent separated by semicolons

Configuration

The server uses the following environment variables:

  • MYSQL_HOST: MySQL server address (default: "localhost")
  • MYSQL_USER: MySQL username (default: "root")
  • MYSQL_PASSWORD: MySQL password (default: "")
  • MYSQL_DATABASE: Initial database (optional)
  • MYSQL_READONLY: Read-only mode (set to 1/true to enable, default: false)

Quickstart

Installation

Claude Desktop

MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows: %APPDATA%/Claude/claude_desktop_config.json

Development/Unpublished Server Configuration
{
  "mcpServers": {
    "mysqldb-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/burakdirin/Projects/mysqldb-mcp-server",
        "run",
        "mysqldb-mcp-server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "password",
        "MYSQL_DATABASE": "[optional]",
        "MYSQL_READONLY": "true"
      }
    }
  }
}
Published Server Configuration
{
  "mcpServers": {
    "mysqldb-mcp-server": {
      "command": "uvx",
      "args": [
        "mysqldb-mcp-server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "root",
        "MYSQL_PASSWORD": "password",
        "MYSQL_DATABASE": "[optional]",
        "MYSQL_READONLY": "true"
      }
    }
  }
}

Installing via Smithery

To install MySQL Database Integration Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @burakdirin/mysqldb-mcp-server --client claude

Development

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory /Users/burakdirin/Projects/mysqldb-mcp-server run mysqldb-mcp-server

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

Alternatives

Related Skills

Browse all skills
whodb

Database operations including querying, schema exploration, and data analysis. Activates for tasks involving PostgreSQL, MySQL, MariaDB, SQLite, MongoDB, Redis, Elasticsearch, or ClickHouse databases.

1
azure-resource-manager-mysql-dotnet

Azure MySQL Flexible Server SDK for .NET. Database management for MySQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "MySQL", "MySqlFlexibleServer", "MySQL Flexible Server", "Azure Database for MySQL", "MySQL database management", "MySQL firewall", "MySQL backup".

1
railway-templates

Search and deploy services from Railway's template marketplace. Use when user wants to add a service from a template, find templates for a specific use case, or deploy tools like Ghost, Strapi, n8n, Minio, Uptime Kuma, etc. For databases (Postgres, Redis, MySQL, MongoDB), prefer the railway-database skill.

1
sql-optimization

SQL query optimization patterns including EXPLAIN plan analysis, index strategies, query rewriting, and N+1 query prevention. Use when optimizing slow database queries, analyzing query performance, designing indexes, or debugging database bottlenecks. Works with PostgreSQL, MySQL, SQLite, and other SQL databases. Typical improvements: 10x-1000x query speedup.

0
archiving-databases

This skill automates database archival processes. It helps reduce primary database size by moving historical records to archive tables or cold storage solutions like S3, Azure Blob, or GCS. The plugin supports PostgreSQL and MySQL, implementing automated retention policies, compression, compliance tracking, and zero-downtime migration. Use this when the user mentions "database archival", "archive old database records", "retention policies", "cold storage", or "reduce database size." It is particularly useful for handling requests related to data lifecycle management and compliance requirements in database systems.

0
literature-review

Conduct comprehensive, systematic literature reviews using multiple academic databases (PubMed, arXiv, bioRxiv, Semantic Scholar, etc.). This skill should be used when conducting systematic literature reviews, meta-analyses, research synthesis, or comprehensive literature searches across biomedical, scientific, and technical domains. Creates professionally formatted markdown documents and PDFs with verified citations in multiple citation styles (APA, Nature, Vancouver, etc.).

377