Skip to main content
The mysql MCP adapter connects to MySQL over TCP with host, port, database, and credential-based authentication. It provides SQL execution, schema introspection, query-plan analysis, and operational diagnostics backed by performance_schema. Use it for reporting, data sync, slow-query triage, index hygiene audits, and schema-aware agents — often alongside the Postgres connector when you operate both relational engines.

Prerequisites

  • A MySQL server (5.7+ or 8.x) reachable from AgentRuntime (allowlist egress IPs if behind a firewall)
  • Host, Port, Database, User, and Password for the target schema
  • SELECT for reporting workflows; INSERT/UPDATE/DELETE only when steps call mysql_execute_sql for mutations
  • performance_schema enabled for diagnostic tools (mysql_list_table_stats, mysql_list_active_queries)
  • project_contributor access

Connect in AgentRuntime

1

Create a connection

Go to Connections and click New custom connection to create a database connection with your MySQL credentials:
  • Host — server hostname or IP (e.g. db.example.com)
  • Port — TCP port (default 3306)
  • Database — default schema for queries
  • User / Password — authentication credentials
Use a read-only account for reporting. Grant write privileges only when workflows mutate production tables.
2

Add mysql MCP instance

Go to MCP, click Add instance for mysql, wire your connection on Instance config, set the profile active, and save.
3

Test with a schema listing

Add a workflow with a single mcp_call to mysql_list_tables with output_format: "simple". Run it to confirm connectivity before production queries.
4

Verify diagnostics access (optional)

Run mcp_callmysql_list_active_queries to confirm performance_schema access when you plan ops monitoring workflows.
See Authentication for binding connections to MCP instances.

What you can build

  • Daily ops digestmysql_list_active_queries + mysql_list_table_fragmentation → LLM summary → Gmail or Slack alert.
  • Reporting pipelinemysql_execute_sql SELECT on a schedule → transform rows → push to Google Sheets or a Postgres warehouse.
  • Index hygiene auditmysql_list_tables_missing_unique_indexes → ticket creation in ClickUp or Wrike for tables without primary keys.
  • Approval-gated writeshuman_task before mysql_execute_sql INSERT/UPDATE/DELETE on production tables.

Tools

ToolDescription
mysql_list_active_queriesList non-sleeping MySQL queries ordered by execution time
mysql_list_tables_missing_unique_indexesList tables without a primary or unique key
mysql_list_table_fragmentationList the most fragmented MySQL tables
mysql_list_table_statsList MySQL table I/O statistics from performance_schema
mysql_execute_sqlExecute a single SQL statement against the configured MySQL database
mysql_list_tablesList schema information for all or selected MySQL tables
mysql_get_query_planReturn the JSON execution plan for a SQL statement

Example

Fetch pending orders for a daily report:
{
  "id": "fetch-orders",
  "type": "mcp_call",
  "name": "Fetch pending orders",
  "tool_name": "mysql_execute_sql",
  "tool_args": {
    "sql": "SELECT id, email, total FROM orders WHERE status = 'pending' LIMIT 100"
  },
  "timeout_s": 30
}
Reference query output in a downstream lua_script step:
{{steps.fetch-orders.result.rows}}

Configuration

KeyRequiredDefaultDescription
mysql_hostYesMySQL server hostname or IP address
mysql_portNo3306MySQL server TCP port
mysql_databaseYesDefault database (schema) for queries
mysql_userYesMySQL username for authentication
mysql_passwordYesMySQL password for authentication
mysql_query_timeout_secondsNo30Per-query timeout in seconds

Troubleshooting

IssueFix
Connection timeoutVerify host, port, firewall rules, and that the server accepts remote connections
Access deniedConfirm user/password and that the account is allowed from AgentRuntime’s network
Diagnostic tools emptyGrant SELECT on performance_schema or use a monitoring-capable DB user
Slow queries timing outIncrease mysql_query_timeout_seconds or add indexes; use mysql_get_query_plan to investigate