by JexinSam
A Model Context Protocol (MCP) server facilitating secure interactions with MSSQL databases, enabling AI assistants to interact with MSSQL databases safely and efficiently.
MSSQL MCP Server is a Model Context Protocol (MCP) server designed to provide secure and structured interaction with Microsoft SQL Server (MSSQL) databases. It acts as an intermediary, allowing AI assistants to perform database operations like listing tables, reading content, and executing SQL queries with controlled access and comprehensive logging.
Installation:
pip install mssql-mcp-server
Configuration: Set environment variables for database access:
MSSQL_DRIVER=mssql_driver
MSSQL_HOST=localhost
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DATABASE=your_database
#optional
TrustServerCertificate=yes
Trusted_Connection=no
Usage with Claude Desktop:
Add the following configuration to claude_desktop_config.json
:
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_DRIVER": "mssql_driver",
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}
Running as a Standalone Server:
pip install -r requirements.txt
python -m mssql_mcp_server
Q: What is the primary purpose of MSSQL MCP Server? A: Its primary purpose is to enable secure and structured interaction between AI assistants and MSSQL databases using the Model Context Protocol.
Q: How does MSSQL MCP Server ensure security? A: It ensures security through controlled query execution, comprehensive logging, and adherence to security best practices like using dedicated, least-privileged MSSQL users and environment variables for credentials.
Q: Can I use MSSQL MCP Server with other applications besides Claude Desktop? A: Yes, it can be run as a standalone server, allowing integration with various applications that can interact with a Model Context Protocol server.
Q: What are the recommended security practices when using MSSQL MCP Server? A: It is highly recommended to use a dedicated MSSQL user with minimal privileges, avoid hardcoding credentials, restrict database access to only necessary operations, enable logging and auditing, and regularly review permissions. Always follow the Principle of Least Privilege.
MSSQL MCP Server is a Model Context Protocol (MCP) server that enables secure and structured interaction with Microsoft SQL Server (MSSQL) databases. It allows AI assistants to:
This ensures safer database exploration, strict permission enforcement, and logging of database interactions.
pip install mssql-mcp-server
Set the following environment variables to configure database access:
MSSQL_DRIVER=mssql_driver
MSSQL_HOST=localhost
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DATABASE=your_database
#optional
TrustServerCertificate=yes
Trusted_Connection=no
To integrate with Claude Desktop, add this configuration to claude_desktop_config.json
:
{
"mcpServers": {
"mssql": {
"command": "uv",
"args": [
"--directory",
"path/to/mssql_mcp_server",
"run",
"mssql_mcp_server"
],
"env": {
"MSSQL_DRIVER": "mssql_driver",
"MSSQL_HOST": "localhost",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password",
"MSSQL_DATABASE": "your_database"
}
}
}
}
# Install dependencies
pip install -r requirements.txt
# Run the server
python -m mssql_mcp_server
# Clone the repository
git clone https://github.com/yourusername/mssql_mcp_server.git
cd mssql_mcp_server
# Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
For a secure setup:
For detailed instructions, refer to the MSSQL Security Configuration Guide.
⚠️ IMPORTANT: Always follow the Principle of Least Privilege when configuring database access.
This project is licensed under the MIT License. See the LICENSE
file for details.
We welcome contributions! To contribute:
git checkout -b feature/amazing-feature
git commit -m 'Add amazing feature'
git push origin feature/amazing-feature
For any questions or issues, feel free to open a GitHub Issue or reach out to the maintainers.
Please log in to share your review and rating for this MCP.