How to let an AI agent write to a production SQL Server safely

English / 繁體中文

This page is for the case where an AI coding agent already needs to touch a production SQL Server, and you would rather not give it the real credentials and a free hand.

Short answer

LogCarverGuard is an MCP proxy that sits between the agent and SQL Server:

AI agent --(MCP, API key)--> LogCarverGuard proxy --(EXECUTE AS the caller's own login)--> SQL Server

What is blocked

Always blocked: DROP TABLE, DROP DATABASE, RESTORE DATABASE / RESTORE LOG, ALTER DATABASE ... SET, sp_executesql, xp_cmdshell, dynamic EXEC of a string, identity switching (REVERT, EXECUTE AS, SETUSER), permission changes, and caller-managed transactions.

Blocked unless the admin allow-lists it: TRUNCATE TABLE, ALTER TABLE ... DROP COLUMN, and EXEC of a named stored procedure.

A batch of INSERT / UPDATE / DELETE runs in one transaction that the proxy controls, and is rolled back as a whole if any statement fails.

Two ways to run it

Setup steps for both are in the README.

What it does not cover