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-accessor-tool

Facilitates secure, read-only interaction with relational MySQL data stores. This capability allows agents to issue structured query language (SQL) commands and examine database structures, thereby supporting sophisticated data retrieval for application intelligence.

Author

mysql-data-accessor-tool logo

shreyansh-ghl

No License

Quick Info

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

Tags

databasesmysqldatabaseghl mysqlmysql mcpaccess mysql

SQL Data Access Proxy for MySQL (MCP Server)

A Model Context Protocol (MCP) endpoint engineered to grant read-only access to MySQL databases. This utility empowers Large Language Models (LLMs) to introspect database schemas and execute non-mutating SQL operations.

Credential Configuration

Authentication is managed entirely through the provided database connection string (URL):

mysql://:@:/

Example Connection String:

  • Instance: mysql://agent_user:secret_key@db.internal.net:3306/prod_analytics

Security Warning: Exercise extreme caution to safeguard credentials; avoid hardcoding secrets in publicly accessible scripts or configuration files.

Functionality

Available Operations (Tools)

  • execute_readonly_query
  • Purpose: Runs specified SQL queries against the linked database.
  • Parameter: sql (string): The precise SQL statement to be executed.
  • Constraint: Every invocation is strictly wrapped within a read-only transaction boundary.
  • Auth: Credentials provided in the connection string are utilized implicitly.

Data Structures (Resources)

The service automatically maps and exposes structural metadata for every accessible table:

  • Table Metadata Endpoint (mysql://<host>/<table>/metadata)
  • Output: Returns comprehensive JSON describing the schema for the specified table.
  • Contents: Details include column identifiers and their respective data types.
  • Discovery: Schema information is dynamically sourced from the database's internal catalog.
  • Security: Access requires valid credentials.

Deployment Guide

  1. Obtain the source code repository:

sh git clone https://github.com/yourusername/mysql-mcp-server.git cd mysql-mcp-server

  1. Resolve and install required packages:

sh npm run prepare npm install

  1. Globally register the binary for system-wide invocation:

sh npm link

Launch the server instance, pointing it to your database URI:

sh mysql-mcp-server mysql://user:password@localhost:3306/mydb

Integration with Cursor IDE

Setting Up the Data Source in Cursor Settings

  1. Access Cursor application settings (Gear icon ⚙️ in the lower-left or shortcut Shift + Cmd + J on Mac).

  2. Navigate to the 'MCP' section within the settings panel.

  3. Select 'Add Global MCP Server' and input the following JSON structure:

{ "mcpServers": { "mysql_ro": { "command": "mysql-mcp-server", "args": ["mysql://user:password@localhost:3306/mydb"] } } }

  1. Finalize by saving the configuration (Cmd + S) and initiating a restart of the Cursor application.

Operational Usage in Cursor

Engage the Agentic Chat interface within Cursor and formulate natural language questions pertaining to your data. The connected MySQL accessor will provide the necessary contextual database information to formulate the answer. Database query context visualization

Security Best Practices Summary

  1. Credential Isolation: Inject sensitive tokens via environment variables rather than direct arguments:

{ "mcpServers": { "mysql": { "command": "mysql-mcp-server", "args": ["mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@host:3306/mydb"] } } }

  1. Principle of Least Privilege: Restrict the associated MySQL account strictly to read-only operational rights.
  2. Utilize robust, complex passwords.
  3. Never commit configuration files containing plaintext credentials to source control repositories.

Licensing Information

This server software is distributed under the permissive MIT License. Refer to the accompanying LICENSE file within the project directory for full permissions and usage stipulations.

See Also

`