mysql
Provides tools for querying, inspecting, and modifying MySQL databases, including listing databases, tables, describing table structure, executing read-only queries, write operations, and table statistics.
Click on "Install 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., "@mysqlList all tables in my 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.
@longlonga/mysql
A Model Context Protocol (MCP) server for interacting with MySQL databases. Provides tools for querying, inspecting, and modifying MySQL databases directly from Claude.
Installation
Via Claude Code (recommended)
claude mcp add --scope user mysql \
-e MYSQL_HOST=your-host \
-e MYSQL_PORT=3306 \
-e MYSQL_USER=your-user \
-e MYSQL_PASSWORD=your-password \
-e MYSQL_DATABASE=your-database \
-- npx -y @longlonga/mysqlVia claude_desktop_config.json
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@longlonga/mysql"],
"env": {
"MYSQL_HOST": "your-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-user",
"MYSQL_PASSWORD": "your-password",
"MYSQL_DATABASE": "your-database"
}
}
}
}Related MCP server: MCP MySQL App
Configuration
Environment Variable | Required | Default | Description |
| Yes | — | MySQL server hostname or IP |
| No |
| MySQL server port |
| Yes | — | MySQL username |
| Yes | — | MySQL password |
| No | — | Default database (can be overridden per tool call) |
Tools
Tool | Description |
| List all databases the user has access to |
| List all tables in a database |
| Get column definitions for a table |
| Get the full CREATE TABLE DDL statement |
| Execute a read-only SELECT/SHOW/EXPLAIN query |
| Execute a write SQL statement (INSERT/UPDATE/DELETE/DDL) |
| Get row count and size statistics for tables |
Usage Examples
Once connected, you can ask Claude things like:
"List all tables in my database"
"Describe the structure of the users table"
"Query the last 10 orders"
"How many rows are in each table?"
License
MIT
Available Tools
7 toolsmysql_describe_tableDescribe Table StructureARead-onlyIdempotent
Get column definitions for a MySQL table (equivalent to DESCRIBE or SHOW COLUMNS).
Args:
table (string, required): Table name
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns column info: Field, Type, Null, Key, Default, Extra
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name to describe | |
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) | |
| response_format | No | Output format: 'markdown' or 'json' | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds return column fields, output format options, and database fallback behavior, giving useful context beyond annotations.
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?
Three sentences plus a list of return columns, front-loaded with purpose. Every sentence is essential and no fluff.
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 comprehensive annotations, full parameter documentation, and clear return information, the description is complete for a read-only introspection tool.
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%, but description adds meaning by explaining the database parameter's env var fallback, response_format default, and lists return columns. Each parameter is clearly described.
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?
Description clearly states 'Get column definitions for a MySQL table' and equates to DESCRIBE/SHOW COLUMNS, distinguishing it from siblings like mysql_show_create_table (which shows CREATE TABLE) and mysql_table_stats (statistics).
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?
Description explains parameters and default behavior for database, but does not explicitly mention when to use this tool vs alternatives. Usage is implied but not contrasted with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_executeExecute Write SQLADestructive
Execute a write SQL statement (INSERT, UPDATE, DELETE, DDL).
WARNING: This tool modifies data. Use with caution.
Args:
sql (string, required): SQL statement. Use ? placeholders for parameters.
params (array, optional): Bind parameters corresponding to ? placeholders.
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
Returns: { affectedRows: number, insertId: number, changedRows: number }
Examples:
sql: "UPDATE biz_exhaust_hy SET DELETE_FLAG = 'DELETED' WHERE ID = ?", params: [123]
sql: "INSERT INTO my_table (name) VALUES (?)", params: ["test"]
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Write SQL statement. Use ? for bind parameters. | |
| params | No | Bind parameters for ? placeholders | |
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark destructiveHint=true and readOnlyHint=false. The description adds a clear warning, return format details (affectedRows, insertId, changedRows), and examples. This fully discloses behavioral traits beyond annotations.
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 concise with a clear structure: purpose line, warning, args, returns, and examples. No superfluous text; every element adds value.
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?
No output schema exists, so the description must explain return values. It does so with the exact return object shape and concrete examples. Combined with annotations and input schema, the description is fully adequate for the tool's complexity.
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%. The description adds usage semantics: using ? placeholders, optional bind params, and database fallback to env variable. This provides meaning beyond the schema's property descriptions.
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 explicitly states 'Execute a write SQL statement (INSERT, UPDATE, DELETE, DDL).' The verb 'Execute' and resource 'write SQL statement' are clear, and listing specific SQL types distinguishes it from read-only sibling tools like 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 warns 'This tool modifies data. Use with caution.' and implicitly separates its write-only purpose from read siblings. However, it lacks explicit guidance on when not to use or direct alternatives, so it's not a full 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_list_databasesList MySQL DatabasesARead-onlyIdempotent
List all databases on the MySQL server.
Returns database names the current user has access to.
Returns:
markdown: formatted list
json: { databases: string[] }
| Name | Required | Description | Default |
|---|---|---|---|
| response_format | No | Output format: 'markdown' or 'json' | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnly, destructive, and idempotent hints. The description adds behavioral context by specifying that only databases the user has access to are returned and detailing output formats, which is valuable beyond the annotations.
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 extremely concise with three short lines, each providing essential information without redundancy. It is front-loaded with the primary purpose.
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 tool's simplicity (one optional parameter, no output schema), the description sufficiently covers functionality, access scope, and return types, leaving no significant gaps.
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% with the 'response_format' parameter fully described. The description links the parameter to output formats and shows example return structures, adding concrete meaning beyond the enum definition.
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 databases on the MySQL server, specifically those the current user has access to, which distinguishes it from sibling tools focused on tables or 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?
While the tool's purpose is clear, there is no explicit guidance on when to use this tool versus alternatives like mysql_list_tables, nor any when-not or exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_list_tablesList Tables in DatabaseARead-onlyIdempotent
List all tables in a MySQL database.
Args:
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns:
markdown: formatted table list
json: { database: string, tables: string[], count: number }
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) | |
| response_format | No | Output format: 'markdown' or 'json' | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already confirm read-only, non-destructive, idempotent behavior. The description adds context about optional database with env var fallback and return format details, which enrich transparency beyond annotations.
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 concise with two sentences and a structured args/returns list, front-loading the purpose with no wasted 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 description covers purpose, parameters, and return format well for a simple tool. Lacks guidance on when to use alternatives, but otherwise complete given annotations and schema.
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%, but description adds value by specifying the return structure for both markdown and json formats, which is not present in the schema (no output schema).
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 'List all tables in a MySQL database,' using a specific verb and resource that distinguishes it from sibling tools like mysql_describe_table or 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 usage for listing tables but does not explicitly state when to use this tool versus alternatives, such as when to use mysql_describe_table for details.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_queryExecute SELECT QueryARead-only
Execute a read-only SELECT query against MySQL.
Only SELECT and SHOW/EXPLAIN statements are permitted. Use mysql_execute for write operations.
Args:
sql (string, required): SQL SELECT statement. Use ? placeholders for params.
params (array, optional): Bind parameters corresponding to ? placeholders.
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
limit (number, optional): Max rows to return (default: 100, max: 1000).
response_format ('markdown' | 'json'): Output format (default: 'json')
Returns:
json: { rows: object[], count: number, has_more: boolean }
markdown: formatted table
Examples:
sql: "SELECT * FROM biz_exhaust_yg WHERE jcrq = ? LIMIT 10", params: ["2026-03"]
sql: "SELECT COUNT(*) as cnt FROM biz_exhaust_hy"
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SELECT SQL statement. Use ? for bind parameters. | |
| params | No | Bind parameters for ? placeholders | |
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) | |
| limit | No | Maximum rows to return (default 100) | |
| response_format | No | Output format: 'markdown' or 'json' | json |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already set readOnlyHint=true and destructiveHint=false. Description adds behavioral details: only SELECT/SHOW/EXPLAIN allowed, limit defaults (100, max 1000), optional database fallback, response formats (json/markdown) with has_more flag. No contradictions.
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?
Structured into clear sections (purpose, args, returns, examples). Each sentence is informative with no redundancy. Efficiently covers all necessary information.
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?
Thoroughly covers all 5 parameters, return formats, and edge cases (defaults, optional params). Includes examples. No output schema needed as returns are described. Complete for a read-only query tool.
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% with good descriptions. Description adds examples of ? placeholders, clarifies bind parameters, and notes default database from env var. Adds value beyond schema.
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?
Clearly states 'Execute a read-only SELECT query against MySQL' and explicitly lists permitted statements (SELECT, SHOW, EXPLAIN). Differentiates from sibling mysql_execute for write operations.
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?
Provides explicit guidance: 'Use mysql_execute for write operations.' Includes parameter roles, defaults, and examples. Lacks explicit mention of when to use other siblings like mysql_describe_table, but the distinction is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_show_create_tableShow CREATE TABLE StatementARead-onlyIdempotent
Get the full CREATE TABLE DDL statement for a table.
Args:
table (string, required): Table name
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
Returns the complete CREATE TABLE SQL with all indexes, constraints, and engine settings.
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name | |
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint, destructiveHint, and idempotentHint. The description adds useful context about the output (indexes, constraints, engine settings) and the default database fallback from environment variable, which is beyond the annotations.
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 concise with three sentences and a structured args list. It front-loads the purpose. Minor room for improvement in formatting (e.g., using bullet points for args in the prose).
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 no output schema, the description adequately covers the return value (complete SQL). For a simple read-only tool with two parameters, it is complete enough for an agent to understand its use. Missing error handling details is acceptable.
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% with descriptions for both parameters. The description repeats the parameter info but does not add new meaning beyond what the schema already provides. The env var fallback is mentioned in both places.
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?
Clearly states the tool gets the full CREATE TABLE DDL statement, specifying the verb 'Get' and the resource. However, it does not explicitly differentiate from the sibling tool mysql_describe_table, which also provides table structure but focuses on column details rather than full DDL.
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 retrieving DDL statements but offers no explicit guidance on when to use this tool versus alternatives like mysql_describe_table or when to avoid it. Usage context is only implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mysql_table_statsGet Table StatisticsARead-onlyIdempotent
Get row count and size statistics for tables in a database.
Args:
database (string, optional): Database name. Uses MYSQL_DATABASE if omitted.
table (string, optional): Filter to a specific table. If omitted, returns all tables.
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns per table: table_name, row_count, data_size_mb, index_size_mb, engine, create_time
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (uses MYSQL_DATABASE env var if omitted) | |
| table | No | Optional: filter to a specific table name | |
| response_format | No | Output format: 'markdown' or 'json' | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds behavioral details such as the default database using MYSQL_DATABASE env var and the return format with markdown/json options. No contradictions.
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 concise: three short paragraphs covering purpose, args, and returns. No extra words. Every sentence adds value.
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 tool has 3 optional parameters and no output schema, the description completely explains all parameters and the return fields (table_name, row_count, etc.). Sibling tools are distinct; no additional context needed.
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%, so baseline is 3. The description adds value by explaining defaults for database and response_format, and the effect of omitting the table parameter (returns all tables).
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 'Get row count and size statistics for tables in a database,' which is a specific verb and resource. It distinguishes from sibling tools like mysql_describe_table or mysql_query, as none of those provide statistics.
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 explains when to use the tool: to obtain table statistics. It provides context for optional parameters and defaults but does not explicitly mention alternatives or when not to use it. Sibling tool names provide implicit guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool targets a distinct operation: reading, writing, describing schema, listing databases/tables, showing DDL, and table statistics. No ambiguity between tools.
All tools share the 'mysql_' prefix and mostly follow verb_noun pattern (e.g., describe_table, list_databases). However, 'mysql_execute' and 'mysql_query' are verb-only, which slightly deviates from the pattern.
With 7 tools, the server covers essential MySQL interactions without being bloated. Each tool serves a clear purpose, making it easy for an agent to navigate.
The set covers core CRUD, schema inspection, and metadata retrieval. DDL operations are handled via mysql_execute, so no major gaps are present. Minor missing features like server version are not critical.
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
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.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseCqualityDmaintenanceAn MCP server that enables MySQL database integration with Claude. You can execute SQL queries and manage database connections.29MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.MIT
- 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.5342MIT
- FlicenseBqualityDmaintenanceA 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.7
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/donald-ada/mysql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server