A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases.
Configuration
View docs{
"mcpServers": {
"jexinsam-mssql_mcp_server": {
"command": "python",
"args": [
"-m",
"mssql_mcp_server"
],
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_DRIVER": "mssql_driver",
"MSSQL_DATABASE": "your_database",
"MSSQL_PASSWORD": "your_password",
"Trusted_Connection": "no",
"TrustServerCertificate": "yes"
}
}
}
}You can securely interact with a Microsoft SQL Server database through a dedicated MCP server. It exposes safe, structured operations like listing tables, reading data, and executing SQL queries with strict permission checks and comprehensive logging so you can explore data without risking exposure or misuse.
Use an MCP client to connect to the MSSQL MCP Server and perform the supported actions. You can list available tables to understand the schema, read contents of chosen tables, and execute SQL queries with controlled access. All operations are logged to help you monitor activity and enforce security policies.
Prerequisites: Ensure you have Python and pip installed on your system.
Install the MSSQL MCP Server package.
pip install mssql-mcp-serverConfigure database access by setting environment variables for the MSSQL connection.
MSSQL_DRIVER=mssql_driver
MSSQL_HOST=localhost
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DATABASE=your_database
# optional
TrustServerCertificate=yes
Trusted_Connection=noRun the MCP server locally.
python -m mssql_mcp_serverIf you plan to integrate with Claude Desktop, you can configure the client to launch the MSSQL MCP Server using a dedicated command sequence that runs the MCP server from a specified directory and passes the necessary environment variables.
List available tables in the connected MSSQL database to understand the schema.
Read and return contents of a specified table for inspection or data retrieval.
Execute a SQL query with restricted permissions and safe error handling, returning results or errors as appropriate.
Comprehensive logging of queries and operations for monitoring and auditing.