How does Mcp Mysql Server prevent SQL injection?
It uses prepared statements for all parameterized queries, ensuring user input is safely escaped.
@huangfeng19820712
基本信息
一个提供MySQL数据库操作的模型上下文协议服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。支持对数据库的所有操作。
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"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"
}
}
}
}Connect to MySQL database
Execute a SELECT query,can not get table structure,use describe_table tool to get table structure
Execute an INSERT, UPDATE, or DELETE query
List all tables in the database
Get table structure
Execute a SHOW statement (e.g., SHOW STATUS, SHOW VARIABLES)
Analyze SQL query performance using EXPLAIN
A Model Context Protocol server that provides MySQL database operations. It enables AI models to interact with MySQL databases through a standardized interface.
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.
It uses prepared statements for all parameterized queries, ensuring user input is safely escaped.
Node.js and npx are required. The server is distributed as an npm package and runs via `npx`.
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`).
The server returns detailed error messages for connection failures, invalid queries, missing parameters, and database errors.
The README does not mention explicit transaction support; it provides `execute` for DML statements but no commit/rollback tools.

Access millions of official legal and regulatory source documents from 155+ jurisdictions via MCP. Lawstronaut supports AI agents with structured legal research, legal data, laws, regulations, cases, guidance, official s

nuzur is a model-first database platform for MySQL and PostgreSQL. The MCP server lets any AI assistant or agent (Claude, Cursor, Gemini, or anything else that speaks MCP) design your schema, query your data, generate mi

Fund Momentum MCP Server — VC intelligence for AI assistants. 1000+ active VC funds, live investor signals, AI-powered startup matching.
MCP server for interacting with Neon Management API and databases

Safety-first stdio MCP server with 38 tools for operating Docker-based local-ydb environments locally or over SSH.
评论