MySQL MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DB_HOST | No | MySQL database host. | |
| DB_NAME | No | MySQL database name. | |
| DB_PORT | No | MySQL database port. | 3306 |
| DB_USER | No | MySQL database user. | |
| MCP_CONFIG | No | Comma-separated permission configuration used in the .env example, e.g. list,read,utility. | |
| DB_PASSWORD | No | MySQL database password. | |
| CACHE_ENABLED | No | Set to true to enable the query cache. Disabled by default. | false |
| MCP_AUDIT_LOG | No | Audit log destination: off, stderr, or a file path. Defaults to off over stdio and stderr in HTTP mode. | |
| MCP_HTTP_AUTH | No | HTTP authentication mode: none (loopback only), token, or oauth. | none |
| MCP_HTTP_HOST | No | HTTP transport bind address. | 127.0.0.1 |
| MCP_HTTP_PATH | No | HTTP transport endpoint path. | /mcp |
| MCP_HTTP_PORT | No | HTTP transport port. | 3000 |
| MCP_TRANSPORT | No | Transport mode: stdio or http. | stdio |
| MCP_CATEGORIES | No | Comma-separated documentation categories for fine-grained tool filtering, e.g. database_discovery,custom_queries,analysis. | |
| MCP_PERMISSIONS | No | Comma-separated permission list controlling broad operation-level access, e.g. list,read,utility,create,update,delete,execute,ddl,transaction,procedure. | list,read,utility |
| MCP_OAUTH_ISSUER | No | OAuth 2.1 token issuer for HTTP OAuth authentication. | |
| MCP_OAUTH_AUDIENCE | No | OAuth 2.1 token audience for HTTP OAuth authentication. | |
| MCP_OAUTH_JWKS_URI | No | OAuth 2.1 JWKS URI for token validation; discovered by default. | |
| MCP_HTTP_PUBLIC_URL | No | Public HTTPS base URL for HTTP transport. Required when MCP_HTTP_AUTH is oauth. | |
| MCP_HTTP_AUTH_TOKENS | No | Comma-separated bearer tokens for token authentication, each at least 32 characters. | |
| MCP_HTTP_TRUST_PROXY | No | Set to true to take the client IP from X-Forwarded-For. | false |
| MCP_MAX_RESULT_BYTES | No | Maximum result size in bytes. Defaults to 0 (off) over stdio and 524288 in HTTP mode. | |
| MCP_QUERY_TIMEOUT_MS | No | Query timeout in milliseconds. Defaults to 0 (off) over stdio and 30000 in HTTP mode. | |
| MCP_HTTP_MAX_SESSIONS | No | Maximum concurrent HTTP sessions; 0 means no limit. | 100 |
| MCP_HTTP_ALLOWED_HOSTS | No | Host header allowlist for HTTP transport. | |
| MCP_HTTP_MAX_BODY_BYTES | No | Maximum HTTP request body size in bytes; 0 means no limit. | 1048576 |
| MCP_HTTP_ALLOWED_ORIGINS | No | Browser Origin allowlist for HTTP transport. | |
| MCP_OAUTH_REQUIRED_SCOPES | No | OAuth 2.1 required scopes for token validation. | |
| MCP_RATE_LIMIT_PER_MINUTE | No | Tool calls per client per minute. Defaults to 0 (off) over stdio and 60 in HTTP mode. | |
| MCP_REQUIRE_READONLY_DB_USER | No | Set to true to make startup fail if the MySQL user can write. | false |
| MYSQL_MCP_CURSOR_REQUEST_FILE | No | Override the request file path used by the Cursor compatibility bridge. | |
| MCP_HTTP_ALLOW_UNAUTHENTICATED | No | Set to true to allow none authentication outside loopback. Not recommended. | false |
| MCP_HTTP_SESSION_IDLE_TIMEOUT_MS | No | Idle HTTP sessions close after this many milliseconds; 0 means never. | 1800000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_databasesA | Lists all databases available on the MySQL server. Use this to discover what databases exist before querying them. |
| list_tablesA | Lists all tables in the connected database. Use this as the first step when exploring an unfamiliar database to see available tables. |
| get_database_summaryA | 📊 Returns a high-level overview of the database including all tables, their columns, data types, row counts, and relationships. RECOMMENDED: Use this first when exploring a new database to understand its structure quickly. Features: database overview, per-table breakdown with primary keys, columns with nullable info and foreign key references, optional relationship summary, and configurable table limits. |
| get_schema_erdA | 📈 Generates a visual Mermaid.js ER diagram showing tables and their relationships. Perfect for visualizing database structure and foreign key connections. Use when users ask to 'visualize' or 'diagram' the database. |
| get_schema_rag_contextB | 🎯 AI-OPTIMIZED: Returns ultra-compact schema information (tables, columns, keys, relationships, comments, row estimates) designed specifically for LLM context windows. Use keyword_filter for concept-focused schema discovery. |
| find_tables_by_keywordA | 🔎 Schema discovery: finds candidate tables for a concept or keyword by searching table names, column names, TABLE_COMMENT, and COLUMN_COMMENT metadata. Use when users ask 'which table stores X?' before reading sample data. |
| search_schemaA | 🧭 Unified schema discovery for natural-language 'where is X?' questions. Searches schema metadata by default and can optionally perform a guarded sample-data scan when mode sample_data is requested. |
| search_data_across_tablesA | 🔍 Guarded read-only keyword scan across text-like table data. Use only when schema metadata does not reveal where a concept is stored; enforces max table and per-table result limits. |
| get_column_statisticsA | Returns detailed statistics for a specific column: min/max values, average, distinct count, null percentage, and value distribution. Use to understand data quality and ranges in a column before writing queries. |
| read_table_schemaA | Returns complete schema definition for a table: columns, data types, constraints, keys, indexes, and defaults. Use when you need detailed structural information about a specific table. |
| read_recordsA | Reads records from a table with built-in filtering, pagination, and sorting. Use this for simple data retrieval. For complex queries with JOINs or aggregations, use run_select_query instead. |
| plan_seed_dataA | 🌱 RELATIONAL SEEDER: Analyzes target tables, foreign keys, constraints, and row counts to build a safe parent-first seed plan. Use this before generating preview or inserting dummy relational data. |
| generate_seed_previewA | 🌱 RELATIONAL SEEDER: Generates deterministic dummy row previews from a seed plan without writing to the database. Shows symbolic foreign-key placeholders for review before execution. |
| validate_seed_integrityA | 🌱 RELATIONAL SEEDER: Validates seed results with FK orphan checks, required-column checks, unique-collision checks, and inserted row-count checks. |
| infer_seed_rulesA | 🌱 ADVANCED SEEDER: Infers safe seed generator rules from schema metadata, sample row patterns, unique constraints, and optional ecommerce/POS/CRM domain presets without returning raw PII samples. |
| seed_from_templateB | 🌱 TEMPLATE SEEDER: Creates a plan-first FK-aware seed workflow from ecommerce, POS, or CRM templates. It detects matching tables, applies domain rules, and returns a seed plan for preview/execution. |
| run_select_queryA | ⚡ PRIMARY TOOL FOR SELECT QUERIES. Executes read-only SELECT statements with parameterization, optimizer hints, query caching, and dry-run mode. Supports complex queries with JOINs, subqueries, and aggregations. ⚠️ ONLY for SELECT - use execute_write_query for INSERT/UPDATE, use execute_ddl for CREATE/ALTER/DROP. |
| repair_queryA | 🔧 Diagnoses SQL query errors and suggests fixes. Analyzes syntax errors, missing columns/tables, and logic issues. Provide the query and optional error message to get repair recommendations. Use when a query fails or needs debugging. |
| describe_connectionA | Returns current database connection details: host, database name, user, port, and connection status. Use to verify which database you're connected to. |
| cursor_execute_requestA | Cursor compatibility bridge for clients that can call MCP tools but cannot send arguments. Requires utility permission and an enabled destination tool. Reads .cursor/mysql-mcp-request.json (or MYSQL_MCP_CURSOR_REQUEST_FILE) and dispatches to the requested MySQL MCP tool. The request file supports {"tool":"execute_ddl","arguments":{"query":"DROP TABLE IF EXISTS t;"}} or direct SQL with {"query":"...","mode":"auto"}. |
| read_changelogA | Reads the MySQL MCP Server changelog to see version history, new features, bug fixes, and breaking changes. Useful for understanding tool capabilities and recent updates. |
| test_connectionA | Tests database connectivity and measures latency. Returns connection status and response time. Use to troubleshoot connection issues or check database availability. |
| list_all_toolsA | 📋 Returns complete catalog of all available tools with names, descriptions, parameters, and current permissions. Use to discover tool capabilities or when users ask 'what can you do?'. |
| get_all_tables_relationshipsA | Gets ALL table foreign key relationships in the entire database in a single efficient query. Returns a comprehensive relationship map showing parent-child connections between all tables. Much faster than querying table-by-table. |
| list_stored_proceduresA | Lists all stored procedures in the specified database. |
| get_stored_procedure_infoB | Gets detailed information about a specific stored procedure including parameters and metadata. |
| show_create_procedureC | Shows the CREATE statement for a stored procedure. |
| export_table_to_csvB | 📄 Exports table data to CSV format with filtering, pagination, and sorting. Requires both utility and read permissions. |
| export_query_to_csvB | 📄 Executes a SELECT query and exports results to CSV format. Requires both utility and read permissions. Supports complex queries with JOINs and aggregations. |
| analyze_queryA | 🔍 Analyzes a SQL query using EXPLAIN and provides optimization suggestions: missing indexes, inefficient operations, cost estimates. Returns actionable recommendations. Use before running expensive queries. |
| get_optimization_hintsB | Get suggested MySQL optimizer hints for a specific optimization goal (SPEED, MEMORY, or STABILITY). |
| list_viewsB | Lists all views in the connected database. |
| get_view_infoB | Gets detailed information about a specific view including columns and definition. |
| show_create_viewB | Shows the CREATE statement for a view. |
| list_triggersB | Lists all triggers in the database, optionally filtered by table. |
| get_trigger_infoC | Gets detailed information about a specific trigger. |
| show_create_triggerB | Shows the CREATE statement for a trigger. |
| list_indexesB | Lists all indexes for a specific table. |
| get_index_infoC | Gets detailed information about a specific index. |
| analyze_indexC | Analyzes a table to update index statistics. |
| list_foreign_keysC | Lists all foreign key constraints for a table. |
| list_constraintsB | Lists all constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK) for a table. |
| analyze_tableB | Analyzes a table to update index statistics for the query optimizer. |
| check_tableC | Checks a table for errors. |
| get_table_statusB | Gets detailed status and statistics for one or all tables. |
| get_table_sizeA | Gets size information for one or all tables including data and index sizes. |
| fulltext_searchB | Performs full-text search on a table using MATCH AGAINST clause. Supports natural language, boolean mode, and query expansion. Returns results ordered by relevance score. Use this for efficient text search on indexed columns. |
| get_fulltext_infoA | Retrieves information about FULLTEXT indexes on a table including index names, columns, and parser details. Use this to discover what fulltext indexes exist on a table. |
| get_fulltext_statsA | Retrieves statistics for FULLTEXT indexes on a table including document count, size, and key length. Use this to analyze index performance and size. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 49 tools
Many tools overlap heavily on schema discovery and data lookup: get_database_summary, get_schema_rag_context, find_tables_by_keyword, search_schema, search_data_across_tables, and get_all_tables_relationships all compete for similar 'where is X?' questions. Read/query boundaries are also blurry among read_records, run_select_query, fulltext_search, and search_data_across_tables, while analyze_table, analyze_index, and check_table are easy to confuse.
Almost all tools use snake_case, and most follow a recognizable verb_noun pattern such as list_tables, get_view_info, show_create_view, and read_records. There are minor deviations like cursor_execute_request, fulltext_search, and get_all_tables_relationships, but naming remains readable and mostly predictable.
At 49 tools, the surface is far beyond the typical well-scoped 3-15 range and includes many specialized discovery, seeder, export, and utility tools. The count feels heavy for a MySQL MCP server and increases selection complexity.
The read and schema-exploration surface is broad, but core write/DDL operations appear missing: run_select_query references execute_write_query and execute_ddl, yet those tools are not listed. Seeder tools cover planning, previewing, and validation but no explicit seed execution/insert tool is present, leaving significant workflow gaps.