Mcp Mysql Connector

io.github.daedalusPublished by GitHub account daedalusv0.1.1Updated Oct 25, 2026

MCP server exposing MySQL database functionalities as tools

VerifiedSTDIODesktop onlyDatabasesDeveloper Tools

Overview

AI-generated overview

A local MCP server that gives an AI assistant tools to connect to MySQL and run queries, manage databases, tables, indexes and users.

What you can do
Connect, disconnect, check connection status and commit or roll back transactions against a MySQL server. Run raw SQL queries and read results. List, create, drop and check databases and tables, and inspect schemas. Show, create and drop columns and indexes. Create and drop MySQL users, grant and revoke privileges, and show privileges. Read server status and database or table metadata as resources.
When to use it
Useful when an assistant should work directly with a MySQL instance: exploring schemas, running ad-hoc queries, or setting up databases, tables and users during development or administration.
Requirements
Runs locally as a Python package (Python 3.11+). Needs a reachable MySQL server and credentials, supplied either through the connect tool or the MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE environment variables. Desktop-only; no web execution.
Before you install
The assistant can run arbitrary SQL and create or drop databases, tables, indexes and users, and change privileges, so destructive actions are possible. Database credentials are passed to the server and may sit in environment variables. Grant a least-privilege MySQL account rather than root.

Installation

In SourceWeft

  1. Open Mcp Mysql Connector in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

mcp-mysql-connector

MCP server exposing MySQL database functionalities as tools for LLM agents.

mcp-name: io.github.daedalus/mcp-mysql-connector

[PyPI] [Python] [Coverage] [Ruff]

Overview

mcp-mysql-connector is a Model Context Protocol (MCP) server that provides MySQL database operations as tools for LLM agents. It allows AI assistants to interact with MySQL databases through a standardized protocol, enabling:

  • Database and table management
  • Query execution
  • User authentication and privilege management
  • Schema introspection
  • Transaction control

Install

bash
pip install mcp-mysql-connector

Quick Start

Running the Server

bash
# Run with stdio transport (default)mcp-mysql-connector
# Or run programmaticallypython -c "from mcp_mysql import mcp; mcp.run()"

Configuration

Connect to MySQL using the connect tool:

json
{  "host": "localhost",  "port": 3306,  "user": "root",  "password": "your_password",  "database": "your_database"}

MCP Tools

Connection Management

ToolDescription
connectConnect to a MySQL database
disconnectDisconnect from MySQL
is_connectedCheck connection status
commitCommit current transaction
rollbackRollback current transaction

Query Execution

ToolDescription
execute_queryExecute raw SQL query and return results

Database Operations

ToolDescription
list_databasesList all databases on server
create_databaseCreate a new database
drop_databaseDrop a database
database_existsCheck if database exists

Table Operations

ToolDescription
list_tablesList tables in a database
describe_tableGet table schema
create_tableCreate a new table
drop_tableDrop a table
table_existsCheck if table exists

Column & Index Operations

ToolDescription
show_columnsShow column details
show_indexesShow index details
create_indexCreate an index
drop_indexDrop an index

User Management

ToolDescription
create_userCreate a MySQL user
drop_userDrop a MySQL user
grant_privilegesGrant privileges to user
revoke_privilegesRevoke privileges from user
show_privilegesShow user privileges

Server Information

ToolDescription
server_statusGet MySQL server status

MCP Resources

The server provides dynamic resources for database and table metadata:

  • database://{name} - Database metadata including table list
  • table://{db}/{table} - Table metadata including schema, columns, and indexes

Usage Examples

Connect and Query

# First, connect to databaseconnect(host="localhost", user="root", password="secret", database="mydb")
# Execute a queryexecute_query(sql="SELECT * FROM users WHERE active = true")
# List all tableslist_tables(database="mydb")

Create Database and Table

# Create a databasecreate_database(name="newapp")
# Create a tablecreate_table(name="users", schema="id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), email VARCHAR(255) UNIQUE")

User Management

# Create a new user with passwordcreate_user(username="app_user", host="localhost", password="secure_password")
# Grant privilegesgrant_privileges(privileges="SELECT,INSERT,UPDATE,DELETE", on="newapp.*", username="app_user", host="localhost")

Transaction Control

# Start transactionexecute_query(sql="BEGIN")
# Execute operationsexecute_query(sql="INSERT INTO accounts (balance) VALUES (100)")
# Commit or rollbackcommit()  # or rollback()

Environment Variables

The server supports configuration via environment variables:

bash
export MYSQL_HOST=localhostexport MYSQL_PORT=3306export MYSQL_USER=rootexport MYSQL_PASSWORD=secretexport MYSQL_DATABASE=mydb

Development

bash
# Clone repositorygit clone https://github.com/daedalus/mcp-mysql-connector.gitcd mcp-mysql-connector
# Create virtual environmentpython -m venv venvsource venv/bin/activate
# Install dependenciespip install -e ".[test]"
# Run testspytest
# Format coderuff format src/ tests/
# Lintruff check src/ tests/
# Type checkmypy src/

Architecture

mcp-mysql-connector/├── src/mcp_mysql/│   ├── core/models.py       # Data models (QueryResult, TableSchema, etc.)│   ├── adapters/mysql.py    # MySQL connection & pooling│   ├── services/connection.py  # Connection manager│   ├── tools/mysql_tools.py   # MCP tool implementations│   └── mcp.py              # FastMCP server setup└── tests/                   # Test suite

Requirements

  • Python 3.11+
  • fastmcp >= 2.0.0
  • pymysql >= 1.1.0
  • sqlparse >= 0.4.0

License

MIT License - see LICENSE for details.

Source: README.md at commit b397ef6

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts