- Home
- MCP servers
- Microsoft SQL Server
Microsoft SQL Server
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"nicolaspirello-microsoft-sql-server-mcp-server": {
"command": "python",
"args": [
"-m",
"mssql_mcp_server"
],
"env": {
"MSSQL_USER": "YOUR_USERNAME",
"PYTHONPATH": "C:\\Path\\To\\Your\\Repo\\src",
"MSSQL_SERVER": "YOUR_SQL_HOST_OR_IP",
"MSSQL_ENCRYPT": "true",
"MSSQL_DATABASE": "YOUR_DATABASE_NAME",
"MSSQL_PASSWORD": "YOUR_PASSWORD",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}This MCP Server lets your AI assistants connect to a Microsoft SQL Server database to perform read-only queries, enabling natural language questions like “How many users exist?” to be translated into efficient SQL under the hood. It keeps a persistent connection for fast responses and is designed for safe inspection and analysis against your data.
How to use
You can query your SQL Server data directly from your MCP-enabled AI client. The server runs locally or remotely and exposes a read-only interface, so you can ask questions that translate into SQL queries without modifying any data. To use it, make sure your MCP client points to the running MCP server and that the required environment variables are set so the server can reach your database.
How to install
Prerequisites you need before installation are: Python 3.11 or higher, and the SQL Server ODBC driver for Windows (version 17 or newer) installed on your machine. You also need access to a SQL Server database.
- Create a virtual environment and install the server in editable mode.
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -e .
Additional setup and configuration
Configure the database credentials in the MCP client to point to your SQL Server. You will set the environment variables shown in the configuration examples below. The server expects the following variables to establish a connection.
Windows configuration for Windsurf and Antigravity (Gemini) use the same environment variables. Each client loads a separate mcp_config.json that references the Python runtime and the module to start the MCP server.
Environment variables used by the server:
Security and usage notes
This server is designed for read-only access to your SQL Server data. Ensure that the credentials used grant only the necessary SELECT permissions and that network access to the SQL Server is restricted to trusted clients. Use encrypted connections and enable certificate validation as appropriate for your environment.
Troubleshooting and testing
To test the connection without starting the AI client, verify that the server can start with the given environment variables and run a quick connection test script provided with the project. See the test script section for how to run a basic connectivity check.
Available tools
natural_query_execution
Translates natural language questions into SQL queries and executes them against the connected SQL Server in read-only mode.
read_only_inspection
Restricts operations to data inspection and analysis, preventing data modification.
persistent_connection
Maintains a persistent connection to the SQL Server for fast, real-time responses.
compatibility_windsurf_cursor
Ensures compatibility with Windsurf and Cursor MCP clients for seamless integration.