Skip to content
hs-sql-agent

Open-source SQL MCP server · fail-closed · six SQL dialects

A secure SQL MCP server for AI agents.

Let MCP clients use raw SQL without handing them unrestricted database access. hs-sql-agent validates generated SQL, enforces server-side policy, and gates DML before execution.

docker compose up -d

Choose how you run it

One product, three consumption paths.

Deploy the official service, embed the complete first-party host, or compose a custom ASP.NET Core integration. The SQL safety model stays the same.

Compiler boundary

Validate AI-generated SQL before it reaches your database.

Keep raw SQL flexibility without blindly executing model output. The compiler rejects statements that fall outside the supported dialect, capability, or server-side policy boundary.

Safe mutation path

DML approval is a protocol, not a confirmation dialog.

UPDATE and DELETE are previewed without mutation, approval is bound to the validated compiled plan and row-set fingerprint, and the matched rows are checked again before commit.

01
Preview

Read the affected rows without executing the mutation.

02
Approve

Require explicit approval through MCP form Elicitation.

03
Revalidate

Re-query inside the commit transaction and compare the bound row set.

04
Commit

Execute only when the plan, policy, challenge, row count, and row set still match.

One surface, six dialects

One SQL MCP server for six database dialects.

Connect PostgreSQL, MySQL, SQL Server, Oracle, SQLite, or Firebird while keeping provider-specific SQL semantics behind one governed MCP interface.

MCP and .NET integrations

Meet agents where they already work.

Connect remote MCP clients such as Claude Desktop and Cursor, or embed the same governed server boundary inside an ASP.NET Core application.

Documentation

From first MCP key to production governance.

The documentation is organized around the way operators actually adopt hs-sql-agent: setup, MCP, compiler guarantees, administration, integrations, operations, and development.