MSSQL MCP Server
@JexinSam
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
Overview
What is MSSQL MCP Server?
MSSQL MCP Server is a Model Context Protocol (MCP) server that enables AI assistants to securely and interact with Microsoft SQL Server databases. It provides controlled access to list tables, read table contents, and execute SQL queries with error handling and logging.
How to use MSSQL MCP Server?
Install via pip install mssql-mcp-server, then configure database access using environment variables (MSSQL_HOST, MSSQL_USER, MSSQL_PASSWORD, etc.). It can be run as a standalone server with python -m mssql_mcp_server or integrated with Claude Desktop by adding a configuration block to claude_desktop_config.json.
Key features of MSSQL MCP Server
- Secure MSSQL database access via environment variables
- Controlled SQL query execution with error handling
- Table listing and data retrieval capabilities
- Comprehensive logging for monitoring queries
- Supports both standalone and Claude Desktop usage
Use cases of MSSQL MCP Server
- AI assistants exploring database schemas and reading table data
- Executing read-only SQL queries with enforced permissions
- Integrating MSSQL database access into MCP‑compatible applications
- Auditing database interactions through built‑in logging
FAQ from MSSQL MCP Server
How do I install MSSQL MCP Server?
Install it with pip install mssql-mcp-server. For development, clone the repository, set up a virtual environment, and install requirements-dev.txt.
What environment variables are required?
You must set MSSQL_DRIVER, MSSQL_HOST, MSSQL_USER, MSSQL_PASSWORD, and MSSQL_DATABASE. Optionally, TrustServerCertificate and Trusted_Connection can be set.
Is MSSQL MCP Server secure?
The README emphasizes security: use a dedicated MSSQL user with minimal privileges, never use root credentials, restrict database access to necessary operations, enable logging and auditing, and regularly review permissions. See the included Security Configuration Guide for details.
What runtime dependencies does it have?
It requires Python and the mssql-mcp-server package. For development, additional dependencies for testing (e.g., pytest) are listed in requirements-dev.txt.
How can I run MSSQL MCP Server with Claude Desktop?
Add an mssql entry to your claude_desktop_config.json under mcpServers, specifying the uv command with the path to the server directory and the required environment variables.