Menu

1 / 2

Letting an AI assistant read SQL Server without letting it write

DEV Community: dotnet·Oğuzhan Pişgin·2 days ago
#eKaHaNO6
#devtodotnet#devto#dev#server#call
Reading 0:00
15s threshold

The problem

The request sounds simple: let an AI assistant answer questions from a company's on-premises SQL Server. The hard part is what the assistant must not be able to do.

The threat model treats the assistant itself as the attacker: it can be prompt-injected, for example by text stored in a table it just read, or simply make a mistake. The goal is that three things still hold: it cannot change the database, it cannot read outside the connected database, and it cannot get data back from a call before that call is recorded.

First, what no gateway fixes: the rows the assistant reads leave the building, to the AI vendor that runs the model. Read-only does not change that. What may be sent, under which personal-data rules (KVKK in Turkey, others elsewhere), is the firm's decision.

The design

mssql-readonly-mcp is a free, open-source (MIT) MCP server in C# on .NET 10. The assistant's client starts it as a local stdio process. It offers three tools: list_tables , describe_table and run_query .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.