MCP MySQL Server
Provides database operations for MySQL including connection management, executing queries, listing tables, and describing table structures. Supports prepared statements for secure query parameter handling.
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., "@MCP MySQL Servershow me the 10 most recent orders from the orders 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.
@f4ww4z/mcp-mysql-server
A Model Context Protocol server that provides MySQL database operations. This server enables AI models to interact with MySQL databases through a standardized interface.
Installation
Installing via Smithery
To install MySQL Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @f4ww4z/mcp-mysql-server --client claudeManual Installation
npx @f4ww4z/mcp-mysql-serverRelated MCP server: MCP MySQL Server
Configuration
The server requires the following environment variables to be set in your MCP settings configuration file:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@f4ww4z/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Available Tools
1. connect_db
Establish connection to MySQL database using provided credentials.
use_mcp_tool({
server_name: "mysql",
tool_name: "connect_db",
arguments: {
host: "localhost",
user: "your_user",
password: "your_password",
database: "your_database"
}
});2. query
Execute SELECT queries with optional prepared statement parameters.
use_mcp_tool({
server_name: "mysql",
tool_name: "query",
arguments: {
sql: "SELECT * FROM users WHERE id = ?",
params: [1]
}
});3. execute
Execute INSERT, UPDATE, or DELETE queries with optional prepared statement parameters.
use_mcp_tool({
server_name: "mysql",
tool_name: "execute",
arguments: {
sql: "INSERT INTO users (name, email) VALUES (?, ?)",
params: ["John Doe", "john@example.com"]
}
});4. list_tables
List all tables in the connected database.
use_mcp_tool({
server_name: "mysql",
tool_name: "list_tables",
arguments: {}
});5. describe_table
Get the structure of a specific table.
use_mcp_tool({
server_name: "mysql",
tool_name: "describe_table",
arguments: {
table: "users"
}
});Features
Secure connection handling with automatic cleanup
Prepared statement support for query parameters
Comprehensive error handling and validation
TypeScript support
Automatic connection management
Security
Uses prepared statements to prevent SQL injection
Supports secure password handling through environment variables
Validates queries before execution
Automatically closes connections when done
Error Handling
The server provides detailed error messages for common issues:
Connection failures
Invalid queries
Missing parameters
Database errors
Contributing
Contributions are welcome! Please feel free to submit a Pull Request to https://github.com/f4ww4z/mcp-mysql-server
License
MIT
Available Tools
5 toolsconnect_dbC
Connect to MySQL database
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Database host | |
| user | Yes | Database user | |
| password | Yes | Database password | |
| database | Yes | Database name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool connects to a database, implying it might establish a session or handle authentication, but it doesn't describe what happens on success or failure, whether connections are persistent, timeouts, or error handling. For a tool with 4 required parameters and no annotations, this leaves significant behavioral gaps.
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 a single, efficient sentence with zero waste: 'Connect to MySQL database'. It is appropriately sized and front-loaded, clearly stating the core action without unnecessary details. Every word earns its place, making it highly concise and well-structured.
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 complexity of a database connection tool with 4 required parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a connection handle, success status), error conditions, or how it integrates with sibling tools. For a tool that likely enables other operations, more context is needed to guide the agent effectively.
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 input schema has 100% description coverage, with clear documentation for all 4 parameters (host, user, password, database). The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.
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 'Connect to MySQL database' clearly states the verb ('Connect') and resource ('MySQL database'), making the purpose understandable. However, it doesn't distinguish this tool from potential sibling tools like 'describe_table' or 'execute', which might also involve database operations. The purpose is clear but lacks sibling differentiation.
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 no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., that this must be called before other database tools), exclusions, or context for usage relative to siblings like 'query' or 'list_tables'. Without any usage instructions, the agent must infer when this tool is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_tableC
Get table structure
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('Get') but doesn't disclose details like error handling (e.g., if the table doesn't exist), output format, permissions required, or side effects. More context is needed for a tool that interacts with a database.
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 very concise at three words, with no wasted language. It's front-loaded and to the point, though it could benefit from slightly more detail without losing efficiency. The brevity is appropriate but borders on under-specification.
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 complexity of a database tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'table structure' includes (e.g., schema details), potential errors, or the return format. For a tool that likely returns structured metadata, more context is needed to guide the agent effectively.
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%, with the single parameter 'table' documented as 'Table name' in the schema. The description adds no additional meaning beyond this, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 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 'Get table structure' clearly indicates a read operation on a database table, which is better than a tautology. However, it lacks specificity about what 'structure' entails (e.g., columns, data types, constraints) and doesn't distinguish it from potential siblings like 'list_tables' (which might list names only) or 'query' (which retrieves data).
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?
No explicit guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a database connection via 'connect_db'), contrast with 'list_tables' (for names) or 'query' (for data), or specify use cases like schema inspection. Usage is implied by the name but not articulated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
executeC
Execute an INSERT, UPDATE, or DELETE query
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL query (INSERT, UPDATE, DELETE) | |
| params | No | Query parameters (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'Execute an INSERT, UPDATE, or DELETE query' implies a write/mutation operation, it doesn't disclose critical behaviors like transaction handling, error conditions, permission requirements, or whether changes are reversible. The description is minimal and lacks necessary context for safe use.
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 - a single sentence with zero wasted words. It's front-loaded with the core functionality and appropriately sized for what it communicates. Every word earns its place in this minimal description.
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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address what happens after execution (success/failure indicators, affected rows), doesn't mention connection requirements despite 'connect_db' being a sibling, and provides no safety guidance for destructive operations. The minimal description leaves too many contextual 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 description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional meaning beyond what's in the schema - it mentions INSERT/UPDATE/DELETE queries which aligns with the schema's 'sql' parameter description but provides no extra syntax, format, or usage details. Baseline 3 is appropriate when schema does the heavy lifting.
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 executes SQL queries (INSERT, UPDATE, DELETE), providing a specific verb ('Execute') and resource ('query'). However, it doesn't distinguish this from the sibling 'query' tool, which likely handles SELECT queries, leaving some ambiguity about when to use each.
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 no guidance on when to use this tool versus alternatives. It doesn't mention the sibling 'query' tool for SELECT operations or clarify prerequisites like needing an established database connection (implied by 'connect_db' sibling). No exclusions or context for usage is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesB
List all tables in the database
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action but doesn't describe what 'List' entails—such as whether it returns names only, metadata, pagination behavior, or error conditions. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.
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 a single, efficient sentence that front-loads the core action and resource without any wasted words. It's appropriately sized for a simple tool with no parameters, making it easy for an agent to parse quickly.
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 (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks depth. It doesn't explain the return format or any behavioral nuances, which could be important for an agent to use it correctly. However, for a basic list operation, it meets the minimum viable threshold without being misleading.
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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, but it could have mentioned optional filters or scoping if applicable. Since there are no parameters, a baseline of 4 is justified as the description doesn't need to compensate for schema gaps.
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 action ('List') and target resource ('all tables in the database'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'describe_table' or 'query', but the verb 'List' suggests enumeration rather than detailed inspection or data retrieval, which provides some implicit distinction.
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 no guidance on when to use this tool versus alternatives like 'describe_table' for table details or 'query' for data access. It lacks context about prerequisites (e.g., whether a database connection is required) or exclusions, leaving the agent to infer usage based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
queryC
Execute a SELECT query
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL SELECT query | |
| params | No | Query parameters (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. 'Execute a SELECT query' implies a read-only operation that returns data, but it doesn't disclose critical behaviors like whether it requires authentication, has rate limits, returns results in a specific format (e.g., JSON, table), handles large result sets, or what happens on SQL errors. This leaves significant gaps for an agent to use it correctly.
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 at three words, front-loading the core purpose with zero wasted text. Every word ('Execute', 'SELECT', 'query') earns its place by contributing essential information about the tool's function.
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 complexity of executing database queries (which involves SQL syntax, result handling, and potential errors), the description is incomplete. With no annotations, no output schema, and minimal behavioral disclosure, an agent lacks sufficient context to use this tool effectively. The description doesn't compensate for the missing structured information about what the tool returns or how it behaves.
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 schema description coverage is 100%, with both parameters ('sql' and 'params') clearly documented in the schema. The description adds no additional semantic meaning beyond what the schema provides (e.g., no examples of SQL syntax, no explanation of how params bind to placeholders). Since the schema does the heavy lifting, the baseline score of 3 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 'Execute a SELECT query' clearly states the action (execute) and resource (SELECT query), making the purpose immediately understandable. It distinguishes from siblings like 'connect_db' (connection management) and 'describe_table' (metadata querying), though it doesn't explicitly differentiate from 'execute' which might handle non-SELECT 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 provides no guidance on when to use this tool versus alternatives like 'execute' (which might handle INSERT/UPDATE/DELETE) or 'list_tables' (which might provide table listings). There's no mention of prerequisites (e.g., requires database connection), error conditions, or typical use cases for SELECT queries.
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. Dates show when Glama detected each change.
5 tool updates
- First observed
connect_db - First observed
describe_table - First observed
execute - First observed
list_tables - First observed
query
TDQS
Each tool has a clearly distinct purpose with no ambiguity: connect_db handles database connections, describe_table retrieves table structures, execute manages data modification queries, list_tables enumerates tables, and query handles SELECT queries. The separation between execute (for INSERT/UPDATE/DELETE) and query (for SELECT) is particularly well-defined.
All tool names follow a consistent verb_noun pattern with snake_case: connect_db, describe_table, execute, list_tables, and query. While 'execute' and 'query' are single words, they function as verbs in this context and maintain readability without mixing conventions.
With 5 tools, this server is well-scoped for MySQL database interactions. Each tool earns its place by covering essential operations: connection management, schema inspection, data querying, and data modification. This count is neither too sparse nor bloated for the domain.
The tool set provides strong coverage for core MySQL workflows, including connection, schema exploration, and CRUD operations via execute and query. A minor gap exists in lacking explicit tools for database management (e.g., create/drop database) or transaction control, but agents can work around this using execute for such queries.
Maintenance
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.
A Model Context Protocol server for Wix AI tools
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA server that enables AI models to interact with MySQL databases through a Model Control Protocol, providing tools for table creation, schema inspection, query execution, and data retrieval.28MIT
- 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-
- 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-
- AlicenseAqualityDmaintenanceA Model Context Protocol server that allows AI agents to execute SQL queries against a MySQL database, supporting operations like reading data, creating tables, inserting, updating, and deleting records.64548MIT
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/Atomzzm/mcp-mysql-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server