MySQL MCP Server for Smithery (Python)

by aqaranewbiz

206 downloads
Not rated
GitHub

Description

# MySQL MCP Server for Smithery (Python) A MySQL connector for Smithery that allows you to connect to your MySQL database directly from Smithery, built with Python. ## Features - **Connect to MySQL Databases**: Configure and connect to MySQL databases - **List Databases**: View…

About

# MySQL MCP Server for Smithery (Python) A MySQL connector for Smithery that allows you to connect to your MySQL database directly from Smithery, built with Python. ## Features - **Connect to MySQL Databases**: Configure and connect to MySQL databases - **List Databases**: View all accessible databases - **List…

Details

Author
aqaranewbiz
Downloads
206
Categories
Database

- Connect to MySQL databases with configurable credentials
- List all accessible databases
- View all tables in a database
- Get detailed schema information for tables
- Execute read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN)
- Built‑in query validation blocks write operations

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MySQL MCP Server for Smithery (Python)
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Add the server in Smithery, then enter your MySQL credentials (host, port, user, password, optional database). Alternatively, clone the repository, install dependencies (npm install, pip install -r requirements.txt), and start with node run.js or python mcp_server.py.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mysql mcp server for smithery (python)": {
            "mcp-mysql-server-aqaranewbiz": {
                "command": "node",
                "args": [
                    "run.js"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-mysql-server-aqaranewbiz": {
        "command": "node",
        "args": [
            "run.js"
        ]
    }
}

MySQL MCP Server for Smithery (Python)

A MySQL connector for Smithery that allows you to connect to your MySQL database directly from Smithery, built with Python.

Features

- Connect to MySQL Databases: Configure and connect to MySQL databases
- List Databases: View all accessible databases
- List Tables: View all tables in a specified database
- Describe Tables: Get detailed schema information for tables
- Execute Queries: Run read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN)
- Security: Built-in query validation ensures only read-only operations are allowed

Installation in Smithery

After adding the MCP server in Smithery, you'll be able to enter your MySQL database credentials:

- Host: Database server hostname (default: localhost)
- Port: Database server port (default: 3306)
- User: Your MySQL username
- Password: Your MySQL password
- Database: (Optional) The specific database to connect to

Manual Installation

1. Clone this repository:

git clone https://github.com/aqaralife/mysql-mcp-python-server.git

2. Install dependencies:

cd mysql-mcp-python-server
npm install
pip install -r requirements.txt

3. Make the scripts executable (Unix/Linux/Mac):

chmod +x mcp_server.py run.js

Manual Usage

To start the server:

node run.js

Or, directly run the Python script:

python mcp_server.py

Available Tools

connect_db

Establishes a connection to a MySQL database.

Parameters:
- host: Database server hostname
- port: Database server port
- user: Database username
- password: Database password
- database: (Optional) Database name

list_databases

Lists all accessible databases.

Parameters: None

list_tables

Lists all tables in a database.

Parameters:
- database: (Optional) Database name, uses default if connected

describe_table

Shows the schema for a table.

Parameters:
- table: Table name
- database: (Optional) Database name, uses default if connected

execute_query

Executes a read-only SQL query.

Parameters:
- query: SQL query (only SELECT, SHOW, DESCRIBE, and EXPLAIN allowed)
- database: (Optional) Database name, uses default if connected

Security

The server includes built-in validation to ensure only read-only operations are permitted:

- Only SELECT, SHOW, DESCRIBE, and EXPLAIN queries are allowed
- Queries containing SQL commands like INSERT, UPDATE, DELETE, DROP, etc. are automatically rejected
- Multiple statements in a single query (separated by semicolons) are not allowed

Troubleshooting

If you encounter issues:

1. Python Not Found: The server will automatically detect python3 or python. If neither works, ensure Python is installed and in your PATH.

2. Missing Modules: The server will attempt to install required packages automatically. If this fails, manually run:

   pip install mysql-connector-python>=8.0.0

3. Connection Issues: Verify your database credentials and ensure the MySQL server is running and accessible.

4. Smithery Connection Issues: Make sure the settings in Smithery are correctly configured with your database credentials.

5. Server Unresponsive: Check the log output in Smithery's console for errors.

License

MIT

Contact

If you have any questions, please create an issue.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.