MySQL MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | Log verbosity level (debug, info, warning, error) | info |
| MYSQL_HOST | Yes | The MySQL database host | |
| MYSQL_PORT | No | The MySQL database port | 3306 |
| MYSQL_USER | Yes | The MySQL database user | |
| MYSQLSH_PATH | No | Path to MySQL Shell executable | |
| OAUTH_ISSUER | No | OAuth authorization server URL | |
| OAUTH_ENABLED | No | Enable OAuth 2.1 authentication | |
| PROXYSQL_HOST | No | ProxySQL admin interface host | |
| PROXYSQL_PORT | No | ProxySQL admin interface port | |
| PROXYSQL_USER | No | ProxySQL admin username | |
| MYSQL_DATABASE | Yes | The MySQL database name | |
| MYSQL_PASSWORD | Yes | The MySQL database password | |
| OAUTH_AUDIENCE | No | Expected OAuth token audience | |
| OAUTH_JWKS_URI | No | OAuth JWKS URI (auto-discovered if not provided) | |
| MYSQL_ROUTER_URL | No | MySQL Router REST API URL (e.g., https://localhost:8443) | |
| MYSQL_ROUTER_USER | No | MySQL Router REST API username | |
| PROXYSQL_PASSWORD | No | ProxySQL admin password | |
| METADATA_CACHE_TTL_MS | No | Cache TTL for schema metadata in milliseconds | 30000 |
| MYSQL_ROUTER_INSECURE | No | Set to 'true' to bypass SSL certificate verification for MySQL Router | |
| MYSQL_ROUTER_PASSWORD | No | MySQL Router REST API password | |
| OAUTH_CLOCK_TOLERANCE | No | OAuth clock tolerance in seconds |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"subscribe": true,
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| mysql_read_queryA | Execute a read-only SQL query (SELECT). Uses prepared statements for safety. |
| mysql_write_queryA | Execute a write SQL query (INSERT, UPDATE, DELETE). Uses prepared statements for safety. |
| mysql_list_tablesA | List all tables and views in the database with metadata. |
| mysql_describe_tableA | Get detailed information about a table's structure including columns, types, and constraints. |
| mysql_create_tableA | Create a new table with specified columns, engine, and charset. |
| mysql_drop_tableB | Drop (delete) a table from the database. |
| mysql_get_indexesA | Get all indexes for a table including type, columns, and cardinality. |
| mysql_create_indexA | Create an index on a table. Supports BTREE, HASH, FULLTEXT, and SPATIAL index types. |
| mysql_enable_versioningA | Enable optimistic concurrency control (OCC) on a table. Adds a _version column and an auto-increment trigger. |
| mysql_disable_versioningB | Disable optimistic concurrency control (OCC) on a table. Drops the _version column and its trigger. |
| mysql_check_versionA | Read the current _version of a specific row for optimistic concurrency control. |
| mysql_conditional_updateA | Update a row only if its _version matches expectedVersion. Prevents lost updates in multi-agent environments. |
| mysql_transaction_beginA | Begin a new transaction with optional isolation level. Returns a transaction ID for subsequent operations. |
| mysql_transaction_commitA | Commit a transaction, making all changes permanent. |
| mysql_transaction_rollbackC | Rollback a transaction, undoing all changes. |
| mysql_transaction_savepointC | Create a savepoint within a transaction for partial rollback. |
| mysql_transaction_releaseA | Release a savepoint, removing it without rolling back. |
| mysql_transaction_rollback_toA | Rollback to a savepoint, undoing changes after that point. |
| mysql_transaction_executeA | Execute multiple SQL statements atomically. All statements succeed or all are rolled back. |
| mysql_json_extractC | Extract values from JSON columns using JSON path expressions. |
| mysql_json_setB | Set or update values in JSON columns at specified paths. |
| mysql_json_insertA | Insert values into JSON columns only if the path does not exist. |
| mysql_json_replaceB | Replace values in JSON columns only if the path exists. |
| mysql_json_removeC | Remove values from JSON columns at specified paths. |
| mysql_json_containsB | Find rows where JSON column contains a specified value. |
| mysql_json_keysA | Get the keys of a JSON object at the specified path. |
| mysql_json_array_appendC | Append a value to a JSON array at the specified path. |
| mysql_json_getC | Simple JSON value extraction by row ID. |
| mysql_json_updateC | Simple JSON value update by row ID. |
| mysql_json_searchB | Search for a string value in JSON columns and return matching paths. |
| mysql_json_validateA | Validate if a string is valid JSON. |
| mysql_json_mergeA | Merge two JSON documents using JSON_MERGE_PATCH or JSON_MERGE_PRESERVE. |
| mysql_json_diffA | Compare two JSON documents and identify differences. |
| mysql_json_normalizeA | Normalize JSON column structure by extracting all unique keys across documents. |
| mysql_json_statsA | Analyze statistics for a JSON column including depth, size, and key frequency. |
| mysql_json_index_suggestB | Suggest functional indexes for frequently accessed JSON paths. |
| mysql_regexp_matchC | Find rows where column matches a regular expression pattern. |
| mysql_like_searchB | Find rows using LIKE pattern matching with % and _ wildcards. |
| mysql_soundexB | Find rows with phonetically similar values using SOUNDEX. |
| mysql_substringB | Extract substrings from column values. |
| mysql_concatA | Concatenate multiple columns with an optional separator. |
| mysql_collation_convertC | Convert column values to a different character set or collation. |
| mysql_execute_codeA | Execute TypeScript/JavaScript code in a sandboxed environment with access to all MySQL tools via the mysql.* API. Available API groups:
Example: |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| mysql_tool_index | Show all available MySQL tools organized by category |
| mysql_quick_query | Quickly run a SQL query - shortcut for mysql_read_query or mysql_write_query |
| mysql_quick_schema | Quickly explore database schema - lists tables or describes a specific table |
| mysql_query_builder | Help build SQL queries for common operations |
| mysql_schema_design | Help design table schemas |
| mysql_performance_analysis | Analyze and optimize slow queries |
| mysql_migration | Generate migration scripts for schema changes |
| mysql_database_health_check | Comprehensive database health assessment workflow |
| mysql_backup_strategy | Design enterprise backup strategy with RTO/RPO planning |
| mysql_index_tuning | Analyze and optimize database indexes |
| mysql_setup_router | Complete MySQL Router setup and configuration guide |
| mysql_setup_proxysql | Complete ProxySQL setup and configuration guide |
| mysql_setup_replication | MySQL replication setup and configuration guide |
| mysql_setup_shell | MySQL Shell setup and usage guide |
| mysql_setup_events | Complete MySQL Event Scheduler setup and configuration guide |
| mysql_sys_schema_guide | Complete MySQL sys schema usage guide for diagnostics and troubleshooting |
| mysql_setup_spatial | Complete MySQL Spatial/GIS setup and usage guide |
| mysql_setup_cluster | Complete MySQL InnoDB Cluster and Group Replication setup guide |
| mysql_setup_docstore | Complete MySQL Document Store and X DevAPI setup guide |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| mysql_help | Critical gotchas, parameter aliases, and Code Mode API reference |
| mysql_help_core | Tool reference for the core tool group |
| mysql_help_json | Tool reference for the json tool group |
| mysql_help_transactions | Tool reference for the transactions tool group |
| mysql_help_text | Tool reference for the text tool group |
| mysql_help_fulltext | Tool reference for the fulltext tool group |
| mysql_help_stats | Tool reference for the stats tool group |
| mysql_help_spatial | Tool reference for the spatial tool group |
| mysql_help_admin | Tool reference for the admin tool group |
| mysql_help_monitoring | Tool reference for the monitoring tool group |
| mysql_help_performance | Tool reference for the performance tool group |
| mysql_help_optimization | Tool reference for the optimization tool group |
| mysql_help_backup | Tool reference for the backup tool group |
| mysql_help_replication | Tool reference for the replication tool group |
| mysql_help_partitioning | Tool reference for the partitioning tool group |
| mysql_help_schema | Tool reference for the schema tool group |
| mysql_help_introspection | Tool reference for the introspection tool group |
| mysql_help_migration | Tool reference for the migration tool group |
| mysql_help_events | Tool reference for the events tool group |
| mysql_help_sysschema | Tool reference for the sysschema tool group |
| mysql_help_security | Tool reference for the security tool group |
| mysql_help_roles | Tool reference for the roles tool group |
| mysql_help_docstore | Tool reference for the docstore tool group |
| mysql_help_cluster | Tool reference for the cluster tool group |
| mysql_help_proxysql | Tool reference for the proxysql tool group |
| mysql_help_router | Tool reference for the router tool group |
| mysql_help_shell | Tool reference for the shell tool group |
| mysql_help_vector | Tool reference for the vector tool group |
| mysql_metrics | In-memory streaming metrics including p50/p95/p99 latency and token usage |
| Database Schema | Full database schema including tables, views, and indexes |
| Table List | List of all tables with metadata |
| Server Variables | MySQL server configuration variables |
| Server Status | MySQL server status metrics |
| Active Processes | Currently running queries and connections |
| Connection Pool | Connection pool statistics |
| Server Capabilities | MySQL server version, extensions, and available tool categories |
| Database Health | Comprehensive database health status |
| Performance Metrics | Query performance statistics and slow query analysis |
| Index Statistics | Index usage statistics, unused indexes, and duplicate detection |
| Replication Status | Replication status, lag monitoring, and GTID information |
| InnoDB Status | InnoDB buffer pool statistics and engine status |
| Scheduled Events | Event Scheduler status and scheduled events overview |
| sys Schema Diagnostics | Key diagnostic information from MySQL sys schema views |
| Lock Contention | Current InnoDB lock waits and blocking transactions |
| Cluster Status | Group Replication and InnoDB Cluster status overview |
| Spatial Columns | Spatial columns and indexes in the database |
| Document Store Collections | X DevAPI document collections in the current database |
| Business Insights Memo | Synthesized memo of business insights discovered during database analysis. Populated via mysql_append_insight tool. |
Latest Blog Posts
- 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/neverinfamous/mysql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server