One governed MCP surface
Expose SQL Server without handing the model an unrestricted database connection.
SQL Server · MCP
Connect AI clients to SQL Server through hs-sql-agent's MCP surface, typed SQL compiler, access policy, Safe DML workflow, and audit boundary.
Expose SQL Server without handing the model an unrestricted database connection.
Keep SQL Server-specific SQL semantics inside an explicit source/target capability boundary.
Apply database scope, table policy, tool restrictions, rate limits, Safe DML, and audit before commit.
hs-sql-agent does not treat a model-generated SQL Server 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.
MCP clients can discover schemas, tables, and columns through the built-in metadata tools before constructing SQL Server SQL. This reduces blind schema guessing and keeps discovery inside the same authenticated database scope.
The SQL Server 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.
Declaring SQL Server changes the accepted source grammar. Syntax that belongs to another SQL family is rejected before execution instead of being passed through to the database driver and left for runtime failure.
The negative grammar contract explicitly rejects LIMIT and JOIN ... USING for SQL Server source SQL. This keeps T-SQL boundaries visible to the agent and to operators reviewing compiler diagnostics.
| Compiler contract example | Behavior |
|---|---|
SELECT id FROM users LIMIT 5 | Rejected as non-T-SQL source syntax. |
SELECT id FROM users JOIN orders USING (id) | Rejected because SQL Server does not provide the same native JOIN ... USING form. |
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.
The MCP tool surface is shared, but each database keeps its own source grammar, capability checks, and provider-specific rendering rules.
Direct database credentials make the model or MCP client responsible for everything the database account can do. hs-sql-agent keeps the real SQL Server 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.