logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mysql-data-access-gateway

Facilitates secure connectivity and operational execution against MySQL databases leveraging the Model Context Protocol (MCP) for streamlined, standardized data plane operations.

Author

mysql-data-access-gateway logo

aqaranewbiz

No License

Quick Info

GitHub GitHub Stars 0
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

mysqlapisapiaqaranewbiz mysqlmysql aqaranewbizseamless database

MySQL Interaction Service via MCP

smithery badge This service functions as a server interface, utilizing Smithery's Model Context Protocol (MCP) to manage interactions with a MySQL backend system.

Deployment

Automated Installation (Smithery)

Install the MySQL service automatically for your Claude Desktop environment using Smithery CLI:

bash npx -y @smithery/cli install @aqaranewbiz/mysql-aqaranewbiz --client claude

Direct Execution

Initiate the server process directly: bash npx @aqaranewbiz/mysql-aqaranewbiz

Configuration Directives

The underlying server mandates the configuration of several key environment parameters within your MCP settings profile:

{ "mcpServers": { "mysql": { "command": "npx", "args": ["-y", "@aqaranewbiz/mysql-aqaranewbiz"], "env": { "MYSQL_HOST": "your_host_address", "MYSQL_USER": "db_credential_user", "MYSQL_PASSWORD": "secret_access_key", "MYSQL_DATABASE": "target_schema_name" } } } }

Available Toolset

1. establish_connection

Establishes the initial session link to the MySQL instance using the configured or supplied credentials.

javascript use_mcp_tool({ server_name: "mysql", tool_name: "connect_db", arguments: { host: "remote_host", user: "access_user", password: "secure_pass", database: "production_db" } });

2. fetch_data

Processes read-only SQL statements (like SELECT), supporting parameter substitution for security and flexibility.

javascript use_mcp_tool({ server_name: "mysql", tool_name: "query", arguments: { sql: "SELECT username, email FROM users WHERE status = ?", params: ["active"] } });

3. write_data

Executes data manipulation language (DML) commands such as INSERT, UPDATE, or DELETE, also supporting parameterized queries.

javascript use_mcp_tool({ server_name: "mysql", tool_name: "execute", arguments: { sql: "UPDATE inventory SET stock = stock - ? WHERE item_id = ?", params: [1, 404] } });

4. retrieve_schema_list

Returns an enumeration of all accessible relational structures (tables) within the active database context.

javascript use_mcp_tool({ server_name: "mysql", tool_name: "list_tables", arguments: {} });

5. inspect_structure

Retrieves the definitive structural blueprint (schema definition) for a designated database object.

javascript use_mcp_tool({ server_name: "mysql", tool_name: "describe_table", arguments: { table: "customers_archive" } });

Key Capabilities

  • Secure handshake and transactional execution on MySQL instances.
  • Provision of a uniform communication interface via the MCP standard.
  • Built upon a FastAPI foundation, exposing RESTful interaction points.
  • Configuration managed exclusively through environment variable mapping.

Initial Setup Guide

Prerequisites

  • Operational Python environment (version 3.11 or newer).
  • Accessible MySQL Database Instance.
  • Docker (Optional, for containerized deployment).

Environment Variable Definition

  1. Create and populate an .env configuration file: env MYSQL_HOST=your_mysql_host_ip MYSQL_USER=your_db_username MYSQL_PASSWORD=your_secure_password MYSQL_DATABASE=the_main_database

Installation Procedures

  1. Set up and activate a isolated Python workspace: bash

Windows OS

python -m venv env_mysql .\env_mysql\Scripts\activate

Unix-like OS (macOS/Linux)

python3 -m venv env_mysql source env_mysql/bin/activate

  1. Install necessary Python dependencies: bash pip install -r requirements.txt

  2. Launch the service engine: bash python mcp_server.py

Containerized Deployment via Docker

  1. Build the service image from the source context: bash docker build -t mysql-mcp-service .

  2. Run the service, injecting necessary environment parameters: bash docker run -e MYSQL_HOST=host_ip -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db mysql-mcp-service

Local Development Configuration

  1. Configure development dependencies: bash

Install tools for quality assurance if necessary

pip install -r requirements-dev.txt

Install code formatting and linting utilities

pip install black flake8

  1. Execute in debug mode: bash

Run with development flags enabled

python mcp_server.py --dev

  1. Execute automated tests: bash

Run the test suite

python -m pytest tests/

Interaction Endpoints

System Health Check

GET /status

Returns the operational status of the server and the catalog of integrated tools.

Remote Query Submission

POST /execute

Submits a MySQL directive for execution, returning the resulting dataset or operation status.

Development Workflow Guide

Project Directory Layout

/Data-Access-MCP-Server/ ├── mcp_server.py # Core server application logic ├── requirements.txt # Primary dependency manifest ├── Dockerfile # Containerization blueprint ├── .env # Environment parameter template └── tests/ # Unit and integration test suite

Feature Addition Protocol

  1. Implement the new tool function within mcp_server.py.
  2. Update requirements.txt to include any novel dependencies.
  3. Develop comprehensive test cases for the new functionality.
  4. Rebuild the Docker image if containerization is utilized.

Troubleshooting Common Failures

Connection Issues

  1. Verify that the target MySQL instance is actively running.
  2. Double-check the correctness and scope of all configured environment variables.
  3. For local installations, confirm the necessary MySQL client connector libraries are present.

Query Execution Errors

  1. Scrutinize the SQL syntax for correctness.
  2. Validate that the execution user possesses the requisite database permissions.
  3. Check for known version incompatibilities with the MySQL connector library.

Diagnostic Logging

The server defaults to writing operational logs to standard output. To adjust verbosity during local operation: bash python mcp_server.py --log-level DEBUG

For containerized instances, view output via: bash docker logs [container_identifier]

Contribution Guidelines

  1. Report any identified issues via the Issues tracker.
  2. Create a dedicated feature branch (e.g., git checkout -b enhancement/NewTool)
  3. Commit changes clearly (git commit -m 'Feat: Implemented NewTool functionality')
  4. Push the branch to the remote repository (git push origin enhancement/NewTool)
  5. Submit a formal Pull Request for review.

Licensing Terms

This software is distributed under the permissive MIT License. Consult the LICENSE file for the full declaration.

Support Contact

Please utilize the Issue Tracker for all inquiries and support requests.

WIKIPEDIA: HTTP Request methods define the nature of the action to be performed on the identified resource. The most common HTTP methods are GET, POST, PUT, and DELETE. These methods correspond closely to operations in document-based databases and traditional web services.

== Evolution of Request Types == The initial HTTP specification defined only a few methods, primarily for fetching documents. As the web evolved into a platform for building dynamic applications, the need to manipulate data directly led to the introduction of methods for creation and modification.

=== Idempotency === A key concept in HTTP method design is idempotency. A request method is idempotent if making the identical request multiple times produces the same result on the server as making it once. GET, PUT, and DELETE are generally idempotent, whereas POST is not.

== Method Semantics in Practice ==

  • GET: Retrieves a representation of the specified resource. Should never be used for operations that change state.
  • POST: Submits an entity to the specified resource, often causing a change in state or side effects on the server (e.g., creating a new entry).
  • PUT: Replaces all current representations of the target resource with the request payload. If the target does not exist, PUT may create it.
  • DELETE: Removes the specified resource.
  • HEAD: Identical to GET, but the server must not return a message body. Useful for retrieving metadata.
  • OPTIONS: Describes the communication options available for the target resource.
  • PATCH: Applies partial modifications to a resource.

See Also

`