MySQL MCP Server v2
@w2pwinlinux
mcp-server-presupuesto-mysql1
Overview
What is MySQL MCP Server v2?
MySQL MCP Server v2 is a Model Context Protocol server that provides an interface to manage and query departmental budget information stored in a MySQL database. It is designed for users who need to securely connect to a MySQL database and perform operations like querying department statuses, registering budget requests, and searching departments by name.
How to use MySQL MCP Server v2?
Install the required Python packages (mcp and mysql-connector-python), edit the db_config dictionary in the Python file to match your MySQL server settings, then start the server by running python mysql_mcp_server_v2.py. You can invoke the available functions (get_estado_completo, registrar_solicitud, buscar_por_nombre) through the MCP protocol.
Key features of MySQL MCP Server v2
- Secure connection to a MySQL database via context manager.
- Query complete department status by department code.
- Register budget requests and update balances with transactions.
- Search departments by name using partial matching (LIKE).
- Robust error handling with connection, query, and transaction rollback.
- Automatic rollback of transactions on errors.
Use cases of MySQL MCP Server v2
- Retrieve the full budget status (initial budget, requested amount, available balance, paid amount) for a specific department.
- Register a new budget request for a department and automatically recalculate the available balance.
- Search for departments by a partial name and get their full budget information.
FAQ from MySQL MCP Server v2
What Python version and dependencies are required?
Python 3.6 or higher is required, along with the mcp and mysql-connector-python packages.
How do I configure the database connection?
Edit the db_config dictionary in the server file (mysql_mcp_server_v2.py) to set the correct MySQL host, port, user, password, and database name.
What database schema is expected?
The server expects a departamentos table containing fields codigo, nombre, inicial, solicitado, saldo, and pagado.
How does the server handle errors?
It implements robust error handling for database connection failures, query errors, and data validation. Transactions are automatically rolled back if an error occurs.
Are there any security considerations for production use?
The default configuration has hardcoded database credentials; for production, you should use environment variables or a secure configuration file.