微软SQL数据库
STDIO安全访问Microsoft SQL数据库的MCP服务器
安全访问Microsoft SQL数据库的MCP服务器
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.