list_tablesLABSCO SUMMARY
The annotations shape the prompts; the database grant is the real boundary.
The project says it plainly: readOnlyHint and destructiveHint only change how a client asks you, and security is enforced entirely by the credentials in your connection string. Create a dedicated SQL Server login with the narrowest grants the work needs — SELECT-only if the model should never write — and point the server at that instead of an administrative account.
What it is
A Python MCP server for Microsoft SQL Server with three tools, each carrying MCP annotations so a client knows which are safe to auto-approve and which should prompt.
What you get
list_tables— every table in the configured database, annotated read-only and idempotentquery_sql— read-only SELECT queries, annotated read-only and idempotentexecute_sql— any statement, SELECT through INSERT, UPDATE, DELETE and DDL, annotated destructive- Identifier validation against SQL injection, and query logging you can audit
- Stdio by default, or Streamable HTTP by setting
MCP_TRANSPORT
Requirements
Install with pip install mssql-mcp-server. MSSQL_DATABASE is required; then either MSSQL_USER and MSSQL_PASSWORD, or Trusted_Connection=yes for Windows and Kerberos auth. MSSQL_HOST (or MSSQL_SERVER) and MSSQL_DRIVER default to localhost and the built-in Windows driver — on Linux and macOS install Microsoft ODBC Driver 18 and name it in MSSQL_DRIVER.
Setup effort
One command plus credentials — pip install mssql-mcp-server, then supply credentials
USE CASES
Answering a data question without opening SSMS
List the tables, then run the SELECT and get the rows back in the conversation.
Finding your way around a database nobody documented
Start from the table list and work outward with read-only queries before writing anything.
Applying a schema change from the conversation
Run the DDL through the destructive-annotated tool, so the client stops and asks you first.
Handing an agent deliberately read-only access
Grant the login SELECT only — the write tool then fails at the database instead of relying on the client to prompt.
3 tools
Listed in project docs. Your client may show a different list.
query_sqlexecute_sqlBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
MSSQL_DATABASE in your environment
Optional
- MSSQL_USER in your environment
- MSSQL_PASSWORD in your environment
Where it runs
Both documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
pip install mssql-mcp-serverMCP Clients
Claude Desktop, Cursor
{
"mcpServers": {
"mssql": {
"command": "mssql_mcp_server",
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "<YOUR_MSSQL_USER>",
"MSSQL_PASSWORD": "<YOUR_MSSQL_PASSWORD>",
"MSSQL_DATABASE": "<YOUR_MSSQL_DATABASE>"
}
}
}
}