# mcp-mysql-server

> MCP Server

This repository provides a Model Context Protocol (MCP) server enabling AI models to interact with MySQL databases through a standardized interface for executing queries and managing data. This repository provides

## Overview

- **Category:** Database
- **Language:** JavaScript
- **Stars:** 168
- **Forks:** 10
- **Owner:** f4ww4z
- **GitHub:** https://github.com/f4ww4z/mcp-mysql-server
- **Created:** 2024-12-13T09:39:28+00:00
- **Updated:** 2025-03-28T14:08:49+00:00
- **Source:** https://model-context-protocol.com/servers/mcp-mysql-server-ai-model-interface

## Setup

## Setup

### Installing via Smithery
To install MySQL Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@f4ww4z/mcp-mysql-server):

```bash
npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claude
```

### Manual Installation
```bash
npx @f4ww4z/mcp-mysql-server
```

The server requires the following environment variables to be set in your MCP settings configuration file:

```json
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@f4ww4z/mcp-mysql-server"],
      "env": {
        "MYSQL_HOST": "your_host",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}
```

## Tools

## Available Tools

1. connect_db (Establish connection to MySQL database using provided credentials.)
2. query (Execute SELECT queries with optional prepared statement parameters.)
3. execute (Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.)
4. list_tables (List all tables in the connected database.)
5. describe_table (Get the structure of a specific table.)
