# SqlToAi

> SqlToAi is an open-source MCP server for databases. Local Windows MCP server for SQL Server schema discovery, queries and plan comparison. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Windows, CLI, Self-hosted
- **Repository:** https://github.com/ralfhuesing/sqltoai
- **MCP Registry name:** io.github.RalfHuesing/SqlToAi
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-11-23

## About

Built on .NET 10 and run over stdio, this server targets Microsoft SQL Server on Windows x64. It reads version, edition and compatibility level, inspects tables, views, routines, triggers, keys and indexes, and exports the schema as linked Markdown files for offline reading, even without starting the server.

Beyond metadata it can show estimated execution plans without running a query, run parameterized queries and .sql scripts with GO batches, stream results into CSV or JSONL files, and measure CPU time, elapsed time and reads so a baseline query can be compared with a candidate, including missing-index suggestions.

Access is configured per database: schema-only, read-only, read-write, and anonymized variants that mask strings or swap them for reversible tokens. The README stresses that these checks complement SQL Server permissions, that masking is not a guarantee, and that a restricted login should still be used.

## Features

- **Schema inspection:** Reads tables, views, routines, triggers, keys, indexes and references.
- **Execution plans:** Shows estimated plans with warnings without executing queries.
- **Query benchmarking:** Compares CPU, elapsed time and reads between two queries.
- **File streaming:** Writes query results straight to CSV or JSONL.
- **Access levels:** Schema-only through read/write, per database.
- **String masking:** Masks or tokenizes string results in anonymized databases.

## Good for

- Document a SQL Server database as Markdown
- Compare an optimized query with its original
- Let an assistant explore a reporting database read-only
- Export query results to CSV without pasting them into chat

## Install

### Claude Desktop (Claude Desktop → Settings → Extensions)

```text
https://github.com/RalfHuesing/SqlToAi/releases/download/v1.0.34/SqlToAi-win-x64.mcpb
```

Download the bundle and open it with Claude Desktop, or drag it onto Settings → Extensions and click Install. This server is only published as a Claude Desktop bundle.

## Tools

From the tool list in its README, going by the names, 1 of 3 tools changes data. From the server's own tool labels and tool names; not verified by us.

- `sql_list_databases` (name suggests: reads): List databases on a configured server.
- `sql_execute_query` (name suggests: changes): Run a query on a configured database.
- `sql_explain_query` (name suggests: reads): Show the estimated execution plan for a query.

## FAQ

### Which platforms are supported?

Windows x64; the package is self-contained and needs no separate .NET runtime.

### Where is SqlToAi configured?

In %LOCALAPPDATA%\SqlToAi\appsettings.json, created manually from the template.

### Is read-only mode enough?

The README says application checks complement SQL Server permissions, so use a restricted login too.

### Does masking guarantee privacy?

No. Numbers, dates and plan content can remain visible.

### Is SqlToAi free?

Yes. SqlToAi is open source, so you can use and self-host it for free.

### What are the best alternatives to SqlToAi?

The closest alternatives to SqlToAi are Midplane, Datatomcp, Gulliver, GaussDB Read-Only MCP and Zektor.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Datatomcp](https://ai-powered.com/mcp/datatomcp-2): Datatomcp is a freemium MCP server for analytics and data.
- [Gulliver](https://ai-powered.com/mcp/gulliver): Gulliver is an open-source MCP server for databases.
- [GaussDB Read-Only MCP](https://ai-powered.com/mcp/gaussdb-read-only-mcp): GaussDB Read-Only MCP is an open-source MCP server for databases.
- [Zektor](https://ai-powered.com/mcp/zektor): Zektor is a freemium MCP server for databases.
- [Sqlite Graph MCP](https://ai-powered.com/mcp/sqlite-graph-mcp): Sqlite Graph MCP is an MCP server for databases.
- [Trino](https://ai-powered.com/mcp/trino-2): Trino is an open-source MCP server for databases.
- [APoint MS SQL](https://ai-powered.com/mcp/apoint-ms-sql): APoint MS SQL is a free MCP server for databases.

---
Source: https://ai-powered.com/mcp/sqltoai
