# mssql-readonly-mcp

> mssql-readonly-mcp is an open-source MCP server for databases. Read-only SQL Server access for assistants, with a SELECT allowlist and audit log. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Windows, Linux, macOS, CLI, Self-hosted
- **Repository:** https://github.com/oguzhanpisgin/mssql-readonly-mcp
- **MCP Registry name:** io.github.oguzhanpisgin/mssql-readonly-mcp
- **Categories:** [databases](https://ai-powered.com/categories/databases), [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-23

## About

This server is built for firms that want an assistant to read one on-premises SQL Server database without any chance of writing to it. Its SQL tool accepts only text that passes an allowlist over the ScriptDom syntax tree for a single plain SELECT, so writes and DDL are refused before they reach the database.

Two further checks sit around that gate. The server will not start if the login fails a permission check (it exits with code 3), refusing logins such as sa, db_owner or db_datawriter. Every call is written to a hash-chained audit file before any data is returned, and a verify-audit command detects a tampered copy. Results are capped by rows, characters and time, and queries wait only a bounded time for locks and lose deadlocks against default-priority sessions.

The README is explicit about limits: rows the assistant reads go to the AI vendor running the model, along with table and column names and error text, and personal-data transfer rules remain the firm's decision. It is an early release, tested on SQL Server 2019, 2022 and 2025, and ships as bundles for Windows, Linux and macOS on Apple silicon.

## Features

- **SELECT-only gate:** A syntax-tree allowlist refuses writes and DDL before they reach SQL Server.
- **Login check at startup:** Refuses to start with a login holding write, owner or impersonation rights.
- **Hash-chained audit log:** Writes a tamper-evident line for every question before returning data.
- **Result caps:** Limits rows, characters and time per call.
- **Lock and deadlock handling:** Bounded lock wait and low deadlock priority so it yields to other sessions.
- **Read-only intent:** Connection adds ApplicationIntent=ReadOnly and a named application.

## Good for

- Let an assistant answer questions about an ERP or reporting database
- Keep an auditable record of every query an AI asks
- Check that a database login is safe before exposing it
- Explore a large legacy schema without risking writes

## Install

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

```text
https://github.com/oguzhanpisgin/mssql-readonly-mcp/releases/download/v0.1.1/mssql-readonly-mcp-0.1.1-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.

## FAQ

### Which SQL Server versions are tested?

SQL Server 2019, 2022 and 2025 on Linux container images, on every change.

### Does read-only keep my data private?

No. The README says rows the assistant reads go to the AI vendor running the model, with table and column names and error text.

### What configuration is required?

A connection string in MSSQL_CONNECTION_STRING and an audit file path in MSSQL_MCP_AUDIT_LOG.

### What happens if the audit line cannot be written?

The call returns an error and no data, though the query has already run.

### Is mssql-readonly-mcp free?

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

### What are the best alternatives to mssql-readonly-mcp?

The closest alternatives to mssql-readonly-mcp are REA, AiSOC, x64dbg-mcp-server, redamon and Treasure Map.

## Where this comes from

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

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [AiSOC](https://ai-powered.com/mcp/aisoc): AiSOC is an open-source MCP server for ai models and llm tooling.
- [x64dbg-mcp-server](https://ai-powered.com/mcp/x64dbg-mcp-server): x64dbg-mcp-server is an open-source MCP server for ai models and llm tooling.
- [redamon](https://ai-powered.com/mcp/redamon): redamon is an open-source MCP server for ai models and llm tooling.
- [Treasure Map](https://ai-powered.com/mcp/treasure-map): Treasure Map is an open-source MCP server for security.
- [Agent Roast](https://ai-powered.com/mcp/agent-roast): Agent Roast is an open-source MCP server for developer tools.
- [NostrPulse](https://ai-powered.com/mcp/nostrpulse): NostrPulse is an open-source MCP server for finance and payments.
- [Runeward](https://ai-powered.com/mcp/runeward): Runeward is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/mssql-readonly-mcp
