MySQL Query Server logo

MySQL Query Server

by mangooer

This is a MySQL query server based on the MCP framework, providing MySQL database operation functions through SSE (Server-Sent Events). It offers real-time data transmission and a secure way to query and manage your MySQL databases.

View on GitHub

Last updated: N/A

What is MySQL Query Server?

The MySQL Query Server is a server built using the FastMCP framework that allows you to perform MySQL database operations via Server-Sent Events (SSE). It provides a secure and efficient way to query and manage your MySQL databases with features like real-time data streaming, SQL injection protection, and automatic transaction management.

How to use MySQL Query Server?

  1. Clone the project, 2. Install dependencies using pip install -r requirements.txt, 3. Configure environment variables in the .env file (copy from .env.example), 4. Run the server using python src/server.py. The server will be accessible at the configured address and port (default: http://127.0.0.1:3000/sse).

Key features of MySQL Query Server

  • Real-time data transmission via SSE

  • SQL injection protection

  • Automatic transaction management

  • Comprehensive logging system

  • Environment variable configuration

  • SQL security checks with risk level control

  • Sensitive information protection

  • Formatted and enhanced metadata query results

Use cases of MySQL Query Server

  • Real-time monitoring of database changes

  • Building dashboards with live data updates

  • Creating interactive database exploration tools

  • Implementing secure database access for applications

FAQ from MySQL Query Server

DELETE operation not executing successfully?

Check if the DELETE operation includes a WHERE clause. Unconditional DELETE operations are marked as CRITICAL risk level. Ensure ALLOWED_RISK_LEVELS includes CRITICAL if needed. Check the affected rows count to confirm the operation's impact.

Environment variables not taking effect?

Ensure load_dotenv() is called before importing other modules in server.py. Restart the application to ensure variables are loaded correctly. Check the logs for the risk level setting output.

Operation rejected by security mechanism?

Check if the operation's risk level is within the allowed range. Adjust ALLOWED_RISK_LEVELS accordingly for high-risk operations. For UPDATE/DELETE without WHERE, add a condition (even WHERE 1=1) to lower the risk level.

Cannot view sensitive information?

In development, set ALLOW_SENSITIVE_INFO=true. In production, sensitive information is hidden by default for security.

How to contribute to the project?

You are welcome to submit Issues and Pull Requests to improve the project.