Lists all available tables in the connected MSSQL database
Retrieves and displays the contents of a specified table
Executes a custom SQL query with controlled access and error handling
MSSQL Database Access provides a secure interface for AI assistants to interact with Microsoft SQL Server databases. It enables listing available tables, reading table contents, and executing SQL queries with controlled access and proper permission enforcement. This tool ensures safer database exploration by implementing security best practices, restricting database access to only necessary operations, and providing comprehensive logging of all database interactions. It's designed to follow the principle of least privilege, making it suitable for production environments.
MSSQL Database Access enables AI assistants to interact with Microsoft SQL Server databases in a secure and structured manner. This tool provides controlled access to database operations while enforcing proper security measures.
You can install the MSSQL Database Access tool using pip:
pip install mssql-mcp-server
To use this tool, you need to configure database access through environment variables:
MSSQL_DRIVER=mssql_driver
MSSQL_HOST=localhost
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
MSSQL_DATABASE=your_database
Optional configuration parameters:
TrustServerCertificate=yes
Trusted_Connection=no
For secure operation, follow these guidelines:
Always follow the Principle of Least Privilege when configuring database access.
To integrate with Claude Desktop, add the following configuration to your claude_desktop_config.json
file:
{
"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"
}
}
}
}
If you prefer to run the server independently:
# Install dependencies
pip install -r requirements.txt
# Run the server
python -m mssql_mcp_server
For contributing to the development:
# Clone the repository
git clone https://github.com/JexinSam/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