semvec/pypi-packages huggingface dataset:
shubh-mcp-mysql-server 0.1.1
MySQL server implementation for MCP (Model Control Protocol) framework
Requires Python: >=3.8

# MySQL MCP Server

A MySQL server implementation for the MCP (Model Control Protocol) framework. This server allows you to interact with MySQL databases through the MCP protocol, enabling SQL execution, table/resource listing, and schema retrieval.

## Features

- Execute SQL queries
- List MySQL tables as resources
- Get table schemas
- Configurable through environment variables
- Supports various MySQL character sets and collations

## Installation

Install from PyPI:

```bash
pip install shubh-mcp-mysql-server
```

Or install from source:

```bash
git clone <your repo url>
cd sql_server
pip install .
```

## Configuration

Set the following environment variables (required for connection):

- `MYSQL_HOST`: MySQL server host (default: "localhost")
- `MYSQL_PORT`: MySQL server port (default: 3306)
- `MYSQL_USER`: MySQL username (**required**)
- `MYSQL_PASSWORD`: MySQL password (**required**)
- `MYSQL_DATABASE`: MySQL database name (**required**)
- `MYSQL_CHARSET`: MySQL character set (default: "utf8mb4")
- `MYSQL_COLLATION`: MySQL collation (default: "utf8mb4_unicode_ci")
- `MYSQL_SQL_MODE`: MySQL SQL mode (default: "TRADITIONAL")

Example:

```bash
export MYSQL_USER="your_user"
export MYSQL_PASSWORD="your_password"
export MYSQL_DATABASE="your_database"
```

## Usage

### Run the server

After setting environment variables, start the server:

```bash
shubh-mcp-mysql-server
```

### MCP/Claude/Cursor Integration

Add this to your MCP configuration (e.g., `~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "mysql-server": {
      "command": "shubh-mcp-mysql-server",
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_USER": "your_user",
        "MYSQL_PASSWORD": "your_password",
        "MYSQL_DATABASE": "your_database"
      }
    }
  }
}
```

## Available Tools

### execute_sql

Execute an SQL query on the MySQL server.

Example:
```sql
SELECT * FROM users LIMIT 10;
```

## Available Resources

- `mysql://tables` — List all tables in the database.
- `mysql://table/{table_name}` — Get the schema of a specific table. Example: `mysql://table/users`

## Development

To run the server in development mode (with hot reload, etc.):

```bash
mcp dev mysql_server_launcher.py
```

This will start the MCP Inspector interface where you can test the tools and resources interactively.

## License

MIT License