MySQL-Server

MySQL-Server

A simple Python MCP server for interactive MySQL access via stdio.

1
Stars
0
Forks
0
Releases

Overview

mcp-mysql-server is a Python-based MCP server that provides a command-line interface for interacting with a local MySQL database via standard input/output (stdio), built on the FastMCP framework. It is designed for ease of use in local development environments where scripting and automation are common. The server reads connection parameters from a configuration file (host, port, user, password, database) and supports docker deployment using a dedicated config.docker.ini. The tooling exposes commands such as test_connection, list_tables, read_table, write_table, get_table_schema, and execute_sql, enabling connectivity tests, table discovery, data retrieval, data insertion, and custom SQL execution. The project emphasizes secure, configurable access controls and is extendable: developers can add new MCP tools by defining a Python function decorated with @mcp.tool(). Prerequisites include Python 3.x, a locally running MySQL server, and dependencies listed in requirements.txt. The repository also provides unit tests that mock database connections. Typical usage is python mcp-mysql-server.py --config config.ini, with Docker Compose support via config.docker.ini and docker-compose files to spin up MySQL and the MCP server.

Details

Owner
tonycai
Language
Python
License
MIT License
Updated
2025-12-07

Features

Query Execution

Execute SQL SELECT statements and view results in a simple, readable format.

Data Manipulation

Insert data into tables using the write_table tool.

Schema Inspection

Retrieve database schema information, including listing tables (list_tables) and table schemas (get_table_schema).

Connection Testing

Test database connectivity and retrieve server information.

Configurable Access Controls

Define connection parameters (host, user, password, database) via configuration for secure access.

stdio Interface

Interact with the script using standard input and receive output on standard output.

Local Deployment Focus

Optimized for use within local development environments.

Audience

DevelopersInteract with a local MySQL database via MCP commands in a lightweight stdio tool.
DBAsTest connectivity, inspect schemas, and perform basic data operations in development environments.

Tags

MySQLDatabaseSQLstdioCLIPythonMCPDockerschema