gotrasoft-mysql
v1.0.4
Published
A comprehensive Model Context Protocol (MCP) server for MySQL and MariaDB. Enables AI assistants to safely inspect database schemas, execute read-only queries, and analyze table statistics with built-in security protections.
Maintainers
Readme
🐬 Gotrasoft MySQL MCP Server
Unlock the power of your database for AI.
safe, read-only inspection for MySQL & MariaDB.
Connect your AI assistants (Claude, Cursor, GitHub Copilot) to your MySQL data safely. gotrasoft-mysql provides a read-only bridge, allowing LLMs to understand your schema, answer data questions, and generate insights without the risk of accidental modification.
✨ Features
- 🔒 Safe by Design: Strict read-only policy for
execute_query. Destructive commands likeDROP,DELETE, andINSERTare blocked at the application level. - 👁️ Deep Inspection: Tools to
list_tablesanddescribe_tableschemas efficiently. - 📊 Smart Statistics: Get row counts and storage estimates with
get_table_stats. - ⚡ Dynamic Queries: Let the AI write and run SELECT queries to find exactly what you need.
- 🛠️ Setup Tools: Includes
create_databaseto help you spin up new environments quickly (the only write operation allowed, for setup convenience).
🚀 Quick Start
No installation needed! specific usage via npx is recommended to ensure you're always using the latest version.
npx gotrasoft-mysql📦 Installation
Option 1: Run via npx (Recommended)
Add this directly to your MCP client configuration (see below). This keeps your system clean and updates automatic.
Option 2: Global Install
If you prefer a local binary:
npm install -g gotrasoft-mysql
# Run it
gotrasoft-mysqlOption 3: From Source
Perfect for contributors or custom modifications.
git clone https://github.com/yourusername/gotrasoft-mysql.git
cd gotrasoft-mysql
npm install
npm run build⚙️ Configuration
The server is configured via Environment Variables. You can set these in your MCP client configuration.
| Variable | Description | Default |
| :--- | :--- | :--- |
| DB_HOST | Database hostname | localhost |
| DB_USER | Database username | root |
| DB_PASSWORD | Database password | (empty) |
| DB_PORT | Database port | 3306 |
| DB_NAME | Optional. Default target database. | - |
🔌 Connect to Your AI
GitHub Copilot / VS Code
Add this to your mcpServers.json (usually in ~/Library/Application Support/Code/User/globalStorage/ms-vscode.github-copilot-chat/mcpServers.json on macOS):
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "gotrasoft-mysql"],
"env": {
"DB_HOST": "127.0.0.1",
"DB_USER": "root",
"DB_PASSWORD": "your_secure_password",
"DB_PORT": "3306"
}
}
}
}Claude Desktop
Add this to your claude_desktop_config.json (usually in ~/Library/Application Support/Claude/ on macOS):
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "gotrasoft-mysql"],
"env": {
"DB_HOST": "127.0.0.1",
"DB_USER": "root",
"DB_PASSWORD": "your_secure_password",
"DB_PORT": "3306"
}
}
}
}💡 How to Use
Once connected, simply chat with your AI assistant naturally.
🔎 Explore Structure
"What tables are in the
ecommercedatabase?" "Show me the schema for theusersandorderstables."
🧠 Analyze Data
"How many users signed up last month?" "Find the top 5 most expensive products in the
inventorytable." "Join theusersandorderstables to show total spend per user."
🛡️ Safe Execution
The AI will use the execute_query tool. Don't worry—if it tries to DELETE or DROP, the server will reject the request.
🛠️ Tool Reference
| Tool Name | Description | Arguments |
| :--- | :--- | :--- |
| list_tables | Lists all tables in a database. | database (optional) |
| describe_table | Shows detailed column/type info. | table_name, database (optional) |
| execute_query | Runs a safe, read-only SQL query. | query (SQL string), database (optional) |
| get_table_stats | Returns row counts & size metrics. | table_name, database (optional) |
| create_database | Creates a new schema. | database_name |
🌟 More from Gotrasoft
Check out gotrasoft-postman!
A generic Postman-like MCP server for testing any API. Supports various authentication methods and is perfect for testing enterprise APIs.
📄 License
MIT © I Komang Gede Yuliana
