Skip to content
hs-sql-agent

MySQL · MCP

MySQL MCP Server for AI agents.

Connect AI clients to MySQL through hs-sql-agent's MCP surface, typed SQL compiler, access policy, Safe DML workflow, and audit boundary.

01

One governed MCP surface

Expose MySQL without handing the model an unrestricted database connection.

02

Dialect-aware compiler

Keep MySQL-specific SQL semantics inside an explicit source/target capability boundary.

03

Policy before execution

Apply database scope, table policy, tool restrictions, rate limits, Safe DML, and audit before commit.

MySQL stays behind a compiler boundary

hs-sql-agent does not treat a model-generated MySQL statement as trusted simply because the provider could execute it. SQL first enters the typed validation and capability pipeline.

Provider support means the runtime can connect, inspect metadata, compile supported statements, and execute them under policy. It does not mean every vendor-specific syntax form is accepted automatically.

Use metadata before guessing schema

MCP clients can discover schemas, tables, and columns through the built-in metadata tools before constructing MySQL SQL. This reduces blind schema guessing and keeps discovery inside the same authenticated database scope.

  • get_schemas
  • get_tables
  • get_columns
  • execute_query_sql
  • execute_dml_sql

Fail closed when semantics are not proven

The MySQL path follows the same rule as every other provider: unsupported syntax or cross-provider semantics are rejected at the appropriate validation/capability boundary rather than silently rewritten into a query with different behavior.

MySQL capabilities are version- and dialect-aware

MySQL syntax is validated against MySQL rules rather than accepted as interchangeable SQL. Version-sensitive features can be gated by the declared server version, and provider-specific coercion semantics are not silently exported to another database.

Current compiler contracts require MySQL 8.0.1+ for recursive CTE support. MySQL DATE(expr) semantics also remain fail-closed for cross-dialect lowering when the operand meaning cannot be proven equivalent.

Compiler contract exampleBehavior
WITH RECURSIVE ...Requires MySQL 8.0.1+ when server-version capability checks are enabled.
SELECT DATE(created_at) ... → PostgreSQLRejected when MySQL DATE(expr) coercion semantics cannot be proven equivalent on the target.

These examples are a search-oriented summary of the compiler boundary, not a complete SQL compatibility matrix. Unsupported or unproven semantics continue to fail closed.

Compare database MCP targets

The MCP tool surface is shared, but each database keeps its own source grammar, capability checks, and provider-specific rendering rules.

Why use a MySQL MCP server instead of direct database access?

Direct database credentials make the model or MCP client responsible for everything the database account can do. hs-sql-agent keeps the real MySQL connection server-side and evaluates SQL against the compiler, MCP-key scope, table policy, tool restrictions, and runtime limits before execution.

That keeps raw SQL available as an expressive agent interface without turning generated SQL into unrestricted database authority.

  • raw SQL remains available for supported statements
  • database credentials stay behind the server boundary
  • unsupported semantics fail closed before execution
  • DML can require explicit human approval