MCP MySQL Server
Provides read-only access to a MySQL database, enabling execution of SELECT queries with parameterized inputs, listing tables, and describing table structures.
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., "@MCP MySQL Serverlist all tables in the database"
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.
MCP MySQL Server
Model Context Protocol (MCP) server for MySQL database connectivity.
Features
Execute SQL SELECT queries with parameterized inputs (read-only)
List all tables in the database (read-only metadata)
Describe table structure (read-only metadata)
Read-only access only - no INSERT, UPDATE, DELETE operations
Related MCP server: MCP MySQL Server
Installation
Clone this repository
Install dependencies:
npm installBuild the TypeScript code:
npm run build
Configuration
Copy .env.example to .env and update the MySQL connection settings:
cp .env.example .envEdit .env with your MySQL credentials:
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=yourpassword
MYSQL_DATABASE=yourdatabaseUsage
Development mode
npm run devProduction mode
npm run build
npm startIntegration with WorkBuddy
Add this server to your WorkBuddy configuration. Example configuration for WorkBuddy:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/absolute/path/to/mcp-mysql/dist/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "yourpassword",
"MYSQL_DATABASE": "yourdatabase"
}
}
}
}Tools
mysql_query
Execute a SQL SELECT query with parameterized inputs. Read-only - only SELECT queries are allowed.
Parameters:
sql(string): SQL SELECT query with?placeholdersparameters(string[]): Array of parameter values
mysql_list_tables
List all tables in the current database. Read-only metadata query.
mysql_describe_table
Get the schema of a table. Read-only metadata query.
Parameters:
tableName(string): Name of the table to describe
Permissions
This MCP server provides read-only access only. The following restrictions are enforced:
Only SELECT queries are allowed via
mysql_queryNo INSERT, UPDATE, DELETE, or other data modification operations
Metadata queries (
mysql_list_tables,mysql_describe_table) are read-onlyAll queries use parameterized statements to prevent SQL injection
Security
All SQL queries use parameterized statements to prevent SQL injection
Table names are validated with regex before use
Connection credentials are loaded from environment variables
License
MIT
Available Tools
3 toolsmysql_describe_tableA
Get the schema of a table (columns, types, constraints). This is a read-only metadata query.
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | Yes | Name of the table to describe |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description discloses read-only behavior, which is crucial for safe invocation. No additional traits (e.g., performance, locks) are mentioned, but it is truthful and adequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with purpose. No unnecessary words. Efficient and clear.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter metadata tool with no output schema, the description is sufficiently complete. It covers purpose, safety, and expected output scope.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, and the description adds no extra meaning beyond the schema's 'Name of the table to describe'. Baseline score is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it retrieves table schema (columns, types, constraints) and specifies it's read-only. It distinguishes from sibling tools: mysql_list_tables (list tables) and mysql_query (run queries).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description indicates use for getting table structure but does not explicitly state when to avoid or mention alternative tools. The context is clear but lacks exclusion guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_list_tablesA
List all tables in the current database. This is a read-only metadata query.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description clearly indicates the tool is a read-only metadata query, which is the key behavioral trait. It does not detail the exact output format, but for a simple listing this is acceptable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short, front-loaded sentences convey purpose and key trait without any extraneous words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with no parameters and no output schema. The description covers the essential purpose and safety characteristic. It could have elaborated on the output format, but for a list tool this is largely sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters and the input schema (empty) has 100% coverage. According to guidelines, 0 parameters yields a baseline of 4; the description need not add parameter info.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists all tables in the current database and specifies it is read-only. It effectively distinguishes from siblings such as mysql_describe_table and mysql_query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for listing tables and is read-only, but does not explicitly state when not to use it or provide alternatives beyond the sibling context. However, the context makes it clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_queryA
Execute a SQL SELECT query and return results. This is a read-only query tool. Use parameterized queries to prevent SQL injection.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL SELECT query with ? placeholders for parameters | |
| parameters | No | Array of parameter values to bind to the query |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It states the tool is read-only, but fails to mention other behaviors such as error handling, rate limits, or authentication requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is only two sentences, front-loaded with the core purpose, and contains no unnecessary words or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (2 parameters, no output schema, no nested objects), the description covers the read-only nature and security practice. However, it lacks information on return format or error scenarios, which would be helpful for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the description adds minimal value beyond the schema. It repeats the injection prevention advice but does not elaborate on parameter formatting or binding details.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Execute a SQL SELECT query and return results' and explicitly notes it is a read-only tool, distinguishing it from siblings like mysql_describe_table and mysql_list_tables which have different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides guidance on using parameterized queries to prevent SQL injection, but does not explicitly state when to use this tool versus its siblings or when not to use it, leaving usage context implicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v1.0.0- First observed
mysql_describe_table - First observed
mysql_list_tables - First observed
mysql_query
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: listing tables, describing a table's schema, and executing SELECT queries. There is no overlap or ambiguity.
Two tools follow a consistent 'mysql_verb_noun' pattern (mysql_describe_table, mysql_list_tables), but mysql_query deviates by using only a verb. This minor inconsistency is still clear.
With only 3 tools, the set is on the lower end. It covers basic read-only operations but feels slightly thin for a MySQL server, especially missing write operations. However, the read-only scope is explicitly stated.
For the stated read-only purpose, the tools provide complete coverage: metadata exploration (list tables, describe table) and data querying (SELECT). No obvious gaps.
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables read-only access to MySQL databases through natural language queries. Provides automatic table schema discovery and executes SELECT, SHOW, DESCRIBE, and EXPLAIN statements within secure read-only transactions.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely query MySQL databases with read-only access by default, supporting table listing, structure inspection, and SQL queries with optional write operation control.10 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.1-
- AlicenseAqualityDmaintenanceEnables read-only MySQL database access, allowing listing databases, tables, describing schemas, and executing SELECT/SHOW/DESCRIBE/EXPLAIN queries.712 npm4MIT