MySQL MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MySQL MCP Server show me all users from the test_users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP Server
This is a Model Context Protocol (MCP) server that provides access to a MySQL database. It allows agent to execute SQL queries against a MySQL database.
Features
Execute SQL queries against a MySQL database:
Read data (SELECT statements)
Create tables (CREATE TABLE statements)
Insert data (INSERT INTO statements)
Update data (UPDATE statements)
Delete data (DELETE FROM statements)
Returns query results in JSON format
Configurable database connection settings
Transaction logging with unique IDs
Related MCP server: MCP MySQL Server
Prerequisites
Node.js (v14 or higher)
MySQL server
MCP SDK
Installation
Clone or download this repository
Install dependencies:
cd mysql-mcp-server
npm installBuild the server:
npm run buildConfiguration
The MySQL MCP server uses the following environment variables for configuration:
MYSQL_HOST: MySQL server hostname (default: 'localhost')MYSQL_PORT: MySQL server port (default: 3306)MYSQL_USER: MySQL username (default: 'mcp101')MYSQL_PASSWORD: MySQL password (default: '123qwe')MYSQL_DATABASE: MySQL database name (default: 'mcpdb')
Database Setup
Create a MySQL database:
CREATE DATABASE mcpdb;Create a MySQL user with access to the database:
CREATE USER 'mcp101'@'localhost' IDENTIFIED BY '123qwe';
GRANT ALL PRIVILEGES ON mcpdb.* TO 'mcp101'@'localhost';
FLUSH PRIVILEGES;Create a test table with sample data:
USE mcpdb;
CREATE TABLE test_users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO test_users (name, email) VALUES
('John Doe', 'john@example.com'),
('Jane Smith', 'jane@example.com'),
('Bob Johnson', 'bob@example.com');MCP Configuration
Add the MySQL MCP server to your MCP settings file:
VSCode (Claude Extension)
File: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Change the args according your MySQL configuruation
{
"mcpServers": {
"mysql-mcp-server": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "node",
"args": [
"/path/to/mysql-mcp-server/build/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "mcp101",
"MYSQL_PASSWORD": "123qwe",
"MYSQL_DATABASE": "mcpdb"
},
"transportType": "stdio"
}
}
}Claude Desktop App
File: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mysql-mcp-server": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "node",
"args": [
"/path/to/mysql-mcp-server/build/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "mcp101",
"MYSQL_PASSWORD": "123qwe",
"MYSQL_DATABASE": "mcpdb"
},
"transportType": "stdio"
}
}
}Usage
Once configured, you can use the MySQL MCP server in your conversations with Claude. For example:
"Can you show me all the users in the test_users table?"
Claude will use the run_sql_query tool to execute:
SELECT * FROM test_usersAvailable Tools
run_sql_query
Executes a read-only SQL query (SELECT statements only) against the MySQL database.
Parameters:
query: The SQL SELECT query to execute.
Example:
{
"query": "SELECT * FROM test_users"
}create_table
Creates a new table in the MySQL database.
Parameters:
query: The SQL CREATE TABLE query to execute.
Example:
{
"query": "CREATE TABLE products (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), price DECIMAL(10,2))"
}insert_data
Inserts data into a table in the MySQL database.
Parameters:
query: The SQL INSERT INTO query to execute.
Example:
{
"query": "INSERT INTO products (name, price) VALUES ('Laptop', 999.99), ('Smartphone', 499.99)"
}update_data
Updates data in a table in the MySQL database.
Parameters:
query: The SQL UPDATE query to execute.
Example:
{
"query": "UPDATE products SET price = 899.99 WHERE name = 'Laptop'"
}delete_data
Deletes data from a table in the MySQL database.
Parameters:
query: The SQL DELETE FROM query to execute.
Example:
{
"query": "DELETE FROM products WHERE name = 'Smartphone'"
}Security Considerations
Use a dedicated MySQL user with appropriate privileges for the MCP server
Consider using read-only privileges if you only need to query data
Store sensitive information like database credentials securely
All operations are logged with unique transaction IDs for auditing
Available Tools
6 toolscreate_tableC
在 MySQL 数据库中创建新表
Inputs: query (required).
delete_dataC
从 MySQL 数据库表中删除数据
Inputs: query (required).
execute_sqlA
执行任意非 SELECT 的 SQL 语句(如 ALTER TABLE、DROP 等)
Inputs: query (required).
insert_dataC
向 MySQL 数据库表插入数据
Inputs: query (required).
run_sql_queryA
执行只读 SQL 查询(仅限 SELECT 语句)
Inputs: query (required).
update_dataC
更新 MySQL 数据库表中的数据
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinct and clear purpose with no overlap: create_table for table creation, delete_data for deletion, execute_sql for non-SQL operations, insert_data for insertion, run_sql_query for read-only queries, and update_data for updates. The separation between execute_sql (non-SELECT) and run_sql_query (SELECT) is particularly well-defined, preventing confusion.
All tool names follow a consistent verb_noun pattern in snake_case, such as create_table, delete_data, and run_sql_query. This uniformity makes the tool set predictable and easy for an agent to navigate, with no deviations in naming conventions.
With 6 tools, this server is well-scoped for basic MySQL database operations, covering essential CRUD actions and SQL execution. Each tool serves a specific function without redundancy, making the count appropriate for the domain and avoiding both over-saturation and under-coverage.
The tool set provides strong coverage for core database operations, including create, read (via run_sql_query), update, and delete, plus general SQL execution. A minor gap exists in lacking tools for table deletion or schema inspection, but agents can work around this using execute_sql for such tasks, keeping the surface largely complete for typical workflows.
Related MCP Connectors
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables SQL query execution, database management, and business intelligence capabilities through MySQL connections.1,462 npmMIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.5272 npmMIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.7MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.3-