Feedback

Mcp Mysql Server — by huangfeng19820712

@huangfeng19820712 Claim

Basic information

Runtime
node
Category
License
MIT
Transports
stdio
Author
huangfeng19820712
Submitted by
Community
Quality
25
Stars
21

About Mcp Mysql Server

一个提供MySQL数据库操作的模型上下文协议服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。支持对数据库的所有操作。

Mcp Mysql Server is a MCP server in the Databases category listed in the AddMCP.net directory, published by huangfeng19820712. It exposes 7 tools, including connect_db, query, execute, list_tables and more. Supported transport: stdio. Runtime: node. License: MIT. The repository has 21 GitHub stars. Source code is hosted on github.com. Related topics: mysql.

Setup

{
    "mcpServers": {
        "mysql": {
            "command": "npx",
            "args": [
                "-y",
                "@fhuang/mcp-mysql-server"
            ],
            "env": {
                "MYSQL_HOST": "IP",
                "MYSQL_USER": "USER",
                "MYSQL_PORT": "PORT",
                "MYSQL_PASSWORD": "password",
                "MYSQL_DATABASE": "DATABASE"
            }
        }
    }
}

Mcp Mysql Server — by huangfeng19820712 config

Add this server to your MCP-compatible client using the configuration below.

{
    "mcpServers": {
        "mysql": {
            "command": "npx",
            "args": [
                "-y",
                "@fhuang/mcp-mysql-server"
            ],
            "env": {
                "MYSQL_HOST": "IP",
                "MYSQL_USER": "USER",
                "MYSQL_PORT": "PORT",
                "MYSQL_PASSWORD": "password",
                "MYSQL_DATABASE": "DATABASE"
            }
        }
    }
}

Mcp Mysql Server — by huangfeng19820712 tools

  • connect_db — Connect to MySQL database
    host:string*, user:string*, password:string*, database:string*, port:number
  • query — Execute a SELECT query,can not get table structure,use describe_table tool to get table structure
    sql:string*, params:array
  • execute — Execute an INSERT, UPDATE, or DELETE query
    sql:string*, params:array
  • list_tables — List all tables in the database
    (no parameters)
  • describe_table — Get table structure
    table:string*
  • show_statement — Execute a SHOW statement (e.g., SHOW STATUS, SHOW VARIABLES)
    sql:string*
  • explain — Analyze SQL query performance using EXPLAIN
    sql:string*

Overview

What is Mcp Mysql Server?

A Model Context Protocol server that provides MySQL database operations. It enables AI models to interact with MySQL databases through a standardized interface.

How to use Mcp Mysql Server?

Install via Smithery (npx -y @smithery/cli install @fhuang/mcp-mysql-server --client claude) or manually (npx @fhuang/mcp-mysql-server). Configure with a connection string or environment variables (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE). Use tools like connect_db, query, execute, list_tables, describe_table, show_statement, and explain.

Key features of Mcp Mysql Server

  • Secure connection handling with automatic cleanup
  • Prepared statement support to prevent SQL injection
  • Comprehensive error handling and validation
  • TypeScript support
  • Automatic connection management
  • Tools for querying, executing DML, and schema inspection

Use cases of Mcp Mysql Server

  • AI assistants querying MySQL databases for information retrieval
  • Executing INSERT, UPDATE, or DELETE operations via natural language
  • Listing and describing database tables for schema exploration
  • Analyzing query performance using EXPLAIN
  • Running administrative SHOW statements

Frequently asked questions

1 How does Mcp Mysql Server prevent SQL injection?

It uses prepared statements for all parameterized queries, ensuring user input is safely escaped.

2 What runtime dependencies does Mcp Mysql Server require?

Node.js and npx are required. The server is distributed as an npm package and runs via npx.

3 How are database credentials handled?

Credentials can be passed via a connection string (e.g., mysql://user:password@localhost:port/database) or through environment variables (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE).

4 What happens if a query fails?

The server returns detailed error messages for connection failures, invalid queries, missing parameters, and database errors.

5 Does Mcp Mysql Server support transactions?

The README does not mention explicit transaction support; it provides execute for DML statements but no commit/rollback tools.

Comments

No comments yet

Be the first to share feedback about this listing. Sign in to leave a comment.

Sign In

Feedback 💬